systemd/man/machine-id.html
2015-02-17 11:22:16 +01:00

70 lines
5.9 KiB
HTML

<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>machine-id</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><style>
a.headerlink {
color: #c60f0f;
font-size: 0.8em;
padding: 0 4px 0 4px;
text-decoration: none;
visibility: hidden;
}
a.headerlink:hover {
background-color: #c60f0f;
color: white;
}
h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, dt:hover > a.headerlink {
visibility: visible;
}
</style><a href="index.html">Index </a>·
<a href="systemd.directives.html">Directives </a>·
<a href="../python-systemd/index.html">Python </a>·
<a href="../libudev/index.html">libudev </a>·
<a href="../libudev/index.html">gudev </a><span style="float:right">systemd 219</span><hr><div class="refentry"><a name="machine-id"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>machine-id — Local machine ID configuration file</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><p><code class="filename">/etc/machine-id</code></p></div><div class="refsect1"><a name="idm140598384460224"></a><h2 id="Description">Description<a class="headerlink" title="Permalink to this headline" href="#Description"></a></h2><p>The <code class="filename">/etc/machine-id</code> file contains the
unique machine ID of the local system that is set during
installation. The machine ID is a single newline-terminated,
hexadecimal, 32-character, lowercase machine ID string. When
decoded from hexadecimal, this corresponds with a 16-byte/128-bit
string.</p><p>The machine ID is usually generated from a random source
during system installation and stays constant for all subsequent
boots. Optionally, for stateless systems, it is generated during
runtime at boot if it is found to be empty.</p><p>The machine ID does not change based on user configuration
or when hardware is replaced.</p><p>This machine ID adheres to the same format and logic as the
D-Bus machine ID.</p><p>Programs may use this ID to identify the host with a
globally unique ID in the network, which does not change even if
the local network configuration changes. Due to this and its
greater length, it is a more useful replacement for the
<a href="gethostid.html"><span class="citerefentry"><span class="refentrytitle">gethostid</span>(3)</span></a>
call that POSIX specifies.</p><p>The
<a href="systemd-machine-id-setup.html"><span class="citerefentry"><span class="refentrytitle">systemd-machine-id-setup</span>(1)</span></a>
tool may be used by installer tools to initialize the machine ID
at install time. Use
<a href="systemd-firstboot.html"><span class="citerefentry"><span class="refentrytitle">systemd-firstboot</span>(1)</span></a>
to initialize it on mounted (but not booted) system images.</p></div><div class="refsect1"><a name="idm140598382817232"></a><h2 id="Relation to OSF UUIDs">Relation to OSF UUIDs<a class="headerlink" title="Permalink to this headline" href="#Relation%20to%20OSF%20UUIDs"></a></h2><p>Note that the machine ID historically is not an OSF UUID as
defined by <a class="ulink" href="https://tools.ietf.org/html/rfc4122" target="_top">RFC
4122</a>, nor a Microsoft GUID; however, starting with systemd
v30, newly generated machine IDs do qualify as v4 UUIDs.</p><p>In order to maintain compatibility with existing
installations, an application requiring a UUID should decode the
machine ID, and then apply the following operations to turn it
into a valid OSF v4 UUID. With "<code class="literal">id</code>" being an
unsigned character array:</p><pre class="programlisting">/* Set UUID version to 4 --- truly random generation */
id[6] = (id[6] &amp; 0x0F) | 0x40;
/* Set the UUID variant to DCE */
id[8] = (id[8] &amp; 0x3F) | 0x80;</pre><p>(This code is inspired by
"<code class="literal">generate_random_uuid()</code>" of
<code class="filename">drivers/char/random.c</code> from the Linux kernel
sources.)</p></div><div class="refsect1"><a name="idm140598382811008"></a><h2 id="History">History<a class="headerlink" title="Permalink to this headline" href="#History"></a></h2><p>The simple configuration file format of
<code class="filename">/etc/machine-id</code> originates in the
<code class="filename">/var/lib/dbus/machine-id</code> file introduced by
D-Bus. In fact, this latter file might be a symlink to
<code class="varname">/etc/machine-id</code>.</p></div><div class="refsect1"><a name="idm140598382807984"></a><h2 id="See Also">See Also<a class="headerlink" title="Permalink to this headline" href="#See%20Also"></a></h2><p>
<a href="systemd.html"><span class="citerefentry"><span class="refentrytitle">systemd</span>(1)</span></a>,
<a href="systemd-machine-id-setup.html"><span class="citerefentry"><span class="refentrytitle">systemd-machine-id-setup</span>(1)</span></a>,
<a href="gethostid.html"><span class="citerefentry"><span class="refentrytitle">gethostid</span>(3)</span></a>,
<a href="hostname.html"><span class="citerefentry"><span class="refentrytitle">hostname</span>(5)</span></a>,
<a href="machine-info.html"><span class="citerefentry"><span class="refentrytitle">machine-info</span>(5)</span></a>,
<a href="os-release.html"><span class="citerefentry"><span class="refentrytitle">os-release</span>(5)</span></a>,
<a href="sd-id128.html"><span class="citerefentry"><span class="refentrytitle">sd-id128</span>(3)</span></a>,
<a href="sd_id128_get_machine.html"><span class="citerefentry"><span class="refentrytitle">sd_id128_get_machine</span>(3)</span></a>,
<a href="systemd-firstboot.html"><span class="citerefentry"><span class="refentrytitle">systemd-firstboot</span>(1)</span></a>
</p></div></div></body></html>