]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/machine-id.xml
test-execute: Add tests for new PassEnvironment= directive
[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>
87 </refsect1>
88
89 <refsect1>
90 <title>Relation to OSF UUIDs</title>
91
92 <para>Note that the machine ID historically is not an OSF UUID as
93 defined by <ulink url="https://tools.ietf.org/html/rfc4122">RFC
94 4122</ulink>, nor a Microsoft GUID; however, starting with systemd
95 v30, newly generated machine IDs do qualify as v4 UUIDs.</para>
96
97 <para>In order to maintain compatibility with existing
98 installations, an application requiring a UUID should decode the
99 machine ID, and then apply the following operations to turn it
100 into a valid OSF v4 UUID. With <literal>id</literal> being an
101 unsigned character array:</para>
102
103 <programlisting>/* Set UUID version to 4 --- truly random generation */
8d41a963
LP
104id[6] = (id[6] &amp; 0x0F) | 0x40;
105/* Set the UUID variant to DCE */
106id[8] = (id[8] &amp; 0x3F) | 0x80;</programlisting>
107
798d3a52
ZJS
108 <para>(This code is inspired by
109 <literal>generate_random_uuid()</literal> of
110 <filename>drivers/char/random.c</filename> from the Linux kernel
111 sources.)</para>
112
113 </refsect1>
114
115 <refsect1>
116 <title>History</title>
117
118 <para>The simple configuration file format of
119 <filename>/etc/machine-id</filename> originates in the
120 <filename>/var/lib/dbus/machine-id</filename> file introduced by
121 D-Bus. In fact, this latter file might be a symlink to
22065311 122 <filename>/etc/machine-id</filename>.</para>
798d3a52
ZJS
123 </refsect1>
124
125 <refsect1>
126 <title>See Also</title>
127 <para>
128 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
129 <citerefentry><refentrytitle>systemd-machine-id-setup</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
3ba3a79d 130 <citerefentry project='man-pages'><refentrytitle>gethostid</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
798d3a52
ZJS
131 <citerefentry><refentrytitle>hostname</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
132 <citerefentry><refentrytitle>machine-info</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
133 <citerefentry><refentrytitle>os-release</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
134 <citerefentry><refentrytitle>sd-id128</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
135 <citerefentry><refentrytitle>sd_id128_get_machine</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
136 <citerefentry><refentrytitle>systemd-firstboot</refentrytitle><manvolnum>1</manvolnum></citerefentry>
137 </para>
138 </refsect1>
d7ccca2e
LP
139
140</refentry>