The trouble with VM customization and Ubuntu 18 on VMware Vsphere 6.5u2+

So I spent about a day figuring out all of the dilemmas with Ubuntu recently. I’m putting my notes down here because I found the various pieces I needed from different sources.

Here goes.
Part 1 – Dealing with the hostname customization and Nic disconnect issue

# First Deploy Ubuntu 18.04 from iso on new VM
# Second take your updates
sudo apt-get update && sudo apt-get upgrade
#Cloud-init is installed by default

#Third Follow KB
But use "After=dbus.socket" instead of "After=dbus.service"

Steps are below in case the KB article gets mangled through time.
Open the?tmp.conf?under?/usr/lib/tmpfiles.d/tmp.conf?file.
Go to the line 11 and add the prefix # .
For example
#D?/tmp 1777 root root -

If you have open-vm-tools installed, open the /lib/systemd/system/open-vm-tools.service file.
Add this line ?After=dbus.socket? under [Unit]

#Fourth Step Clean up cloud-init
sudo cloud-init clean --log

Part 2 – Fixing the New IP address issue ( Found the fix here)

The cause of the problem is that the built-in network config of Ubuntu 18.04 no longer uses the NIC Mac address as the default id for DHCP requests.

The traditional (and I believe “sensible”) behavior can be restored by adding dhcp-identifier: mac to the configuration in the /etc/netplan/xxx.yaml (cloud-init) file as follows:

    renderer: networkd
    version: 2
            dhcp4: true
            dhcp-identifier: mac

Where “nicdevicename” is the name of your network device


sudo netplan apply