Closed jbpratt closed 2 years ago
adding cloud-init logs.
Looking through the logs, I think the issues are going to be related and may be worked around easily.
2021-12-15 17:44:23,953 - util.py[DEBUG]: Running module ssh-authkey-fingerprints (<module 'cloudinit.config.cc_ssh_authkey_fingerprints' from '/usr/local/lib/python3.8/site-packages/cloud_init-21.4-py3.8.egg/cloudinit/config/cc_ssh_authkey_fingerprints.py'>) failed
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/cloud_init-21.4-py3.8.egg/cloudinit/stages.py", line 976, in _run_modules
ran, _r = cc.run(run_name, mod.handle, func_args,
File "/usr/local/lib/python3.8/site-packages/cloud_init-21.4-py3.8.egg/cloudinit/cloud.py", line 54, in run
return self._runners.run(name, functor, args, freq, clear_on_fail)
File "/usr/local/lib/python3.8/site-packages/cloud_init-21.4-py3.8.egg/cloudinit/helpers.py", line 186, in run
results = functor(*args)
File "/usr/local/lib/python3.8/site-packages/cloud_init-21.4-py3.8.egg/cloudinit/config/cc_ssh_authkey_fingerprints.py", line 107, in handle
(key_fn, key_entries) = ssh_util.extract_authorized_keys(user_name)
File "/usr/local/lib/python3.8/site-packages/cloud_init-21.4-py3.8.egg/cloudinit/ssh_util.py", line 385, in extract_authorized_keys
(ssh_dir, pw_ent) = users_ssh_info(username)
File "/usr/local/lib/python3.8/site-packages/cloud_init-21.4-py3.8.egg/cloudinit/ssh_util.py", line 226, in users_ssh_info
pw_ent = pwd.getpwnam(username)
KeyError: "getpwnam(): name not found: 'kc2user'"
2021-12-15 17:44:10,688 - util.py[DEBUG]: Applying SSH credentials failed!
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/cloud_init-21.4-py3.8.egg/cloudinit/config/cc_ssh.py", line 301, in handle
apply_credentials(keys, user, disable_root, disable_root_opts)
File "/usr/local/lib/python3.8/site-packages/cloud_init-21.4-py3.8.egg/cloudinit/config/cc_ssh.py", line 310, in apply_credentials
ssh_util.setup_user_keys(keys, user)
File "/usr/local/lib/python3.8/site-packages/cloud_init-21.4-py3.8.egg/cloudinit/ssh_util.py", line 437, in setup_user_keys
(auth_key_fn, auth_key_entries) = extract_authorized_keys(username)
File "/usr/local/lib/python3.8/site-packages/cloud_init-21.4-py3.8.egg/cloudinit/ssh_util.py", line 385, in extract_authorized_keys
(ssh_dir, pw_ent) = users_ssh_info(username)
File "/usr/local/lib/python3.8/site-packages/cloud_init-21.4-py3.8.egg/cloudinit/ssh_util.py", line 226, in users_ssh_info
pw_ent = pwd.getpwnam(username)
KeyError: "getpwnam(): name not found: 'freebsd'"
2021-12-15 17:44:09,321 - util.py[WARNING]: Failed to create user kc2user
2021-12-15 17:44:09,324 - util.py[DEBUG]: Failed to create user kc2user
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/cloud_init-21.4-py3.8.egg/cloudinit/distros/freebsd.py", line 87, in add_user
subp.subp(pw_useradd_cmd, logstring=log_pw_useradd_cmd)
File "/usr/local/lib/python3.8/site-packages/cloud_init-21.4-py3.8.egg/cloudinit/subp.py", line 293, in subp
raise ProcessExecutionError(stdout=out, stderr=err,
cloudinit.subp.ProcessExecutionError: Unexpected error while running command.
Command: ['pw', 'useradd', '-n', 'kc2user', '-G', 'sudo,wheel', '-d/usr/home/kc2user', '-m']
Exit code: 67
Reason: -
Stdout:
Stderr: pw: group `sudo' does not exist
Removing the group section allows kc2user to be created and the ssh key to be set. Currently the VM is not getting an IP address though
removing any network config works as expected now, marking this as closed.
2021-12-15 10:50:20,090 - util.py[WARNING]: Failed to create user kc2user
2021-12-15 10:50:21,507 - util.py[WARNING]: Applying SSH credentials failed!
Since the user doesn't exist, qemu-guest-agent fails to synchronize the ssh key secret as well
Error encountered writing ssh pub key access credentials for user [kc2user]: Unable to detect home directory of user kc2user: exited with error code:2
The manifest below differs from the one tested in CI slightly, it was replicated from the cloud-init-bsd-testing repo.
It also looks like the VM is not getting an IP address either.
VM described
``` ❯ k describe vmi -A Name: testvm Namespace: default Labels: kubevirt.io/nodeName=kmi-test-worker test=kmi Annotations: kubevirt.io/latest-observed-api-version: v1 kubevirt.io/storage-observed-api-version: v1alpha3 API Version: kubevirt.io/v1 Kind: VirtualMachineInstance Metadata: Creation Timestamp: 2021-12-15T10:49:26Z Finalizers: kubevirt.io/virtualMachineControllerFinalize foregroundDeleteVirtualMachine Generation: 13 Managed Fields: API Version: kubevirt.io/v1alpha3 Fields Type: FieldsV1 fieldsV1: f:metadata: f:annotations: .: f:kubevirt.io/latest-observed-api-version: f:kubevirt.io/storage-observed-api-version: f:finalizers: .: v:"kubevirt.io/virtualMachineControllerFinalize": f:labels: .: f:kubevirt.io/nodeName: f:test: f:ownerReferences: .: k:{"uid":"0f03580d-6fab-4e27-8e1a-3ff774bd495f"}: f:spec: .: f:accessCredentials: f:domain: .: f:devices: .: f:autoattachGraphicsDevice: f:autoattachPodInterface: f:autoattachSerialConsole: f:disks: f:networkInterfaceMultiqueue: f:firmware: .: f:uuid: f:machine: .: f:type: f:resources: .: f:limits: .: f:memory: f:requests: .: f:memory: f:hostname: f:nodeSelector: .: f:test: f:terminationGracePeriodSeconds: f:volumes: f:status: .: f:activePods: .: f:462bb7bc-4e72-4eae-bf8a-e13d8b5b9fba: f:conditions: f:guestOSInfo: f:interfaces: f:launcherContainerImageVersion: f:migrationMethod: f:migrationTransport: f:nodeName: f:phase: f:phaseTransitionTimestamps: f:qosClass: f:virtualMachineRevisionName: f:volumeStatus: Manager: Go-http-client Operation: Update Time: 2021-12-15T10:49:31Z Owner References: API Version: kubevirt.io/v1 Block Owner Deletion: true Controller: true Kind: VirtualMachine Name: testvm UID: 0f03580d-6fab-4e27-8e1a-3ff774bd495f Resource Version: 2304 UID: 89459ef8-1ac5-4edf-a517-f5c0ab749bc7 Spec: Access Credentials: Ssh Public Key: Propagation Method: Qemu Guest Agent: Users: kc2user Source: Secret: Secret Name: kargo-sshpubkey-kc2user Domain: Cpu: Cores: 1 Sockets: 1 Threads: 1 Devices: Autoattach Graphics Device: true Autoattach Pod Interface: true Autoattach Serial Console: true Disks: Boot Order: 1 Disk: Bus: virtio Name: containerdisk Disk: Bus: virtio Name: cloudinitdisk Interfaces: Bridge: Name: default Network Interface Multiqueue: false Features: Acpi: Enabled: true Firmware: Uuid: 5a9fc181-957e-5c32-9e5a-2de5e9673531 Machine: Type: q35 Resources: Limits: Memory: 4G Requests: Memory: 4G Hostname: testvm Networks: Name: default Pod: Node Selector: Test: kmi Termination Grace Period Seconds: 0 Volumes: Container Disk: Image: docker.io/containercraft/freebsd:13-dev Image Pull Policy: Always Name: containerdisk Cloud Init No Cloud: Network Data: version: 2 ethernets: eth0: match: mac_address: "...." dhcp4: true User Data: #cloud-config users: - default - name: kc2user sudo: ALL=(ALL) NOPASSWD:ALL groups: sudo,wheel ssh-authorized-keys: - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCqii+2B/KMkBtJOr0ku4wgbMrnuj5iVo5BmJGNzjdPmkLxQsOhZ3es0Gxb/1HJgOg1DptKPIxrMpWb1QCJf56zxUIcWKTHUIXzXY4KW0sT4bKSsE43AQQ0J2Ao3fQz8vdccWDPwpgrTaV6t1ZaFhb9sJJkzfplrBo2v0xVMSBieIpt4Znpi6HrIgXt6aqd5JpYuYv4SjYs/n+V2j62gAKKl7lt3ie+Nz50nrx9SPJ2+VrwCSQvidpGv1VY/tbG9j8VNff4fuxFl37au2TCfRYC7ANhTZjZWQOG3Yo920jziD+EY6lVv6G3GeMpVCny9lqcc+hUI+wP2Rd4Kw0RShwX1NrW7NyG+u8hjluIEubj4PWwwArMp6MQgdQKGhurOtBWBhdaFFrooiC4/DmAHUuPZAOK5vO0F1KEOUVVOz4VDsrU5Kw3X0NhBVcLDqrC9dwBMrqVBY5gnuboDb4Cq+RuW0cT9CIz2b7iwZZU8sg82O1Z2iu7qvER8TYJH4y8U2sE7OpkAfbOVqMlxW2x+O4ci6f9m8M/C7WRwGRoKvx422aaBihEJ7eQ5JXxlEwSWErbU+oXwdMRxJ6aMlWfXUCBhGfrTEa8sbyhThh9EsGvk+JV58EjfgqNqidDqSgzTh3Zfve0frj5rsS55CKK700pm8k/v/+sSl8tMC6oxGDdmw== jbpratt78@gmail.com Name: cloudinitdisk Status: Active Pods: 462bb7bc-4e72-4eae-bf8a-e13d8b5b9fba: kmi-test-worker Conditions: Last Probe Time:VM manifest file
``` cat <Serial console output attempt 1
``` - ______ ____ _____ _____ | ____| | _ \ / ____| __ \ | |___ _ __ ___ ___ | |_) | (___ | | | | | ___| '__/ _ \/ _ \| _ < \___ \| | | | | | | | | __/ __/| |_) |____) | |__| | | | | | | | || | | | |_| |_| \___|\___||____/|_____/|_____/ console efi is invalid! ` Available consoles: s` `.....---.......--.``` -/ +-----------Welcome to FreeBSDconsole efi is invalid!--` /y:` +. Available consoles: | yo`:. :o `+- 1. Boot Multi user [Enter] | y/ -/` -o/ 2. Boot Single user | .- ::/sy+:. 3. Escape to loader prompt | / `-- / 4. Rebootle | `: :` | 5. Cons: Dual (Serial primary) | `: :` | | / / | Options: | .- -. | 6. Kernel: default/kernel (1 of 1) | -- -. | 7. Boot Options | `:` `:` | | .-- `--. | | .---.....----.console efi is invalid! A+-----------------------------------------+ Autoboot in 0 seconds, hit [Enter] to boot or any other key to stop comconsole Loading kernel... /boot/kernel/kernel text=0x17b9e0 text=0xdd6d30 text=0x65b9ac data=0x140 data=0x1b9348+0x445cb8 syms=[0x8+0x178e90+0x8+0x199058] Loading configured modules... can't find '/boot/entropy' can't find '/etc/hostid' /boot/kernel/zfs.ko size 0x67feb0 at 0x2112000 ---<Serial console attempt 2
``` - ______ ____ _____ _____ | ____| | _ \ / ____| __ \ | |___ _ __ ___ ___ | |_) | (___ | | | | | ___| '__/ _ \/ _ \| _ < \___ \| | | | | | | | | __/ __/| |_) |____) | |__| | | | | | | | || | | | |_| |_| \___|\___||____/|_____/|_____/ console efi is invalid! ` Available consoles: s` `.....---.......--.``` -/ +-----------Welcome to FreeBSDconsole efi is invalid!--` /y:` +. Available consoles: | yo`:. :o `+- 1. Boot Multi user [Enter] | y/ -/` -o/ 2. Boot Single user | .- ::/sy+:. 3. Escape to loader prompt | / `-- / 4. Rebootle | `: :` | 5. Cons: Dual (Serial primary) | `: :` | | / / | Options: | .- -. | 6. Kernel: default/kernel (1 of 1) | -- -. | 7. Boot Options | `:` `:` | | .-- `--. | | .---.....----.console efi is invalid! A+-----------------------------------------+ Autoboot in 0 seconds, hit [Enter] to boot or any other key to stop comconsole Loading kernel... /boot/kernel/kernel text=0x17b9e0 text=0xdd6d30 text=0x65b9ac data=0x140 data=0x1b9348+0x445cb8 syms=[0x8+0x178e90+0x8+0x199058] Loading configured modules... /boot/kernel/zfs.ko size 0x67feb0 at 0x2112000 can't find '/boot/entropy' can't find '/etc/hostid' ---<