From fffb8c5da7bf84b16607fbc4c411db580b3a2793 Mon Sep 17 00:00:00 2001 From: Vignesh Goutham Ganesh <72776369+vignesh-goutham@users.noreply.github.com> Date: Thu, 27 Oct 2022 14:36:58 -0500 Subject: [PATCH] Fix customize ubuntu docs to clean the vm properly (#3846) --- .../en/docs/reference/vsphere/customize-ovas.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/docs/content/en/docs/reference/vsphere/customize-ovas.md b/docs/content/en/docs/reference/vsphere/customize-ovas.md index 818c53863972..79d752757809 100644 --- a/docs/content/en/docs/reference/vsphere/customize-ovas.md +++ b/docs/content/en/docs/reference/vsphere/customize-ovas.md @@ -132,14 +132,29 @@ Restart containerd service with the `sudo systemctl restart containerd` command. After you have customized the VM, you need to convert it to a template. -### Reset the machine-id and power off the VM +### Cleanup the machine and power off the VM This step is needed because of a [known issue in Ubuntu](https://kb.vmware.com/s/article/82229) which results in the clone VMs getting the same DHCP IP ``` +sudo su echo -n > /etc/machine-id rm /var/lib/dbus/machine-id ln -s /etc/machine-id /var/lib/dbus/machine-id +cloud-init clean -l --machine-id +``` + +Delete the hostname from file +``` +/etc/hostname +``` +Delete the networking config file +``` +rm -rf /etc/netplan/50-cloud-init.yaml +``` +Edit the cloud init config to turn `preserve_hostname` to false +``` +vi /etc/cloud/cloud.cfg ``` Power the VM down