unable to provide autoinstall user-data to jammy-server-live-amd64.iso daily images with cloud-init 23.3.1

Bug #2038375 reported by Chad Smith
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init (Ubuntu)
Triaged
Medium
Unassigned
subiquity (Ubuntu)
Fix Committed
Undecided
Unassigned

Bug Description

During manual SRU verification of cloud-init 23.3.1 from jammy-proposed subiquity is unable to read cloud-init user-data containing autoinstall directives due to a traceback while trying to invoke stages.Init() prior to reading cloud-init combined user-data.

### From /var/log/installer/subiquity-server-debug.log
2023-10-03 17:00:49,502 INFO subiquity:163 Starting Subiquity server revision 5097 of snap /snap/subiquity/5097
...
2023-10-03 17:00:53,165 WARNING cloudinit.sources:1727 Failed loading pickled blob from /var/lib/cloud/instance/obj.pkl
2023-10-03 17:00:53,166 DEBUG cloudinit.sources:1736 Failed loading pickled blob from /var/lib/cloud/instance/obj.pkl
Traceback (most recent call last):
  File "/snap/subiquity/5097/usr/lib/python3/dist-packages/cloudinit/sources/__init__.py", line 1170, in pkl_load
    return pickle.loads(pickle_contents)
AttributeError: Can't get attribute 'Udhcpc' on <module 'cloudinit.net.dhcp' from '/snap/subiquity/5097/usr/lib/python3/dist-packages/cloudinit/net/dhcp.py'>

This traceback is due to unpickling errors due to an older version of cloud-init (23.2.2) installed in the snap being unable to unpickle the cached datasource written by the host version of cloud-init (23.3.1) at /var/lib/cloud/isntance/obj.pkl.

Because the subiquity snap updates cloud-init at a different pace than SRU's of cloud-init into jammy-updates, this issue will show up anytime cloud-init SRU's an update to classes or attributes related to the cached datasource object.

To avoid this unpickling incompatibility, subiquity already landed an upstream fix[1] to avoid using stages.Init() in favor of reading cloud-init's processed config artifact at /run/cloud-init/combined-cloud-config.json to get any `autoinstall` configuration.

This upstream release is not yet in the stable version of the subiquity snap #5097. And a release is expected in a couple of weeks that will contain this fix.

### References:
1: upstream fix to prefer /run/cloud-init/combined-cloud-config.json over stages.Init()
    https://github.com/canonical/subiquity/commit/751119866

### Reproducer steps:
## to be updated

wget https://cdimage.ubuntu.com/ubuntu-server/jammy/daily-live/current/jammy-live-server-amd64.iso

pull-lp-debs cloud-init jammy-proposed
# inject cloud-init from jammy-proposed
cat > proposed-actions.yaml <<EOF
- name: setup-rootfs
- name: cp
  source: /home/csmith/src/subiquity/cloud-init_23.3.1-0ubuntu1~22.04.1_all.deb
  dest: rootfs/cloud-init_23.3.1-0ubuntu1~22.04.1_all.deb
- name: shell
EOF

git clone <email address hidden>:mwhudson/livefs-editor.git
sudo PYTHONPATH=./livefs-editor python3 -m livefs_edit ./ubuntu-22.04.3-live-server-amd64.iso ./proposed-jammy-server.iso --actions proposed-actions.yaml

# At the /tmp prompt
chroot rootfs
dpkg -i /cloud-init*deb
exit
exit

mkdir -p ~/cidata
cd ~/cidata
cat > user-data << 'EOF'
#cloud-config
autoinstall:
  version: 1
  identity:
    hostname: ubuntu-server
    password: "$6$exDY1mhS4KUYCE/2$zmn9ToZwTKLhCw.b4/b.ZRTIZM30JZ4QrOQ2aOXJ8yk96xpcCof0kxKwuX1kqLG/ygbJ1f8wxED22bTL4F46P0"
    username: ubuntu
EOF
touch meta-data
cloud-localds ~/seed.iso user-data meta-data
truncate -s 10G image.img

$ kvm -name ci-test-kvm-live-server-ephemeral-1 -m 3G -drive file=image.img,format=raw,if=virtio -net nic -D qemu.log -net user,hostfwd=tcp::2222-:22 -cdrom ./proposed-jammy-server.iso -drive file=~/seed.iso,format=raw,if=ide -kernel /tmp/tmp1gro8vnk/vmlinuz -initrd /tmp/tmp1gro8vnk/initrd -append console=ttyS0 autoinstall -nographic

Chad Smith (chad.smith)
summary: - nable to provide autoinstall user-data to jammy-server-live-amd64.iso
+ unable to provide autoinstall user-data to jammy-server-live-amd64.iso
daily images with cloud-init 23.3.1
Chad Smith (chad.smith)
description: updated
description: updated
description: updated
Chad Smith (chad.smith)
Changed in cloud-init (Ubuntu):
status: New → Triaged
importance: Undecided → Medium
description: updated
description: updated
Dan Bungert (dbungert)
description: updated
Revision history for this message
Dan Bungert (dbungert) wrote :

I can confirm with Chad's steps that Subiquity will fail to see the autoinstall.
Some telltale symptoms of this are:
1. the Subiquity TUI is showing the first screen instead of carrying out the autoinstall steps
2. the following log statement in /var/log/installer/subiquity-server-debug.log
`load_autoinstall_config only_early True file None`
3. the specific error for this issue, also in subiquity-server-debug.log
`Failed loading pickled blob from /var/lib/cloud/instance/obj.pkl`

To apply the fix, for now please run
sudo snap refresh --beta subiquity

After the refresh is complete, the Subiquity TUI should change to show the progress of the autoinstall. Log statements for that will look like:
```
Loaded cloud config from /run/cloud-init/combined-cloud-config.json
autoinstall found in cloud-config
load_autoinstall_config only_early True file /autoinstall.yaml
```

I suggest not holding cloud-init SRU, as the fix for this issue will be released on or around October-12th.

Changed in subiquity (Ubuntu):
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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