After restart cloud-init reconfigured the machine hostname and ssh keypairs

Bug #1946644 reported by Nicolas Gatti
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
cloud-init
Fix Released
High
Unassigned

Bug Description

After restarting vms on azure on Oct 8 all th restarted machines where treated as if it were first boot and reconfigured with the initial values of hostname and new ssh keypairs.

Revision history for this message
Nicolas Gatti (ngatti) wrote :
  • logs Edit (6.6 MiB, application/x-tar)
James Falcon (falcojr)
Changed in cloud-init:
status: New → Confirmed
importance: Undecided → High
Revision history for this message
James Falcon (falcojr) wrote :

Cloud-init caches instance metadata to disk via pickle. Newer (since mid-2019) Azure instances have a service that removes this cache every boot. This particular instance is old enough to not have that service.

In 21.2, https://github.com/canonical/cloud-init/blob/main/cloudinit/sources/DataSourceAzure.py#L361
was added to the Azure datasource. This sort of thing normally needs
to be added to our upgrade framework so unpickling works correctly,
but since the pickle gets removed every boot by that service on new launches, we
didn't catch it in testing. Prior to 21.3, the instance was
never trying to obtain new metadata as it was configured to only fetch
it on first boot. In 21.3, Azure instances will always attempt to
fetch metadata every boot, so trying to read the new variable fails
once you upgrade to 21.3.

We'll add the new attribute to our upgrade framework so this doesn't happen in future, but to fix affected instances, you can "rm /var/lib/cloud/instance/obj.pkl".

Revision history for this message
Chad Smith (chad.smith) wrote :

Upstream commit fixing this issue has landed https://github.com/canonical/cloud-init/commit/150fd30ef81cea5c2b0aff5127e33a5db786aa09
expect release v.21.4 to contain this fix

Changed in cloud-init:
status: Confirmed → Fix Committed
Revision history for this message
James Falcon (falcojr) wrote : Fixed in cloud-init version 21.4.

This bug is believed to be fixed in cloud-init in version 21.4. If this is still a problem for you, please make a comment and set the state back to New

Thank you.

Changed in cloud-init:
status: Fix Committed → Fix Released
Revision history for this message
James Falcon (falcojr) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.