1 <?xml version='
1.0'
?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-->
2 <!DOCTYPE refentry PUBLIC
"-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
6 This file is part of systemd.
8 Copyright 2012 Lennart Poettering
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
24 <refentry id=
"systemd-machine-id-setup"
25 xmlns:
xi=
"http://www.w3.org/2001/XInclude">
28 <title>systemd-machine-id-setup
</title>
29 <productname>systemd
</productname>
33 <contrib>Developer
</contrib>
34 <firstname>Lennart
</firstname>
35 <surname>Poettering
</surname>
36 <email>lennart@poettering.net
</email>
39 <contrib>Developer
</contrib>
40 <firstname>Didier
</firstname>
41 <surname>Roche
</surname>
42 <email>didrocks@ubuntu.com
</email>
48 <refentrytitle>systemd-machine-id-setup
</refentrytitle>
49 <manvolnum>1</manvolnum>
53 <refname>systemd-machine-id-setup
</refname>
54 <refpurpose>Initialize the machine ID in /etc/machine-id
</refpurpose>
59 <command>systemd-machine-id-setup
</command>
64 <title>Description
</title>
66 <para><command>systemd-machine-id-setup
</command> may be used by
67 system installer tools to initialize the machine ID stored in
68 <filename>/etc/machine-id
</filename> at install time, with a
69 provisioned or randomly generated ID. See
70 <citerefentry><refentrytitle>machine-id
</refentrytitle><manvolnum>5</manvolnum></citerefentry>
71 for more information about this file.
</para>
73 <para>If the tool is invoked without the
<option>--commit
</option>
74 switch,
<filename>/etc/machine-id
</filename> is initialized with a
75 valid, new machined ID if it is missing or empty. The new machine
76 ID will be acquired in the following fashion:
</para>
79 <listitem><para>If a valid D-Bus machine ID is already
80 configured for the system, the D-Bus machine ID is copied and
81 used to initialize the machine ID in
82 <filename>/etc/machine-id
</filename>.
</para></listitem>
84 <listitem><para>If run inside a KVM virtual machine and a UUID
85 is was configured (via the
<option>-uuid
</option>
86 option), this UUID is used to initialize the machine ID. The
87 caller must ensure that the UUID passed is sufficiently unique
88 and is different for every booted instance of the
91 <listitem><para>Similarly, if run inside a Linux container
92 environment and a UUID is configured for the container, this is
93 used to initialize the machine ID. For details, see the
94 documentation of the
<ulink
95 url=
"http://www.freedesktop.org/wiki/Software/systemd/ContainerInterface">Container
96 Interface
</ulink>.
</para></listitem>
98 <listitem><para>Otherwise, a new ID is randomly
99 generated.
</para></listitem>
102 <para>The
<option>--commit
</option> switch may be used to commit a
103 transient machined ID to disk, making it persistent. For details,
107 <citerefentry><refentrytitle>systemd-firstboot
</refentrytitle><manvolnum>1</manvolnum></citerefentry>
108 to initialize the machine ID on mounted (but not booted) system
114 <title>Options
</title>
116 <para>The following options are understood:
</para>
121 <term><option>--root=
<replaceable>root
</replaceable></option></term>
122 <listitem><para>Takes a directory path as argument. All paths
123 operated will be prefixed with the given alternate
124 <replaceable>root
</replaceable> path, including the path for
125 <filename>/etc/machine-id
</filename> itself.
</para></listitem>
129 <term><option>--commit
</option></term>
130 <listitem><para>Commit a transient machine ID to disk. This
131 command may be used to convert a transient machine ID into a
132 persistent one. A transient machine ID file is one that was
133 bind mounted from a memory file system (usually
134 <literal>tmpfs
</literal>) to
135 <filename>/etc/machine-id
</filename> during the early phase of
136 the boot process. This may happen because
137 <filename>/etc
</filename> is initially read-only and was
138 missing a valid machine ID file at that point.
</para>
140 <para>This command will execute no operation if
141 <filename>/etc/machine-id
</filename> is not mounted from a
142 memory file system, or if
<filename>/etc
</filename> is
143 read-only. The command will write the current transient
144 machine ID to disk and unmount the
145 <filename>/etc/machine-id
</filename> mount point in a
146 race-free manner to ensure that this file is always valid and
147 accessible for other processes.
</para>
149 <para>This command is primarily used by the
150 <citerefentry><refentrytitle>systemd-machine-id-commit.service
</refentrytitle><manvolnum>8</manvolnum></citerefentry>
151 early boot service.
</para></listitem>
154 <xi:include href=
"standard-options.xml" xpointer=
"help" />
155 <xi:include href=
"standard-options.xml" xpointer=
"version" />
161 <title>Exit status
</title>
163 <para>On success,
0 is returned, a non-zero failure code
168 <title>See Also
</title>
170 <citerefentry><refentrytitle>systemd
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
171 <citerefentry><refentrytitle>machine-id
</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
172 <citerefentry><refentrytitle>systemd-machine-id-commit.service
</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
173 <citerefentry project='dbus'
><refentrytitle>dbus-uuidgen
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
174 <citerefentry><refentrytitle>systemd-firstboot
</refentrytitle><manvolnum>1</manvolnum></citerefentry>