SYSTEMD-MACHINE-ID-SETUP(1)
๐ SYSTEMD-MACHINE-ID-SETUP(1) ๐
okay bestie, this is systemd-machine-id-setup from the systemd manual โ the lil glow-up artist that gives your machine its one true ID โจ
๐ธ NAME ๐ธ
systemd-machine-id-setup โ initialize the machine ID in /etc/machine-id
๐ SYNOPSIS ๐
systemd-machine-id-setup
โจ DESCRIPTION โจ
so like, systemd-machine-id-setup is the tool your system installer besties call to set up the machine ID living in /etc/machine-id at install time โ either with a provisioned ID or a freshly randomized one ๐ฒ. wanna know more about that file? go read machine-id(5), it spills all the tea ๐
.
If you run the tool without the --commit switch, /etc/machine-id gets initialized with a valid, brand-new machine ID if it's missing or empty. and how does it pick that new ID? glad you asked, here's the whole lineup:
- If there's a valid machine ID chillin' in
/run/machine-id, it gets copied over and used to initialize the machine ID in/etc/machine-id. โ ๏ธ this step is skipped if--root=is specified, or if you're running in a chroot environment. - If a valid D-Bus machine ID is already configured for the system, that D-Bus machine ID gets copied and used to initialize the machine ID in
/etc/machine-id. - If a valid machine ID is provided through the
system.machine_idcredential, that machine ID gets copied and used to initialize the machine ID in/etc/machine-id. โ ๏ธ skipped if--root=is specified or running in a chroot environment. - If you're running inside a KVM virtual machine and a UUID is configured (via the
-uuidoption), that UUID is used to initialize the machine ID. heads up tho: the caller has to make sure the UUID they pass is sufficiently unique and different for every single booted instance of the VM ๐. โ ๏ธ skipped if--root=is specified or running in a chroot environment. - Same vibe for Linux containers: if you're in a container environment and a UUID is configured for the container, that gets used to initialize the machine ID. for the deets, check the Container Interface docs (linked down in NOTES ๐ซถ). โ ๏ธ skipped if
--root=is specified or running in a chroot environment. - and if literally none of that applies? a brand-new ID gets randomly generated. iconic. ๐ฆ
The --commit switch is the glow-up button: it commits a transient machine ID to disk and makes it persistent. more on that below ๐
also, if you're initializing the machine ID on a mounted (but not booted) system image, use systemd-firstboot(1) instead ๐
๐ OPTIONS ๐
here's everything this baby understands:
--root=path โ takes a directory path as its argument. every path it operates on gets prefixed with that alternate root path you gave it โ including the path for/etc/machine-iditself. ๐
Added in version 212.
--image=path โ takes a path to a device node or regular file as argument. it's basically--root=but for a disk image instead of a directory tree ๐พ.
Added in version 249.
--image-policy=policy โ takes an image policy string as argument, as persystemd.image-policy(7). the policy gets enforced when operating on the disk image specified via--image=, see above. if you don't specify one, it defaults to the"*"policy, i.e. all recognized file systems in the image are used ๐.--commitโ commit a transient machine ID to disk ๐ซถ. this command can convert a transient machine ID into a persistent one. a transient machine ID file is one that was bind mounted from a memory file system (usually"tmpfs") to/etc/machine-idduring the early phase of the boot process โ which can happen because/etc/was initially read-only and was missing a valid machine ID file at that point ๐ญ.
This command will execute no operation if /etc/machine-id is not mounted from a memory file system, or if /etc/ is read-only. otherwise, it writes the current transient machine ID to disk and unmounts the /etc/machine-id mount point in a race-free manner, so that this file is always valid and accessible for other processes ๐.
This command is primarily used by the systemd-machine-id-commit.service(8) early boot service.
Added in version 227.
--printโ print the machine ID that was generated or committed, after the operation is complete ๐จ๏ธโจ.
Added in version 231.
-h,--helpโ print a short help text and exit. classic.--versionโ print a short version string and exit. also classic.
๐ฅ EXIT STATUS ๐ฅ
On success, 0 is returned. otherwise you get a non-zero failure code ๐ญ.
๐ SEE ALSO ๐
systemd(1), machine-id(5), systemd-machine-id-commit.service(8), dbus-uuidgen(1), systemd-firstboot(1)
๐ NOTES ๐
- Container Interface
https://systemd.io/CONTAINER_INTERFACE
and that's the whole page bestie, no cap ๐ this was systemd version 262.1's SYSTEMD-MACHINE-ID-SETUP(1) โ go forth and give your machine an identity, main character energy only ๐โจ๐
๐ฆ where this page comes from
- arch rolling: systemd 262.1-1 ยท LGPL-2.1-or-later AND CC0-1.0 AND GPL-2.0-or-later AND MIT-0
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms