]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/machine-id.xml
journal-remote: remove unnecessary gnutls includes (#3895)
[thirdparty/systemd.git] / man / machine-id.xml
CommitLineData
d7ccca2e 1<?xml version='1.0'?> <!--*-nxml-*-->
d7ccca2e 2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
12b42c76 3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
d7ccca2e
LP
4
5<!--
6 This file is part of systemd.
7
8 Copyright 2010 Lennart Poettering
9
10 systemd is free software; you can redistribute it and/or modify it
5430f7f2
LP
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
d7ccca2e
LP
13 (at your option) any later version.
14
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
5430f7f2 18 Lesser General Public License for more details.
d7ccca2e 19
5430f7f2 20 You should have received a copy of the GNU Lesser General Public License
d7ccca2e
LP
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
22-->
23
24<refentry id="machine-id">
798d3a52
ZJS
25 <refentryinfo>
26 <title>machine-id</title>
27 <productname>systemd</productname>
28
29 <authorgroup>
30 <author>
31 <contrib>Developer</contrib>
32 <firstname>Lennart</firstname>
33 <surname>Poettering</surname>
34 <email>lennart@poettering.net</email>
35 </author>
36 </authorgroup>
37 </refentryinfo>
38
39 <refmeta>
40 <refentrytitle>machine-id</refentrytitle>
41 <manvolnum>5</manvolnum>
42 </refmeta>
43
44 <refnamediv>
45 <refname>machine-id</refname>
46 <refpurpose>Local machine ID configuration file</refpurpose>
47 </refnamediv>
48
49 <refsynopsisdiv>
50 <para><filename>/etc/machine-id</filename></para>
51 </refsynopsisdiv>
52
53 <refsect1>
54 <title>Description</title>
55
56 <para>The <filename>/etc/machine-id</filename> file contains the
57 unique machine ID of the local system that is set during
58 installation. The machine ID is a single newline-terminated,
59 hexadecimal, 32-character, lowercase machine ID string. When
60 decoded from hexadecimal, this corresponds with a 16-byte/128-bit
61 string.</para>
62
63 <para>The machine ID is usually generated from a random source
64 during system installation and stays constant for all subsequent
65 boots. Optionally, for stateless systems, it is generated during
4a9b1dd4 66 runtime at early boot if it is found to be empty.</para>
798d3a52
ZJS
67
68 <para>The machine ID does not change based on user configuration
69 or when hardware is replaced.</para>
70
71 <para>This machine ID adheres to the same format and logic as the
72 D-Bus machine ID.</para>
73
74 <para>Programs may use this ID to identify the host with a
75 globally unique ID in the network, which does not change even if
76 the local network configuration changes. Due to this and its
77 greater length, it is a more useful replacement for the
3ba3a79d 78 <citerefentry project='man-pages'><refentrytitle>gethostid</refentrytitle><manvolnum>3</manvolnum></citerefentry>
798d3a52
ZJS
79 call that POSIX specifies.</para>
80
81 <para>The
82 <citerefentry><refentrytitle>systemd-machine-id-setup</refentrytitle><manvolnum>1</manvolnum></citerefentry>
83 tool may be used by installer tools to initialize the machine ID
84 at install time. Use
85 <citerefentry><refentrytitle>systemd-firstboot</refentrytitle><manvolnum>1</manvolnum></citerefentry>
86 to initialize it on mounted (but not booted) system images.</para>
ee48dbd5
NC
87
88 <para>The machine-id may also be set, for example when network
89 booting, by setting the <varname>systemd.machine_id=</varname>
90 kernel command line parameter or passing the option
91 <option>--machine-id=</option> to systemd. A machine-id may not
92 be set to all zeros.</para>
798d3a52
ZJS
93 </refsect1>
94
95 <refsect1>
96 <title>Relation to OSF UUIDs</title>
97
98 <para>Note that the machine ID historically is not an OSF UUID as
99 defined by <ulink url="https://tools.ietf.org/html/rfc4122">RFC
100 4122</ulink>, nor a Microsoft GUID; however, starting with systemd
101 v30, newly generated machine IDs do qualify as v4 UUIDs.</para>
102
103 <para>In order to maintain compatibility with existing
104 installations, an application requiring a UUID should decode the
105 machine ID, and then apply the following operations to turn it
106 into a valid OSF v4 UUID. With <literal>id</literal> being an
107 unsigned character array:</para>
108
109 <programlisting>/* Set UUID version to 4 --- truly random generation */
8d41a963
LP
110id[6] = (id[6] &amp; 0x0F) | 0x40;
111/* Set the UUID variant to DCE */
112id[8] = (id[8] &amp; 0x3F) | 0x80;</programlisting>
113
798d3a52
ZJS
114 <para>(This code is inspired by
115 <literal>generate_random_uuid()</literal> of
116 <filename>drivers/char/random.c</filename> from the Linux kernel
117 sources.)</para>
118
119 </refsect1>
120
121 <refsect1>
122 <title>History</title>
123
124 <para>The simple configuration file format of
125 <filename>/etc/machine-id</filename> originates in the
126 <filename>/var/lib/dbus/machine-id</filename> file introduced by
127 D-Bus. In fact, this latter file might be a symlink to
22065311 128 <filename>/etc/machine-id</filename>.</para>
798d3a52
ZJS
129 </refsect1>
130
131 <refsect1>
132 <title>See Also</title>
133 <para>
134 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
135 <citerefentry><refentrytitle>systemd-machine-id-setup</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
3ba3a79d 136 <citerefentry project='man-pages'><refentrytitle>gethostid</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
798d3a52
ZJS
137 <citerefentry><refentrytitle>hostname</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
138 <citerefentry><refentrytitle>machine-info</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
139 <citerefentry><refentrytitle>os-release</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
140 <citerefentry><refentrytitle>sd-id128</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
141 <citerefentry><refentrytitle>sd_id128_get_machine</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
142 <citerefentry><refentrytitle>systemd-firstboot</refentrytitle><manvolnum>1</manvolnum></citerefentry>
143 </para>
144 </refsect1>
d7ccca2e
LP
145
146</refentry>