Cloning your OS
LINUX


Whether you cloned a VM or whether you cloned an OS from the whole drive using the dd command, you are going to need to take into consideration some configurations to avoid network conflicts.
Items to check after cloning a disk/VM with an OS
Remove and regenerate the D-BUS Machine ID from /var/lib/dbus/machine-id and the Machine ID from /etc/machine-id. /var/lib/dbus/machine-id is actually supposed to be a symbolic link to /etc/machine-id. This ensures the system has one single "source of truth" for its identity. /var/lib/dbus/machine-id may not be found in every system. Determine if you could regenerate an ID number to use as the D-bus machine's ID, by typing which dbus-uuidgen.
Host name
NIC MAC addresses
NIC static IP addresses, if any
Universally Unique Identifiers (UUID)
Regenerate SSH Host Keys: If you don't do this, every clone will share the same "fingerprint," which is a security risk. sudo rm -f /etc/ssh/ssh_host_* ; sudo ssh-keygen -A ; sudo systemctl restart ssh . Once you do this, the next time you try to SSH into this VM from, let's say, your physical computer or source machine, you will see a WARNING:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
This is normal. Your computer remembers the old key associated with that IP address. You need to clear that old entry on your local machine (not the cloned VM) with:
ssh-keygen -R [IP_ADDRESS_OF_VM/SOURCE_MACHINE]
Note: machine-id
Think of the machine-id as the DNA sequence of a Linux installation.
It is a single, 32-character hexadecimal string.
It is generated during installation or the first boot.
Its purpose: It provides a unique identifier for the operating system instance itself.
Unlike a MAC address (which belongs to a network card) or a UUID (which belongs to a disk), the machine-id is used by system services (like systemd, dbus, and journald) to identify the specific OS environment.
Crucial for Cloning: If you clone your disk/VM without changing the machine-id, both machines will try to use the same ID for logs and DHCP leases, which can lead to network IP conflicts.
If you want to know how to clone a whole drive, then you need to use the dd command.
Contact
hello@unixtips.eu
© 2025. All rights reserved.