sr0 not available at generator timeframe causes cloud-init.target not run
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-images |
Incomplete
|
Undecided
|
Unassigned | ||
cloud-init |
Expired
|
Undecided
|
Unassigned |
Bug Description
Focal image cloud-init generator reports:
'cloud-init is enabled but no datasource found, disabling'
looks to be related to ds-identify not finding the cdrom drive (and caching it) on first run. Not sure why /dev/sr0 would not be available early enough.
cat /run/cloud-
...
ISO9660_DEVS=
...
No ds found [mode=search, notfound=disabled]. Disabled cloud-init [1]
[up 1.20s] returning 1
root@ubuntu:~# /usr/lib/
[up 200.71s] ds-identify --force
...
ISO9660_
...
Found single datasource: NoCloud
[up 200.79s] returning 0
Booting https:/
$ cat /tmp/cloud
#cloud-config
hostname: proxy1
$ cloud-localds /tmp/test.iso /tmp/cloud
cloud-init.target never reached and network doesn't come up (default behavior for cloud-init is eth0 DHCP). If I manually start `systemctl start cloud-init.target` then I get what I expected, but by then it is "too late" and I also have to kick systemd-networkd.
cloud-init starts up as expected with the same environment when using Bionic (https:/
The focal image never touches cloud-init.target. Note that there is no reverse dependency in focal.
root@ubuntu:~# systemctl list-dependencies --reverse cloud-init.target
cloud-init.target
Both images have default target of "graphical.target"
There is mention of a "generator" and "detection" in the cloud-init docs. https:/
The generator appears to be what is adding the "wants" of cloud-init.target to multi-user.target
from /lib/systemd/
local target_
local link_path=
Bionic:
root@proxy1:~# systemctl get-default
graphical.target
root@proxy1:~#
UNIT LOAD ACTIVE SUB DESCRIPTION
basic.target loaded active active Basic System
cloud-config.target loaded active active Cloud-config availability
cloud-init.target loaded active active Cloud-init target
...
root@proxy1:~# systemctl list-dependencies --reverse cloud-init.target
cloud-init.target
● └─multi-user.target
● └─graphical.target
root@proxy1:
/lib/systemd/
kernel command line (/proc/cmdline): BOOT_IMAGE=
kernel_cmdline found unset
etc_file found unset
default found enabled
checking for datasource
ds-identify rc=0
ds-identify _RET=found
enabled via /run/systemd/
Focal:
root@ubuntu:~# systemctl get-default
graphical.target
root@ubuntu:~# systemctl list-units --type=target --all
UNIT LOAD ACTIVE SUB >
basic.target loaded active activ>
blockdev@
blockdev@
<email address hidden> loaded inactive dead >
<email address hidden> loaded inactive dead >
<email address hidden> loaded inactive dead >
<email address hidden> loaded inactive dead >
cloud-
cloud-init.target loaded inactive dead >
root@ubuntu:~# systemctl list-unit-files
...
cloud-config.
cloud-final.service enabled enabled
cloud-init-
cloud-init.service enabled enabled
...
root@ubuntu:~# systemctl list-dependencies --reverse cloud-init.target
cloud-init.target
root@ubuntu:~# systemctl list-dependencies cloud-init.target
cloud-init.target
● ├─cloud-
● ├─cloud-
● ├─cloud-
● └─cloud-
root@ubuntu:~# cat /run/cloud-
/usr/lib/
kernel command line (/proc/cmdline): BOOT_IMAGE=
kernel_cmdline found unset
etc_file found unset
default found enabled
checking for datasource
ds-identify rc=1
ds-identify _RET=notfound
cloud-init is enabled but no datasource found, disabling
already disabled: no change needed [no /run/systemd/
Additional Resources:
Possibly same issue https:/
description: | updated |
Changed in cloud-images: | |
status: | New → Incomplete |
Changed in cloud-init: | |
status: | New → Incomplete |
Changed in cloud-images: | |
status: | Expired → Incomplete |
Changed in cloud-init: | |
status: | Expired → Incomplete |
Could you provide exact reproduction steps with virt-install and libvirt. I am attempting to reproduce locally with setups we normally use for testing, and am unable to:
1. downloaded image from https:/ /cloud- images. ubuntu. com/focal/ current/ focal-server- cloudimg- amd64-disk- kvm.img
2. created a simple cloud-init yaml file:
#cloud-config
password: <INSERT PASSWORD HERE>
chpasswd: { expire: False }
ssh_pwauth: True
ssh_import_id: jchittum
sudo: ALL=(ALL) NOPASSWD:ALL
3. using `cloud-localds` from `cloud- image-utils` , made an ISO of the cloud-config with_pass. iso cloud-init.yaml
cloud-localds cloud_init_
3. used qemu to test the image:
qemu-system-x86_64 \ type=user, hostfwd= tcp::2222- :22 \ net-pci, netdev= net00 \ format= qcow2,file= focal-server- cloudimg- amd64-disk- kvm.img \ format= raw,file= cloud_init_ with_pass. iso
-cpu host -machine type=q35,accel=kvm -m 2048 \
-nographic \
-snapshot \
-netdev id=net00,
-device virtio-
-drive if=virtio,
-drive if=virtio,
This qemu command sets the accel to kvm, and i had no issues. I'm guessing that the drive setup is very different though.
From my working knowledge of libvirt and cloud-init, you do need to mount the cloud-init image in a specific place, and I don't think there would be an issue, generally, with the kvm image not getting sr0 up fast enough. `qemu` is mounting to the same place in that command.
Could you provide the libvirt XML definition and exact reproduction steps for us to dig a little deeper?