Dalen Catt

My Extremely Low-Effort Blog

,

Creating a Golden Image

When getting started with deploying virtual machines in Proxmox, or any hypervisor, it can be beneficial to have a set of “Golden Images” that are basically just pre-configured templates that can be cloned and modified quickly when you need to do something new.

First start out by creating an Ubuntu (or whatever you want) VM that you will use for some set of other servers. Once you are done, before shutting down and creating a template from it, check to see if the OS you just installed is one that uses machine-id as a method of obtaining its DHCP lease. Ubuntu server is one such OS. You will generally find that Linux OS’s that use machine-id will have a file /etc/machine-id. Ubuntu also has a symbolic link to /var/lib/dbus/machine-id. So before shutting down your template, you must first erase the contents of this file and recreate the symlink like so:

sudo truncate -s 0 /etc/machine-id
sudo rm /var/lib/dbus/machine-id
sudo ln -s /etc/machine-id /var/lib/dbus/machine-id
Bash

Once that is done, shut down the VM, and DO NOT restart it. Starting this VM will cause the file to be repopulated, but you don’t want your template to do that. Instead, at this point, right click on your VM in Proxmox and click Convert to Template. Now you can create whatever clones you want, and they will all be given unique machine ids. Proxmox supports a system called Cloud-init that is supposed to be used to create unique data for VMs, but I could not find a way to make it work with this particular resource. We will look into the cloud-init configuration system later, because it’s really cool and is definitely the right way to do things like this.

The alternative method from creating golden images is to use pre-seed files and do brand new unattended OS installs automatically when you need them, and if there is anything you want to do after install, automate it with Ansible. I won’t be setting that up here, but we will also look at that in the future.


0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x