Frequently Asked Question
What is /etc/machine-id and why does it exist?
/etc/machine-id is a single line containing a 128-bit random identifier, formatted as
32 lowercase hexadecimal characters, that uniquely identifies an operating-system
installation. It is generated at first boot (or at install time) and then kept stable
for the lifetime of the installation. systemd uses it as a key for log storage in
/var/log/journal/<machine-id>/, the systemd-boot bootloader uses it to namespace
kernel files, and several GNOME and KDE components key configuration off it.
Because the value should be unique per installation, you must regenerate it when
cloning a VM image or building a base container: leaving the same machine-id on twenty
virtual machines causes their journal entries, hostnames, and DHCP leases to collide.
The recipe is to empty the file (truncate -s 0 /etc/machine-id) on the template, and
systemd-machine-id-setup will fill it on first boot. It is also considered slightly
sensitive and should not be exposed on untrusted networks.