LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud
User Name
Password
Linux - Virtualization and Cloud This forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.

Notices


Reply
  Search this Thread
Old 04-19-2024, 10:20 PM   #1
c0wb0y
Member
 
Registered: Jan 2012
Location: Inside the oven
Distribution: Windows
Posts: 421

Rep: Reputation: 74
Issue with Debian12 cloud image and cloud-init


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 final
Does anyone here encountered similar issue?
 
Old 04-20-2024, 07:30 AM   #2
blunix2
LQ Newbie
 
Registered: Apr 2024
Posts: 12

Rep: Reputation: 1
I think the cloud-init is trying to modify something for the "debian" user (https://www.man7.org/linux/man-pages...etpwnam.3.html) and fails to do that.

> (key_fn, key_entries) = ssh_util.extract_authorized_keys(user_name)

I guess here its trying to setup authorized_keys for the debian user

> (ssh_dir, pw_ent) = users_ssh_info(username)

Here it fails to do "things with the ssh dir"

> File "/usr/lib/python3/dist-packages/cloudinit/ssh_util.py", line 232, in users_ssh_info

Here it fails to run pwnam on the "debian" user.

Can you share which cloud provider you are using and exactly which image you are creating?
 
Old 04-20-2024, 04:37 PM   #3
c0wb0y
Member
 
Registered: Jan 2012
Location: Inside the oven
Distribution: Windows
Posts: 421

Original Poster
Rep: Reputation: 74
Thank you @blunix2 for the pointers.

Apparently, the issue is caused by qemu parameter for nocloud vs nocloud-net. Who would have thought? This is finally working with these parameters:

Code:
-uuid 38a6cb38-fc57-40f6-89d4-b0f8fa361012 -smbios type=1,serial=ds='nocloud-net;s=http://pxe10.internal.lab.net/cloud-init/debian/'
Recent versions of cloud-init does not need the '-net' string.

Last edited by c0wb0y; 04-20-2024 at 04:38 PM. Reason: Added more context about the recent version of cloud-init regarding the '-net' string.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bluetooth issue since Debian12 upgrade (pulseaudio/pipewire?) Herve5 Linux - Software 0 01-21-2024 07:45 PM
installing mysql on a debian12 laptop Tumpen Debian 4 11-02-2023 11:33 AM
lagging dual Boot - linuxmint / Debian12 bg368 Linux - General 2 10-02-2023 05:33 PM
LXer: Cloud 5: Has cloud killed on-prem software, the enterprise cloud wars, and cloud computing and LXer Syndicated Linux News 0 08-22-2014 11:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud

All times are GMT -5. The time now is 10:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration