D-Bus and Machine Id
If you want to show the machine id:
$ hostnamectl
Static hostname: raspberrypi
Icon name: computer
Machine ID: 4f2201a9819d818f2bc928cc5ce05dca
Boot ID: 2b213624e25384e3d2625bad5ba60ce2e
Operating System: Raspbian GNU/Linux 9 (stretch)
Kernel: Linux 4.14.79-v7+
Architecture: arm
Ways to get a hosts unique identifier:
$ cat /etc/machine-id
Debian should have another file which might be a symlink to the previous one:
$ cat /var/lib/dbus/machine-id
You can also use dbus-uuidgen
:
$ dbus-uuidgen --get
You can use dbus-uuidgen
to create a new UUID:
$ dbus-uuidgen
4f2201a9819d818f2bc928cc5ce05dca
From the man dbus-uuidgen
:
D-Bus UUID has no relationship to RFC 4122 and does not generate UUIDs compatible with that spec.
To recreate the file rm -f /etc/machine-id
and then issue:
$ dbus-uuidgen --ensure=/etc/machine-id
In Debian, also might need to do:
$ rm /var/lib/dbus/machine-id
And re-create it:
$ dbus-uuidgen --ensure
First boot
systemd-firstboot can be used to initialize basic system settings on or before the first boot-up of a system.
The service is started if ConditionFirstBoot=yes
is satisfied. This essentially means that /etc is empty, see systemd.unit for details.
The following settings may be set up:
system locale, more specifically the two locale variables LANG= and LC_MESSAGES
system keyboard map
system time zone
system host name
machine ID of the system
root user's password
Recommended way to clone:
- clone the disk
- mount the cloned root partition somewhere (e.g. /mnt);
- initialize the machine id:
systemd-firstboot --root=/mnt --setup-machine-id