subiquity fails to see autoinstall data conveyed by cloud-init 23.2

Bug #2022102 reported by Dan Bungert
26
This bug affects 3 people
Affects Status Importance Assigned to Milestone
subiquity
Fix Released
Undecided
Dan Bungert
cloud-init (Ubuntu)
Invalid
Undecided
Chad Smith
Jammy
Invalid
Undecided
Unassigned
Mantic
Invalid
Undecided
Chad Smith
subiquity (Ubuntu)
Fix Released
Undecided
Dan Bungert
Jammy
Fix Released
Critical
Dan Bungert
Mantic
Fix Released
Undecided
Dan Bungert

Bug Description

When attempting to send autoinstall data by way of cloud-config on cloud-init v23.2, subiquity fails to retrieve this data from cloud-init.

In this case, the following can be seen in subiquity-server-debug.log:

Traceback (most recent call last):
  File "/snap/subiquity/4709/usr/lib/python3/dist-packages/cloudinit/sources/__init__.py", line 1133, in pkl_load
    return pickle.loads(pickle_contents)
AttributeError: Can't get attribute 'IscDhclient' on <module 'cloudinit.net.dhcp' from '/snap/subiquity/4709/usr/lib/python3/dist-packages/cloudinit/net/dhcp.py'>

The pickle file has been written by the host system cloud-init v23.2, whereas the older cloud-init in the snap is failing to read the data.

At the moment mantic ISOs are affected, future ISO builds such as jammy would also be affected when leading up to 22.04.3.

A proposed workaround for subiquity is to run a python script outside the snap context to retrieve the data.

Dan Bungert (dbungert)
description: updated
Revision history for this message
Chad Smith (chad.smith) wrote :

cloud-init component of this tracked in Github Issues as https://github.com/canonical/cloud-init/issues/4158

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

This bug is seen on Mantic Daily live installer images. While specifically related to differing versions of cloud-init in snap environment versus the host system in the daily live ISOs, cloud-init will surface a flat file /run/cloud-init/merged-cloud-config.json which will allow subiquity to source a flat file instead of invoking stages.Init()..fetch[1] which has to deal with unpickling any cached datasource.

This cloud-init feature work will be tracked in SC-1452

[1] https://github.com/canonical/subiquity/blob/main/subiquity/server/server.py#L549-L553

Chad Smith (chad.smith)
Changed in cloud-init (Ubuntu Mantic):
status: New → In Progress
assignee: nobody → Chad Smith (chad.smith)
status: In Progress → Invalid
Revision history for this message
Chad Smith (chad.smith) wrote :

An older cloud-init deserializing a pickled Datasource cached /var/lib/cloud/instance/obj.pkl from a newer verion of cloud-init is an unsupported use case.

That said, there is work in progress that will allow to sourcing /run/cloud-init/merged-cloud-config which will allow subiquity to consume user-data without reading from a cached pickle of instance data.

https://github.com/canonical/cloud-init/compare/main...blackboxsw:cloud-init:SC-1452-persist-run-combined-cloud-config-json. An update will be provided here when that feature has landed.

Revision history for this message
Dan Bungert (dbungert) wrote :

Did a retest today with the copy of cloud-init from ppa proposed staged in the snap (23.2.1-0ubuntu0~22.04.1). See a different variant of the same problem:

2023-06-29 17:01:35,900 DEBUG cloudinit.util:948 Attempting to load yaml from string of length 272 with allowed root types (<class 'dict'>,)
2023-06-29 17:01:35,900 DEBUG cloudinit.util:1536 Reading from /var/lib/cloud/instance/obj.pkl (quiet=False)
2023-06-29 17:01:35,900 DEBUG cloudinit.util:1547 Read 8272 bytes from /var/lib/cloud/instance/obj.pkl
2023-06-29 17:01:35,911 WARNING cloudinit.sources:1727 Failed loading pickled blob from /var/lib/cloud/instance/obj.pkl
2023-06-29 17:01:35,911 DEBUG cloudinit.sources:1736 Failed loading pickled blob from /var/lib/cloud/instance/obj.pkl
Traceback (most recent call last):
  File "/snap/subiquity/x1/usr/lib/python3/dist-packages/cloudinit/sources/__init__.py", line 1170, in pkl_load
    return pickle.loads(pickle_contents)
ModuleNotFoundError: No module named 'cloudinit.net.netops'

Thanks for the efforts on the combined-cloud-config.json.

Dan Bungert (dbungert)
Changed in subiquity:
assignee: nobody → Dan Bungert (dbungert)
status: New → In Progress
Changed in subiquity (Ubuntu Jammy):
milestone: none → ubuntu-22.04.3
Changed in cloud-init (Ubuntu Jammy):
milestone: none → ubuntu-22.04.3
Dan Bungert (dbungert)
Changed in subiquity (Ubuntu Mantic):
status: New → Fix Committed
Changed in subiquity:
status: In Progress → Fix Committed
Revision history for this message
Dan Bungert (dbungert) wrote :

Two different version of the fix are in place:

1) Mantic+ - read combined-cloud-config.json, but this requires that cloud-init 23.3 or later is present in the HOST os
2) Jammy - use the legacy method of reading autoinstall data. Requires that compatible versions of cloud-init are int the snap and in the host OS.

Changed in cloud-init (Ubuntu Jammy):
status: New → Invalid
Changed in subiquity (Ubuntu Jammy):
status: New → Fix Committed
Dan Bungert (dbungert)
Changed in cloud-init (Ubuntu Jammy):
milestone: ubuntu-22.04.3 → none
Changed in subiquity (Ubuntu Mantic):
assignee: nobody → Dan Bungert (dbungert)
Changed in subiquity (Ubuntu Jammy):
importance: Undecided → Critical
assignee: nobody → Dan Bungert (dbungert)
Revision history for this message
James Falcon (falcojr) wrote :

"2) Jammy - use the legacy method of reading autoinstall data. Requires that compatible versions of cloud-init are in the snap and in the host OS."

What exactly does this mean? Cloud-init recently had two new bugs pop up:
https://github.com/canonical/cloud-init/issues/4302
https://github.com/canonical/cloud-init/issues/4304

and they are both reproducable on https://cdimage.ubuntu.com/ubuntu-server/jammy/daily-live/20230730/ . They symptom is ds-identify related, not unpickle related, but the cause is the same: that the cloud-init version in the snap is less than the cloud-init version on the host.

Does "compatible versions of cloud-init are in the snap and in the host OS" mean the same version? If the answer is yes, is there a build somewhere that can be used to test that these bugs are truly fixed? If the answer is no, then I believe that there is still an issue here to resolve.

Revision history for this message
Dan Bungert (dbungert) wrote :

Marking this fix released for Subiquity:

* general fix: on main branch, read the combined-cloud-config to be able to get the autoinstall
* mantic: build containing above fix promoted to stable/ubuntu-23.10
* jammy: rebuilt of stable branch promoted to stable/22.04.3 (what snap refresh will look at), and stable/22.04 (what the ISO build will look at)

Changed in subiquity:
status: Fix Committed → Fix Released
Changed in subiquity (Ubuntu Jammy):
status: Fix Committed → Fix Released
Changed in subiquity (Ubuntu Mantic):
status: Fix Committed → Fix Released
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

Remote bug watches

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