Today I was setting up some VMs on Fedora in Cockpit and decided to clone an Ubuntu 20.04 LTS image, which immediately pulled the same IP as the original. I hadn’t had that issue with CentOS or Debian, not quite sure why, but the culprit is a duplicate machine ID. Here’s how to fix that.

You’ll want to delete two files, /etc/machine-id and /var/lib/dbus/machine-id. (You’ll need to use sudo or be root, of course.) Then run systemd-machine-id-setup. Hat tip to this StackExchange answer for tipping me to the D-Bus copy of the ID

For good measure I just rebooted the virtual machine after that and made a note that I want to zap the machine ID anytime I clone a VM in the future.

The nice thing was that Cockpit’s console feature let me hop into the machines via the web interface. I didn’t lose access just because I couldn’t shell into the VM that lost the contest for the same IP address.