Issue with Debian12 cloud image and cloud-init
by c0wb0y from LinuxQuestions.org on (#6M79S)
Setup:
Debian12-genericcloud image
Cloud-init v. 22.4.2
NoCloud
plain QEMU
datasources are served by local http as per below
Code:[root@san debian]# cat user-data
#cloud-config
users:
- default
lock_passwd: False
chpasswd:
list: |
debian:debian
sudo: ALL=(ALL) NOPASSWD:ALL
ssh_pwauth: True
ssh_authorized_keys:
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIG8JIiIwM2xBTKBimkBV86A11+JQhU+vgXLF32FXHKwA user@alma-xen.internal.lab.net
[root@san debian]#
[root@san debian]# cat meta-data
instance-id: debian-cloud
local-hostname: debian-cloud
So I have setup few distros that utilise NoCloud cloud-init to set things such as default user activation upon first boot. Nothing fancy.
Distros such as Ubuntu 23.04 and 24.x, Alpine and Fedora 39 worked as expected.
Debian12-genericcloud (and openSUSE-15.5 )on the other hand had trouble activating default user 'debian'. Checking the logs, it appears it had trouble running the module ssh-authkey-fingerprints
I can understand that openSUSE might have this issue because its cloud-init version is quite ancient, but debian's pretty recent.
Code:2024-04-20 00:32:21,125 - modules.py[DEBUG]: Running module ssh-authkey-fingerprints (<module 'cloudinit.config.cc_ssh_authkey_fingerprints' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_ssh_authkey_fingerprints.py'>) with frequency once-per-instance
2024-04-20 00:32:21,125 - handlers.py[DEBUG]: start: modules-final/config-ssh-authkey-fingerprints: running config-ssh-authkey-fingerprints with frequency once-per-instance
2024-04-20 00:32:21,125 - util.py[DEBUG]: Writing to /var/lib/cloud/instances/iid-datasource-none/sem/config_ssh_authkey_fingerprints - wb: [644] 24 bytes
2024-04-20 00:32:21,125 - helpers.py[DEBUG]: Running config-ssh-authkey-fingerprints using lock (<FileLock using file '/var/lib/cloud/instances/iid-datasource-none/sem/config_ssh_authkey_fingerprints'>)
2024-04-20 00:32:21,126 - handlers.py[DEBUG]: finish: modules-final/config-ssh-authkey-fingerprints: FAIL: running config-ssh-authkey-fingerprints with frequency once-per-instance
2024-04-20 00:32:21,126 - util.py[WARNING]: Running module ssh-authkey-fingerprints (<module 'cloudinit.config.cc_ssh_authkey_fingerprints' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_ssh_authkey_fingerprints.py'>) failed
2024-04-20 00:32:21,127 - util.py[DEBUG]: Running module ssh-authkey-fingerprints (<module 'cloudinit.config.cc_ssh_authkey_fingerprints' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_ssh_authkey_fingerprints.py'>) failed
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/cloudinit/config/modules.py", line 246, in _run_modules
ran, _r = cc.run(
^^^^^^^
File "/usr/lib/python3/dist-packages/cloudinit/cloud.py", line 67, in run
return self._runners.run(name, functor, args, freq, clear_on_fail)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/cloudinit/helpers.py", line 185, in run
results = functor(*args)
^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/cloudinit/config/cc_ssh_authkey_fingerprints.py", line 139, in handle
(key_fn, key_entries) = ssh_util.extract_authorized_keys(user_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/cloudinit/ssh_util.py", line 408, in extract_authorized_keys
(ssh_dir, pw_ent) = users_ssh_info(username)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/cloudinit/ssh_util.py", line 232, in users_ssh_info
pw_ent = pwd.getpwnam(username)
^^^^^^^^^^^^^^^^^^^^^^
KeyError: "getpwnam(): name not found: 'debian'"
2024-04-20 00:32:21,150 - modules.py[DEBUG]: Running module keys-to-console (<module 'cloudinit.config.cc_keys_to_console' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_keys_to_console.py'>) with frequency once-per-instance
2024-04-20 00:32:21,150 - handlers.py[DEBUG]: start: modules-final/config-keys-to-console: running config-keys-to-console with frequency once-per-instance
2024-04-20 00:32:21,151 - util.py[DEBUG]: Writing to /var/lib/cloud/instances/iid-datasource-none/sem/config_keys_to_console - wb: [644] 24 bytes
2024-04-20 00:32:21,152 - helpers.py[DEBUG]: Running config-keys-to-console using lock (<FileLock using file '/var/lib/cloud/instances/iid-datasource-none/sem/config_keys_to_console'>)
2024-04-20 00:32:21,152 - subp.py[DEBUG]: Running command ['/usr/lib/cloud-init/write-ssh-key-fingerprints', '', 'ssh-dss'] with allowed return codes [0] (shell=False, capture=True)
2024-04-20 00:32:21,157 - handlers.py[DEBUG]: finish: modules-final/config-keys-to-console: SUCCESS: config-keys-to-console ran successfully
2024-04-20 00:32:21,157 - modules.py[DEBUG]: Running module install-hotplug (<module 'cloudinit.config.cc_install_hotplug' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_install_hotplug.py'>) with frequency once-per-instance
2024-04-20 00:32:21,157 - handlers.py[DEBUG]: start: modules-final/config-install-hotplug: running config-install-hotplug with frequency once-per-instance
2024-04-20 00:32:21,158 - util.py[DEBUG]: Writing to /var/lib/cloud/instances/iid-datasource-none/sem/config_install_hotplug - wb: [644] 24 bytes
2024-04-20 00:32:21,159 - helpers.py[DEBUG]: Running config-install-hotplug using lock (<FileLock using file '/var/lib/cloud/instances/iid-datasource-none/sem/config_install_hotplug'>)
2024-04-20 00:32:21,161 - stages.py[DEBUG]: Allowed events: {<EventScope.NETWORK: 'network'>: {<EventType.BOOT_NEW_INSTANCE: 'boot-new-instance'>}}
2024-04-20 00:32:21,162 - stages.py[DEBUG]: Event Denied: scopes=['network'] EventType=hotplug
2024-04-20 00:32:21,163 - cc_install_hotplug.py[DEBUG]: Skipping hotplug install, not enabled
2024-04-20 00:32:21,163 - handlers.py[DEBUG]: finish: modules-final/config-install-hotplug: SUCCESS: config-install-hotplug ran successfully
2024-04-20 00:32:21,164 - modules.py[DEBUG]: Running module final-message (<module 'cloudinit.config.cc_final_message' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_final_message.py'>) with frequency always
2024-04-20 00:32:21,164 - handlers.py[DEBUG]: start: modules-final/config-final-message: running config-final-message with frequency always
2024-04-20 00:32:21,164 - helpers.py[DEBUG]: Running config-final-message using lock (<cloudinit.helpers.DummyLock object at 0x7f32f4ab3010>)
2024-04-20 00:32:21,164 - util.py[DEBUG]: Reading from /proc/uptime (quiet=False)
2024-04-20 00:32:21,165 - util.py[DEBUG]: Read 12 bytes from /proc/uptime
2024-04-20 00:32:21,176 - util.py[DEBUG]: Cloud-init v. 22.4.2 finished at Sat, 20 Apr 2024 00:32:21 +0000. Datasource DataSourceNone. Up 16.66 seconds
2024-04-20 00:32:21,176 - util.py[DEBUG]: Writing to /var/lib/cloud/instance/boot-finished - wb: [644] 52 bytes
2024-04-20 00:32:21,177 - util.py[WARNING]: Failed to write boot finished file /var/lib/cloud/instance/boot-finished
2024-04-20 00:32:21,177 - util.py[DEBUG]: Failed to write boot finished file /var/lib/cloud/instance/boot-finished
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/cloudinit/config/cc_final_message.py", line 106, in handle
util.write_file(boot_fin_fn, contents, ensure_dir_exists=False)
File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 2172, in write_file
with open(filename, omode) as fh:
^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/var/lib/cloud/instance/boot-finished'
2024-04-20 00:32:21,202 - cc_final_message.py[WARNING]: Used fallback datasource
2024-04-20 00:32:21,203 - handlers.py[DEBUG]: finish: modules-final/config-final-message: SUCCESS: config-final-message ran successfully
2024-04-20 00:32:21,203 - main.py[DEBUG]: Ran 12 modules with 1 failures
2024-04-20 00:32:21,205 - atomic_helper.py[DEBUG]: Atomically writing to file /var/lib/cloud/data/status.json (via temporary file /var/lib/cloud/data/tmpbwlugrgq) - w: [644] 647 bytes/chars
2024-04-20 00:32:21,211 - atomic_helper.py[DEBUG]: Atomically writing to file /var/lib/cloud/data/result.json (via temporary file /var/lib/cloud/data/tmpj3sadadd) - w: [644] 142 bytes/chars
2024-04-20 00:32:21,212 - util.py[DEBUG]: Creating symbolic link from '/run/cloud-init/result.json' => '../../var/lib/cloud/data/result.json'
2024-04-20 00:32:21,212 - util.py[DEBUG]: Reading from /proc/uptime (quiet=False)
2024-04-20 00:32:21,212 - util.py[DEBUG]: Read 12 bytes from /proc/uptime
2024-04-20 00:32:21,212 - util.py[DEBUG]: cloud-init mode 'modules' took 0.254 seconds (0.26)
2024-04-20 00:32:21,213 - handlers.py[DEBUG]: finish: modules-final: FAIL: running modules for finalDoes anyone here encountered similar issue?
Debian12-genericcloud image
Cloud-init v. 22.4.2
NoCloud
plain QEMU
datasources are served by local http as per below
Code:[root@san debian]# cat user-data
#cloud-config
users:
- default
lock_passwd: False
chpasswd:
list: |
debian:debian
sudo: ALL=(ALL) NOPASSWD:ALL
ssh_pwauth: True
ssh_authorized_keys:
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIG8JIiIwM2xBTKBimkBV86A11+JQhU+vgXLF32FXHKwA user@alma-xen.internal.lab.net
[root@san debian]#
[root@san debian]# cat meta-data
instance-id: debian-cloud
local-hostname: debian-cloud
So I have setup few distros that utilise NoCloud cloud-init to set things such as default user activation upon first boot. Nothing fancy.
Distros such as Ubuntu 23.04 and 24.x, Alpine and Fedora 39 worked as expected.
Debian12-genericcloud (and openSUSE-15.5 )on the other hand had trouble activating default user 'debian'. Checking the logs, it appears it had trouble running the module ssh-authkey-fingerprints
I can understand that openSUSE might have this issue because its cloud-init version is quite ancient, but debian's pretty recent.
Code:2024-04-20 00:32:21,125 - modules.py[DEBUG]: Running module ssh-authkey-fingerprints (<module 'cloudinit.config.cc_ssh_authkey_fingerprints' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_ssh_authkey_fingerprints.py'>) with frequency once-per-instance
2024-04-20 00:32:21,125 - handlers.py[DEBUG]: start: modules-final/config-ssh-authkey-fingerprints: running config-ssh-authkey-fingerprints with frequency once-per-instance
2024-04-20 00:32:21,125 - util.py[DEBUG]: Writing to /var/lib/cloud/instances/iid-datasource-none/sem/config_ssh_authkey_fingerprints - wb: [644] 24 bytes
2024-04-20 00:32:21,125 - helpers.py[DEBUG]: Running config-ssh-authkey-fingerprints using lock (<FileLock using file '/var/lib/cloud/instances/iid-datasource-none/sem/config_ssh_authkey_fingerprints'>)
2024-04-20 00:32:21,126 - handlers.py[DEBUG]: finish: modules-final/config-ssh-authkey-fingerprints: FAIL: running config-ssh-authkey-fingerprints with frequency once-per-instance
2024-04-20 00:32:21,126 - util.py[WARNING]: Running module ssh-authkey-fingerprints (<module 'cloudinit.config.cc_ssh_authkey_fingerprints' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_ssh_authkey_fingerprints.py'>) failed
2024-04-20 00:32:21,127 - util.py[DEBUG]: Running module ssh-authkey-fingerprints (<module 'cloudinit.config.cc_ssh_authkey_fingerprints' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_ssh_authkey_fingerprints.py'>) failed
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/cloudinit/config/modules.py", line 246, in _run_modules
ran, _r = cc.run(
^^^^^^^
File "/usr/lib/python3/dist-packages/cloudinit/cloud.py", line 67, in run
return self._runners.run(name, functor, args, freq, clear_on_fail)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/cloudinit/helpers.py", line 185, in run
results = functor(*args)
^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/cloudinit/config/cc_ssh_authkey_fingerprints.py", line 139, in handle
(key_fn, key_entries) = ssh_util.extract_authorized_keys(user_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/cloudinit/ssh_util.py", line 408, in extract_authorized_keys
(ssh_dir, pw_ent) = users_ssh_info(username)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/cloudinit/ssh_util.py", line 232, in users_ssh_info
pw_ent = pwd.getpwnam(username)
^^^^^^^^^^^^^^^^^^^^^^
KeyError: "getpwnam(): name not found: 'debian'"
2024-04-20 00:32:21,150 - modules.py[DEBUG]: Running module keys-to-console (<module 'cloudinit.config.cc_keys_to_console' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_keys_to_console.py'>) with frequency once-per-instance
2024-04-20 00:32:21,150 - handlers.py[DEBUG]: start: modules-final/config-keys-to-console: running config-keys-to-console with frequency once-per-instance
2024-04-20 00:32:21,151 - util.py[DEBUG]: Writing to /var/lib/cloud/instances/iid-datasource-none/sem/config_keys_to_console - wb: [644] 24 bytes
2024-04-20 00:32:21,152 - helpers.py[DEBUG]: Running config-keys-to-console using lock (<FileLock using file '/var/lib/cloud/instances/iid-datasource-none/sem/config_keys_to_console'>)
2024-04-20 00:32:21,152 - subp.py[DEBUG]: Running command ['/usr/lib/cloud-init/write-ssh-key-fingerprints', '', 'ssh-dss'] with allowed return codes [0] (shell=False, capture=True)
2024-04-20 00:32:21,157 - handlers.py[DEBUG]: finish: modules-final/config-keys-to-console: SUCCESS: config-keys-to-console ran successfully
2024-04-20 00:32:21,157 - modules.py[DEBUG]: Running module install-hotplug (<module 'cloudinit.config.cc_install_hotplug' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_install_hotplug.py'>) with frequency once-per-instance
2024-04-20 00:32:21,157 - handlers.py[DEBUG]: start: modules-final/config-install-hotplug: running config-install-hotplug with frequency once-per-instance
2024-04-20 00:32:21,158 - util.py[DEBUG]: Writing to /var/lib/cloud/instances/iid-datasource-none/sem/config_install_hotplug - wb: [644] 24 bytes
2024-04-20 00:32:21,159 - helpers.py[DEBUG]: Running config-install-hotplug using lock (<FileLock using file '/var/lib/cloud/instances/iid-datasource-none/sem/config_install_hotplug'>)
2024-04-20 00:32:21,161 - stages.py[DEBUG]: Allowed events: {<EventScope.NETWORK: 'network'>: {<EventType.BOOT_NEW_INSTANCE: 'boot-new-instance'>}}
2024-04-20 00:32:21,162 - stages.py[DEBUG]: Event Denied: scopes=['network'] EventType=hotplug
2024-04-20 00:32:21,163 - cc_install_hotplug.py[DEBUG]: Skipping hotplug install, not enabled
2024-04-20 00:32:21,163 - handlers.py[DEBUG]: finish: modules-final/config-install-hotplug: SUCCESS: config-install-hotplug ran successfully
2024-04-20 00:32:21,164 - modules.py[DEBUG]: Running module final-message (<module 'cloudinit.config.cc_final_message' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_final_message.py'>) with frequency always
2024-04-20 00:32:21,164 - handlers.py[DEBUG]: start: modules-final/config-final-message: running config-final-message with frequency always
2024-04-20 00:32:21,164 - helpers.py[DEBUG]: Running config-final-message using lock (<cloudinit.helpers.DummyLock object at 0x7f32f4ab3010>)
2024-04-20 00:32:21,164 - util.py[DEBUG]: Reading from /proc/uptime (quiet=False)
2024-04-20 00:32:21,165 - util.py[DEBUG]: Read 12 bytes from /proc/uptime
2024-04-20 00:32:21,176 - util.py[DEBUG]: Cloud-init v. 22.4.2 finished at Sat, 20 Apr 2024 00:32:21 +0000. Datasource DataSourceNone. Up 16.66 seconds
2024-04-20 00:32:21,176 - util.py[DEBUG]: Writing to /var/lib/cloud/instance/boot-finished - wb: [644] 52 bytes
2024-04-20 00:32:21,177 - util.py[WARNING]: Failed to write boot finished file /var/lib/cloud/instance/boot-finished
2024-04-20 00:32:21,177 - util.py[DEBUG]: Failed to write boot finished file /var/lib/cloud/instance/boot-finished
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/cloudinit/config/cc_final_message.py", line 106, in handle
util.write_file(boot_fin_fn, contents, ensure_dir_exists=False)
File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 2172, in write_file
with open(filename, omode) as fh:
^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/var/lib/cloud/instance/boot-finished'
2024-04-20 00:32:21,202 - cc_final_message.py[WARNING]: Used fallback datasource
2024-04-20 00:32:21,203 - handlers.py[DEBUG]: finish: modules-final/config-final-message: SUCCESS: config-final-message ran successfully
2024-04-20 00:32:21,203 - main.py[DEBUG]: Ran 12 modules with 1 failures
2024-04-20 00:32:21,205 - atomic_helper.py[DEBUG]: Atomically writing to file /var/lib/cloud/data/status.json (via temporary file /var/lib/cloud/data/tmpbwlugrgq) - w: [644] 647 bytes/chars
2024-04-20 00:32:21,211 - atomic_helper.py[DEBUG]: Atomically writing to file /var/lib/cloud/data/result.json (via temporary file /var/lib/cloud/data/tmpj3sadadd) - w: [644] 142 bytes/chars
2024-04-20 00:32:21,212 - util.py[DEBUG]: Creating symbolic link from '/run/cloud-init/result.json' => '../../var/lib/cloud/data/result.json'
2024-04-20 00:32:21,212 - util.py[DEBUG]: Reading from /proc/uptime (quiet=False)
2024-04-20 00:32:21,212 - util.py[DEBUG]: Read 12 bytes from /proc/uptime
2024-04-20 00:32:21,212 - util.py[DEBUG]: cloud-init mode 'modules' took 0.254 seconds (0.26)
2024-04-20 00:32:21,213 - handlers.py[DEBUG]: finish: modules-final: FAIL: running modules for finalDoes anyone here encountered similar issue?