Changing instance-id cloud-init

flori

Member
Apr 3, 2021
7
0
6
Hello community,

today I had the strange effect, that the ssh host keys one of my VMs had changed. After digging a bit into the logs I figured out that the cloud-init instance-id had changed and thus cloud-init simply cleaned everything.

Is there anyone who has experienced something similar?

Thanks!
 
From the linked mail thread:

the only thing not really clear is how we generate instance-ids

currently it is the hash of the config, so a config change means a new
instance-id (which triggers things as ssh-host key generation etc.)

It seems this way of generating instance_id has not changed since 2018, as all our VMs got new SSH host keys after the DNS config of the host was changed. This is obviously a very bad thing and causes all sorts of breakage.

Workarounds seem to be
 
Last edited:
Another workaround is to override the instance-id.

You can find the current instance-id using qm cloudinit dump <vmid> meta. This can then be saved as a snippet to override the automatically generated meta data using qm set <vmid> --cicustom meta=local:snippets/<yaml file with instance-id defined>.yaml

It would be nice if the cloud-init instance-id was tied to the vmgenid instead of a hash of the cloud-init config file. If you perform the workaround above after your actual first boot, it should retain the same instance-id even other cloud-init information changes.
 

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!