Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2021538

Summary: cloud-init.service fails to start after package update
Product: Red Hat Enterprise Linux 8 Reporter: Imre Jonk <imre>
Component: cloud-initAssignee: Emanuele Giuseppe Esposito <eesposit>
Status: CLOSED ERRATA QA Contact: xiachen
Severity: high Docs Contact:
Priority: urgent    
Version: 8.5CC: anhvo, eesposit, eterrell, huzhao, jgreguske, mrezanin, ngalvin, xiachen, xiliang, yacao
Target Milestone: rcKeywords: ZStream
Target Release: ---Flags: pm-rhel: mirror+
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: cloud-init-21.1-10.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2028381 2028738 (view as bug list) Environment:
Last Closed: 2022-05-10 13:35:26 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2028381, 2028738    

Description Imre Jonk 2021-11-09 15:01:16 UTC
Description of problem:
After updating two Azure VMs to RHEL 8.5 today, I noticed that the cloud-init service had failed to start.

Version-Release number of selected component (if applicable):
21.1-7.el8

How reproducible:
Always.

Steps to Reproduce:
1. Boot up a RHEL 8.4 machine on Azure.
2. Update it to RHEL 8.5.
3. Reboot
4. Notice that the cloud-init service failed to start.

Actual results:
"""
Nov 09 10:17:48 secure6.ciphermail.com cloud-init[1379]: 2021-11-09 09:17:48,344 - util.py[WARNING]: failed stage init
Nov 09 10:17:48 secure6.ciphermail.com cloud-init[1379]: failed run of stage init
Nov 09 10:17:48 secure6.ciphermail.com cloud-init[1379]: ------------------------------------------------------------
Nov 09 10:17:48 secure6.ciphermail.com cloud-init[1379]: Traceback (most recent call last):
Nov 09 10:17:48 secure6.ciphermail.com cloud-init[1379]:   File "/usr/lib/python3.6/site-packages/cloudinit/cmd/main.py", line 652, in status_wrapper
Nov 09 10:17:48 secure6.ciphermail.com cloud-init[1379]:     ret = functor(name, args)
Nov 09 10:17:48 secure6.ciphermail.com cloud-init[1379]:   File "/usr/lib/python3.6/site-packages/cloudinit/cmd/main.py", line 376, in main_init
Nov 09 10:17:48 secure6.ciphermail.com cloud-init[1379]:     init.update()
Nov 09 10:17:48 secure6.ciphermail.com cloud-init[1379]:   File "/usr/lib/python3.6/site-packages/cloudinit/stages.py", line 372, in update
Nov 09 10:17:48 secure6.ciphermail.com cloud-init[1379]:     self._store_rawdata(self.datasource.get_vendordata2_raw(),
Nov 09 10:17:48 secure6.ciphermail.com cloud-init[1379]:   File "/usr/lib/python3.6/site-packages/cloudinit/sources/__init__.py", line 506, in get_vendordata2_raw
Nov 09 10:17:48 secure6.ciphermail.com cloud-init[1379]:     return self.vendordata2_raw
Nov 09 10:17:48 secure6.ciphermail.com cloud-init[1379]: AttributeError: 'DataSourceAzure' object has no attribute 'vendordata2_raw'
Nov 09 10:17:48 secure6.ciphermail.com cloud-init[1379]: ------------------------------------------------------------
Nov 09 10:17:48 secure6.ciphermail.com systemd[1]: cloud-init.service: Main process exited, code=exited, status=1/FAILURE
Nov 09 10:17:48 secure6.ciphermail.com systemd[1]: cloud-init.service: Failed with result 'exit-code'.
Nov 09 10:17:48 secure6.ciphermail.com systemd[1]: Failed to start Initial cloud-init job (metadata service crawler).
"""

Expected results:
cloud-init should start without issues.

Additional info:
Possibly related upstream bug report: https://bugs.launchpad.net/cloud-init/+bug/1922739

We have been able to work around the issue by running `# cloud-init clean` and rebooting the host. This unfortunately also reset the host SSH keys, among other things.

Comment 1 xiachen 2021-11-10 03:16:09 UTC
Thanks reporting this bug, QE can reproduce it.
Set qa_ack+.

This bug can also be reproduced on openstack.  It is a general issue of cloud-init, not only on Azure.
2021-11-10 02:43:40,908 - util.py[WARNING]: failed stage init
2021-11-10 02:43:40,908 - util.py[DEBUG]: failed stage init
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/cloudinit/cmd/main.py", line 652, in status_wrapper
    ret = functor(name, args)
  File "/usr/lib/python3.6/site-packages/cloudinit/cmd/main.py", line 376, in main_init
    init.update()
  File "/usr/lib/python3.6/site-packages/cloudinit/stages.py", line 372, in update
    self._store_rawdata(self.datasource.get_vendordata2_raw(),
  File "/usr/lib/python3.6/site-packages/cloudinit/sources/__init__.py", line 506, in get_vendordata2_raw
    return self.vendordata2_raw


Root cause is showing in that upstream bug, https://bugs.launchpad.net/cloud-init/+bug/1922739,
They added 'vendordata2' and 'vendordata2_raw' attributes to the DataSource class, but didn't use the upgrade framework to deal with an unpickle after upgrade. Because of this, anybody upgrading their cloud-init from an older version to 21.1 who hasn't also run `cloud-init clean` will have cloud-init fail with a traceback.

The fix will be fetched from upstream by our developers.
Pull request: https://github.com/canonical/cloud-init/pull/869
Commit: https://github.com/canonical/cloud-init/commit/d132356cc361abef2d90d4073438f3ab759d5964

Comment 3 Imre Jonk 2021-11-11 08:49:19 UTC
Thanks for the reply! It's good to hear that this has been picked up and is being worked on. Hopefully we see a fix in the package repositories soon.

Comment 5 xiachen 2021-11-30 01:57:36 UTC
*** Bug 2027534 has been marked as a duplicate of this bug. ***

Comment 15 Imre Jonk 2022-03-03 15:24:07 UTC
I noticed that this issue has been addressed in 21.1-7.el8_5.2:

2021-12-06 Jon Maloy <jmaloy> - 21.1-7.el8_5.2

    - ci-fix-error-on-upgrade-caused-by-new-vendordata2-attri.patch [bz#2028738]
    - Resolves: bz#2028738
    (cloud-init.service fails to start after package update [rhel-8.5.0.z])

I just tried updating a RHEL 8.3 Azure VM to RHEL 8.5. The cloud-init service restarted successfully. Thanks for the fix, I consider this issue closed.

Comment 16 Yaju Cao 2022-03-04 00:52:56 UTC
(In reply to Imre Jonk from comment #15)
> I noticed that this issue has been addressed in 21.1-7.el8_5.2:
> 
> 2021-12-06 Jon Maloy <jmaloy> - 21.1-7.el8_5.2
> 
>     - ci-fix-error-on-upgrade-caused-by-new-vendordata2-attri.patch
> [bz#2028738]
>     - Resolves: bz#2028738
>     (cloud-init.service fails to start after package update [rhel-8.5.0.z])
> 
> I just tried updating a RHEL 8.3 Azure VM to RHEL 8.5. The cloud-init
> service restarted successfully. Thanks for the fix, I consider this issue
> closed.

Hi Imre, thanks a lot for reporting this issue! Yes, its 8.5 z-stream bz#2028738 fix has been released, this bz is for 8.6, it will close when 8.6 release.

Comment 18 errata-xmlrpc 2022-05-10 13:35:26 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (cloud-init bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:1776