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-init/ds-identify.log
...
ISO9660_DEVS=
...
No ds found [mode=search, notfound=disabled]. Disabled cloud-init [1]
[up 1.20s] returning 1
root@ubuntu:~# /usr/lib/cloud-init/ds-identify --force
[up 200.71s] ds-identify --force
...
ISO9660_DEVS=/dev/sr0=cidata
...
Found single datasource: NoCloud
[up 200.79s] returning 0
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.
The generator appears to be what is adding the "wants" of cloud-init.target to multi-user.target
from /lib/systemd/system-generators/cloud-init-generator:
local target_name="multi-user.target" gen_d="$early_d"
local link_path="$gen_d/${target_name}.wants/${CLOUD_TARGET_NAME}"
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:/etc/systemd/system# cat /run/cloud-init/cloud-init-generator.log
/lib/systemd/system-generators/cloud-init-generator normal=/run/systemd/generator early=/run/systemd/generator.early late=/run/systemd/generator.late
kernel command line (/proc/cmdline): BOOT_IMAGE=/boot/vmlinuz-4.15.0-154-generic root=LABEL=cloudimg-rootfs ro console=tty1 console=ttyS0
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/generator.early/multi-user.target.wants/cloud-init.target -> /lib/systemd/system/cloud-init.target
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@dev-disk-by\x2dlabel-cloudimg\x2drootfs.target loaded inactive dead >
blockdev@dev-disk-by\x2dlabel-UEFI.target loaded inactive dead >
<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-config.target loaded inactive dead >
cloud-init.target loaded inactive dead >
root@ubuntu:~# systemctl list-unit-files
...
cloud-config.service enabled enabled
cloud-final.service enabled enabled
cloud-init-local.service enabled enabled
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-config.service
● ├─cloud-final.service
● ├─cloud-init-local.service
● └─cloud-init.service
root@ubuntu:~# cat /run/cloud-init/cloud-init-generator.log
/usr/lib/systemd/system-generators/cloud-init-generator normal=/run/systemd/generator early=/run/systemd/generator.early late=/run/systemd/generator.late
kernel command line (/proc/cmdline): BOOT_IMAGE=/boot/vmlinuz-5.4.0-1045-kvm root=PARTUUID=14530a28-f129-4b51-a64e-c64075fae7c7 ro console=tty1 console=ttyS0 panic=-1
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/generator.early/multi-user.target.wants/cloud-init.target]
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- init/ds- identify. log cloud-init/ ds-identify --force DEVS=/dev/ sr0=cidata
...
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:/ /cloud- images. ubuntu. com/bionic/ current/ bionic- server- cloudimg- amd64.img as of Aug 22, 2021 in KVM (created with virt-install and libvirt) along with cloud-config ISO
$ 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:/ /cloud- images. ubuntu. com/bionic/ current/ bionic- server- cloudimg- amd64.img)
I am curious why 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:/ /cloudinit. readthedocs. io/en/latest/ topics/ boot.html
The generator appears to be what is adding the "wants" of cloud-init.target to multi-user.target system- generators/ cloud-init- generator: name="multi- user.target" gen_d="$early_d" "$gen_d/ ${target_ name}.wants/ ${CLOUD_ TARGET_ NAME}"
from /lib/systemd/
local target_
local link_path=
Bionic: /etc/systemd/ system# cat /run/cloud- init/cloud- init-generator. log system- generators/ cloud-init- generator normal= /run/systemd/ generator early=/ run/systemd/ generator. early late=/run/ systemd/ generator. late /boot/vmlinuz- 4.15.0- 154-generic root=LABEL= cloudimg- rootfs ro console=tty1 console=ttyS0 generator. early/multi- user.target. wants/cloud- init.target -> /lib/systemd/ system/ cloud-init. target
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: dev-disk- by\x2dlabel- cloudimg\ x2drootfs. target loaded inactive dead > dev-disk- by\x2dlabel- UEFI.target loaded inactive dead > config. target loaded inactive dead > service enabled enabled local.service enabled enabled config. service final.service init-local. service init.service
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- init/cloud- init-generator. log systemd/ system- generators/ cloud-init- generator normal= /run/systemd/ generator early=/ run/systemd/ generator. early late=/run/ systemd/ generator. late /boot/vmlinuz- 5.4.0-1045- kvm root=PARTUUID= 14530a28- f129-4b51- a64e-c64075fae7 c7 ro console=tty1 console=ttyS0 panic=-1 generator. early/multi- user.target. wants/cloud- init.target]
/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: /bugzilla. redhat. com/show_ bug.cgi? id=1820540
Possibly same issue https:/