Search code examples
virtual-machinevirtualizationrhelkvmcloud-init

Cloud-init 18.5 module execution fails before creating the SSH keys


I am provisioning a virtual machine which executes the cloud init script on its first boot. I have a floating IP assigned to the VM and I can ping it, but can't ssh into it. I suspect that the cloud-init script execution has failed somewhere. Even if I pass userdata with password, the module may not execute the userdata script. How can I peek inside the VM to figure the root cause? This doesn't happen frequently.

Image: RHEL 8/9
Virtualization: KVM/Libvirt
Cloud-init version: 18.5

Solution

  • How can I peek inside the VM to figure the root cause?

    I would mount the VM's filesystem locally and inspect the log files (/var/log/cloud-init.log)

    For example, you can mount a qcow2 image with qemu-nbd.