[SOLVED] Cloud-Init Drive Not Auto-Regenerating

Oct 16, 2021
14
2
8
Hello,

I am experiencing an issue with the CloudInit Drive 'auto-regenerating' after a clone, a virtual hardware hotswap, or even a reboot. The Regenerate Image button must be manually clicked in the GUI.

  • I have used Packer to create an image of Alma 9 Linux with cloud-init installed. It also pushed the below line to /etc/cloud/cloud.cfg as per the docs.
    datasource_list: [ NoCloud, ConfigDrive ]
  • I then provision a VM via Terraform with only the ipconfig0 for cloud-init defined.
  • After booting if I run systemctl start cloud-init I get a line in the logs saying no datasources found. If I do any combination of hotswapping hardware, rebooting, running cloud-init manually, no datasources are found and the ipconfig0 IP.
  • After clicking the Regenerate Image button in the GUI and rebooting the VM, the CloudInit Drive and IP will be picked up by the VM as expected.
I have had this kind of thing running with an older setup with an older Proxmox/CentOS in the past, without using Packer and Terraform.

Have I come across a bug? Is there a workaround for this perhaps? This is essentially completely blocking the automation of any VM provisioning with this method.

Any help would be hugely appreciated :D!
 
Last edited:
Just incase anyone comes across this same issue, I have got it working by simply apending ide0 to the the bootlist. I am not sure WHY this would be needed but it is. I found it by grabbing the output of the Proxmox QEMU VM config file VMID.conf output before clicking Regenerate Image, and then again after and diffing them both - the difference being the below.

4c4 < boot: order=scsi0 --- > boot: order=scsi0;ide0 9c9 < ide0: ssd:vm-10139-cloudinit,media=cdrom,size=4M --- > ide0: ssd:vm-10139-cloudinit,media=cdrom

Adding the below to the Terraform Proxmox resouce .tf allowed the VM to pick up the cloud-init config immidiately after cloning.
boot = "order=scsi0;ide0"

Previously I had this.
boot = "order=scsi0"
 
  • Like
Reactions: lanrat

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!