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