1SYSTEMD-MACHINE-ID-SETUP(1)systemd-machine-id-setupSYSTEMD-MACHINE-ID-SETUP(1)
2
3
4
6 systemd-machine-id-setup - Initialize the machine ID in /etc/machine-id
7
9 systemd-machine-id-setup
10
12 systemd-machine-id-setup may be used by system installer tools to
13 initialize the machine ID stored in /etc/machine-id at install time,
14 with a provisioned or randomly generated ID. See machine-id(5) for more
15 information about this file.
16
17 If the tool is invoked without the --commit switch, /etc/machine-id is
18 initialized with a valid, new machine ID if it is missing or empty. The
19 new machine ID will be acquired in the following fashion:
20
21 1. If a valid D-Bus machine ID is already configured for the system,
22 the D-Bus machine ID is copied and used to initialize the machine
23 ID in /etc/machine-id.
24
25 2. If run inside a KVM virtual machine and a UUID is configured (via
26 the -uuid option), this UUID is used to initialize the machine ID.
27 The caller must ensure that the UUID passed is sufficiently unique
28 and is different for every booted instance of the VM.
29
30 3. Similarly, if run inside a Linux container environment and a UUID
31 is configured for the container, this is used to initialize the
32 machine ID. For details, see the documentation of the Container
33 Interface[1].
34
35 4. Otherwise, a new ID is randomly generated.
36
37 The --commit switch may be used to commit a transient machined ID to
38 disk, making it persistent. For details, see below.
39
40 Use systemd-firstboot(1) to initialize the machine ID on mounted (but
41 not booted) system images.
42
44 The following options are understood:
45
46 --root=path
47 Takes a directory path as argument. All paths operated on will be
48 prefixed with the given alternate root path, including the path for
49 /etc/machine-id itself.
50
51 --image=path
52 Takes a path to a device node or regular file as argument. This is
53 similar to --root= as described above, but operates on a disk image
54 instead of a directory tree.
55
56 --image-policy=policy
57 Takes an image policy string as argument, as per systemd.image-
58 policy(7). The policy is enforced when operating on the disk image
59 specified via --image=, see above. If not specified defaults to the
60 "*" policy, i.e. all recognized file systems in the image are used.
61
62 --commit
63 Commit a transient machine ID to disk. This command may be used to
64 convert a transient machine ID into a persistent one. A transient
65 machine ID file is one that was bind mounted from a memory file
66 system (usually "tmpfs") to /etc/machine-id during the early phase
67 of the boot process. This may happen because /etc/ is initially
68 read-only and was missing a valid machine ID file at that point.
69
70 This command will execute no operation if /etc/machine-id is not
71 mounted from a memory file system, or if /etc/ is read-only. The
72 command will write the current transient machine ID to disk and
73 unmount the /etc/machine-id mount point in a race-free manner to
74 ensure that this file is always valid and accessible for other
75 processes.
76
77 This command is primarily used by the systemd-machine-id-
78 commit.service(8) early boot service.
79
80 --print
81 Print the machine ID generated or committed after the operation is
82 complete.
83
84 -h, --help
85 Print a short help text and exit.
86
87 --version
88 Print a short version string and exit.
89
91 On success, 0 is returned, a non-zero failure code otherwise.
92
94 systemd(1), machine-id(5), systemd-machine-id-commit.service(8), dbus-
95 uuidgen(1), systemd-firstboot(1)
96
98 1. Container Interface
99 https://systemd.io/CONTAINER_INTERFACE
100
101
102
103systemd 254 SYSTEMD-MACHINE-ID-SETUP(1)