Cloud-init image only applies configuration on second boot

jbssm

Member
May 14, 2021
18
0
6
40
I am having a strange problem and I don't even know where to start debugging it.

I followed the could init instructions (https://pve.proxmox.com/wiki/Cloud-Init_Support) on Proxmox documentation to create a cloud init template out of an ubuntu LTS cloud init image (https://cloud-images.ubuntu.com/focal/current/) .

It mostly works fine except for the annoyance that the first time I clone the template and boot it, nothing happens. The cloud init is not applied.

Only after I forcibly `reset` the VM, the cloud init is finally applied and the VM starts correctly.

Any ideas?
 
Have you checked the cloud-init logs inside the guest for any hints? /var/log/cloud-init.log and /var/log/cloud-init-output.log
 
I am having a similar problem, but for me, it only happens if I try to use the UEFI "ovmf" --bios flag. On first boot, the ata2 disk, corresponding to the cloud-init disk, is not reported by the linux kernel, even though it is present in the PVE config. If I remove
Code:
qm set ${vmid} --efidisk0 "local-lvm:0"
qm set ${vmid} --bios ovmf
and use the default bios, cloud-init runs on the first boot. If I leave them in my VM creation script, the cloud-init disk is not found by linux, and cloud-init doesn't run. If I reboot, the disk is found, and cloud-init runs.

Are you following the instructions exactly? Can you post the exact commands you run? You could also check the boot output to see whether the ata disk (grep for "QEMU DVD-ROM") is detected.
 
I have same problem too
All things work with "seabios" but when is set to ovmf cloud-init not run at first time
 
Last edited:
I can't reproduce it here. Could you provide the output of pveversion -v and the VM config (qm config <VMID>)?
 
Code:
agent: 1
bios: seabios
boot: c
bootdisk: scsi0
cicustom: user=local:snippets/user_data_master-2.yml
cores: 2
cpu: kvm64
description: Ubuntu 20.04 K8s 1.20.5
hotplug: network,disk,usb
ide2: local-lvm:vm-100-cloudinit,media=cdrom,size=4M
ipconfig0: ip=192.168.10.153/24,gw=192.168.10.2
kvm: 1
memory: 2048
name: master-2
nameserver: 8.8.8.8
net0: virtio=4A:42:40:18:10:E2,bridge=vmbr0
numa: 0
onboot: 1
ostype: l26
scsi0: local-lvm:vm-100-disk-0,size=15G
scsihw: virtio-scsi-pci
serial0: socket
smbios1: uuid=754602bf-9080-447f-844f-bf0fd87858ba
sockets: 1
vmgenid: a76f7241-f16d-4436-9321-755459a2fa5d


This my vm config after change to "seabios".

Code:
# pveversion -v
proxmox-ve: 6.3-1 (running kernel: 5.4.106-1-pve)
pve-manager: 6.4-4 (running version: 6.4-4/337d6701)
pve-kernel-5.4: 6.4-1
pve-kernel-helper: 6.4-1
pve-kernel-5.4.106-1-pve: 5.4.106-1
ceph-fuse: 12.2.11+dfsg1-2.1+b1
corosync: 3.1.2-pve1
criu: 3.11-3
glusterfs-client: 5.5-3
ifupdown: 0.8.35+pve1
ksm-control-daemon: 1.3-1
libjs-extjs: 6.0.1-10
libknet1: 1.20-pve1
libproxmox-acme-perl: 1.0.8
libproxmox-backup-qemu0: 1.0.3-1
libpve-access-control: 6.4-1
libpve-apiclient-perl: 3.1-3
libpve-common-perl: 6.4-2
libpve-guest-common-perl: 3.1-5
libpve-http-server-perl: 3.2-1
libpve-storage-perl: 6.4-1
libqb0: 1.0.5-1
libspice-server1: 0.14.2-4~pve6+1
lvm2: 2.03.02-pve4
lxc-pve: 4.0.6-2
lxcfs: 4.0.6-pve1
novnc-pve: 1.1.0-1
proxmox-backup-client: 1.1.5-1
proxmox-mini-journalreader: 1.1-1
proxmox-widget-toolkit: 2.5-3
pve-cluster: 6.4-1
pve-container: 3.3-5
pve-docs: 6.4-1
pve-edk2-firmware: 2.20200531-1
pve-firewall: 4.1-3
pve-firmware: 3.2-2
pve-ha-manager: 3.1-1
pve-i18n: 2.3-1
pve-qemu-kvm: 5.2.0-6
pve-xtermjs: 4.7.0-3
qemu-server: 6.4-1
smartmontools: 7.2-pve2
spiceterm: 3.1-1
vncterm: 1.6-2
zfsutils-linux: 2.0.4-pve1
 
Last edited:
Here are mine:
Code:
PVE version:
proxmox-ve: 6.3-1 (running kernel: 5.4.106-1-pve)
pve-manager: 6.4-4 (running version: 6.4-4/337d6701)
pve-kernel-5.4: 6.4-1
pve-kernel-helper: 6.4-1
pve-kernel-5.4.106-1-pve: 5.4.106-1
ceph-fuse: 12.2.11+dfsg1-2.1+b1
corosync: 3.1.2-pve1
criu: 3.11-3
glusterfs-client: 5.5-3
ifupdown: 0.8.35+pve1
ksm-control-daemon: 1.3-1
libjs-extjs: 6.0.1-10
libknet1: 1.20-pve1
libproxmox-acme-perl: 1.0.8
libproxmox-backup-qemu0: 1.0.3-1
libpve-access-control: 6.4-1
libpve-apiclient-perl: 3.1-3
libpve-common-perl: 6.4-2
libpve-guest-common-perl: 3.1-5
libpve-http-server-perl: 3.2-1
libpve-storage-perl: 6.4-1
libqb0: 1.0.5-1
libspice-server1: 0.14.2-4~pve6+1
lvm2: 2.03.02-pve4
lxc-pve: 4.0.6-2
lxcfs: 4.0.6-pve1
novnc-pve: 1.1.0-1
proxmox-backup-client: 1.1.5-1
proxmox-mini-journalreader: 1.1-1
proxmox-widget-toolkit: 2.5-3
pve-cluster: 6.4-1
pve-container: 3.3-5
pve-docs: 6.4-1
pve-edk2-firmware: 2.20200531-1
pve-firewall: 4.1-3
pve-firmware: 3.2-2
pve-ha-manager: 3.1-1
pve-i18n: 2.3-1
pve-qemu-kvm: 5.2.0-6
pve-xtermjs: 4.7.0-3
qemu-server: 6.4-1
smartmontools: 7.2-pve2
spiceterm: 3.1-1
vncterm: 1.6-2
zfsutils-linux: 2.0.4-pve1

VM config:
bios: ovmf
boot: c
bootdisk: scsi0
efidisk0: local-lvm:vm-104-disk-1,size=4M
ide2: local-lvm:vm-104-cloudinit,media=cdrom
memory: 2048
net0: virtio=06:F0:A4:8F:89:9A,bridge=vmbr0
scsi0: local-lvm:vm-104-disk-0,size=2252M
scsihw: virtio-scsi-pci
serial0: socket
smbios1: uuid=769ee77a-8893-4ea8-89d6-f9177d05ec4e
sshkeys: ssh-rsa%20AAAAB3NzaC1yc2EAAAADAQABAAABAQCpaVWeE0RQ5VPQqVu%2BFN%2BdhMhjPnUO7OLXeNPtAuUuobFO7LZfffoUK10sqrh%2BWg1nehNGyV8F%2BrL%2FL%2BFwT5yShxWLDDiODc%2BOpoLwgRANyo1X6vZXzeKNZ8oGfgFQ7Nqesp76i4oQWlkrKQcudkcoOws%2B7vUlTKQhzXIVZ96dHTjCSspp6kPXsDmr5hRt7%2BhPN9b%2BYR%2B5nQLtYUWB94%2BE%2BvveRgbAOmaaaB0uvde0YrJTs6tE%2FKh%2FdAyNS%2BZoiLjT77ayDEyVOjiKNrUQgsZlMDxsVymn9%2FGg5wKNrrXkKALulL7WRhUobeNQTns8krMTyTeZ15OWkgsZn1bDcPCN%20root%40ainosticssrv02%0A
vga: serial0
vmgenid: 04069b62-b44a-402c-ac81-d3a25ec68e28

I am also attaching the script used to create the VM, and the console output from the first and second runs. In the first run, the QEMU DVD-ROM device is not detected, so cloud-init doesn't run, whereas in the second one, it is, and cloud-init runs.
 

Attachments

I also had same issues. The fix for me was to use scsi instead of ide for cloud-init CD-ROM.
 
Thanks so much @Kurosawa! That change worked for me as well. I changed

Code:
qm set ${vmid} --ide2 local-lvm:cloudinit

to

Code:
qm set ${vmid} --scsi1 local-lvm:cloudinit

and now cloud-init runs on first boot!

It's strange that @mira wasn't able to reproduce the problem. It would be good to resolve this in the code or the documentation to help other people who run into the same problem.
 
  • Like
Reactions: si458

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!