[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Generating new IDs for cloning



On Thu, 08 Aug 2019 at 08:37:16 -0400, Marvin Renich wrote:
> Does anyone know what applications use this file for what purpose?  Is
> this a systemd-ism?

It originated as /var/lib/dbus/machine-id in D-Bus, and systemd picked it
up and generalized it into something non-D-Bus-specific. It isn't really
particularly specific to either D-Bus or systemd: they both provide it
as a piece of generically useful functionality for anything else that
wants it. Asking which applications use it is a bit like asking which
applications use gethostname(2): you are not going to get an exhaustive
list unless you use something like codesearch.

It's intended as an opaque, non-human-meaningful, persistent unique
identifier for a machine (or more precisely an OS installation), used as
a lookup key in state/configuration storage in the same sorts of places
you might be tempted to use a hostname.

Being opaque and non-human-meaningful is important for some of the
places where it's useful, because if a string is human-meaningful (like a
hostname), then people will sometimes want to change it, and when they do,
anything that was recording machine-specific state with the hostname as
unique identifer will no longer be able to associate the machine-specific
state with the machine, effectively resulting in data loss.

One example of the machine ID being used to identify hardware devices
is that GNOME stores screen layout configuration keyed by machine ID,
so that if you have an NFS-shared home directory or similar, it won't try
to use your laptop's monitor layout on your desktop (or keep overwriting
one layout with the other).

One example of the machine ID being used to identify an OS installation is
that if you use the systemd-boot EFI bootloader on a dual- or multi-boot
Linux system (e.g. Debian and Fedora sharing a disk), systemd-boot stores
each OS installation's kernel(s) in a directory named after the machine
ID, so that they won't collide.

    smcv


Reply to: