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