machine-id.html 6.17 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
<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>·
Michael Biebl's avatar
Michael Biebl committed
22
  <a href="../libudev/index.html">gudev </a><span style="float:right">systemd 215</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="idm214174731056"></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
Michael Biebl's avatar
Michael Biebl committed
23
                contains the unique machine ID of the local system
24
                that is set during installation. The machine ID is a
Michael Biebl's avatar
Michael Biebl committed
25 26 27 28
                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
29 30
                random source during system installation and stays
                constant for all subsequent boots. Optionally, for
Michael Biebl's avatar
Michael Biebl committed
31
                stateless systems, it is generated during runtime at
32
                boot if it is found to be empty.</p><p>The machine ID does not change based on user
Michael Biebl's avatar
Michael Biebl committed
33
                configuration or when hardware is replaced.</p><p>This machine ID adheres to the same format and
34 35 36
                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
Michael Biebl's avatar
Michael Biebl committed
37
                changes. Due to this and its greater length, it is
38 39
                a more useful replacement for the
                <a href="gethostid.html"><span class="citerefentry"><span class="refentrytitle">gethostid</span>(3)</span></a>
Michael Biebl's avatar
Michael Biebl committed
40
                call that POSIX specifies.</p><p>The
41 42
                <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
Michael Biebl's avatar
Michael Biebl committed
43
                machine ID at install time.</p></div><div class="refsect1"><a name="idm214175404608"></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
Michael Biebl's avatar
Michael Biebl committed
44 45 46
                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
47 48 49 50
                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
Michael Biebl's avatar
Michael Biebl committed
51
                "<code class="literal">id</code>" being an unsigned character
52 53 54 55
                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
Michael Biebl's avatar
Michael Biebl committed
56
                "<code class="literal">generate_random_uuid()</code>" of
57
                <code class="filename">drivers/char/random.c</code> from the
Michael Biebl's avatar
Michael Biebl committed
58
                Linux kernel sources.)</p></div><div class="refsect1"><a name="idm214178157136"></a><h2 id="History">History<a class="headerlink" title="Permalink to this headline" href="#History"></a></h2><p>The simple configuration file format of
59 60
                <code class="filename">/etc/machine-id</code> originates in the
                <code class="filename">/var/lib/dbus/machine-id</code> file
Michael Biebl's avatar
Michael Biebl committed
61
                introduced by D-Bus. In fact, this latter file might be a
62
                symlink to
Michael Biebl's avatar
Michael Biebl committed
63
                <code class="varname">/etc/machine-id</code>.</p></div><div class="refsect1"><a name="idm214177106384"></a><h2 id="See Also">See Also<a class="headerlink" title="Permalink to this headline" href="#See%20Also"></a></h2><p>
64 65 66 67 68 69 70 71 72
                          <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>
                  </p></div></div></body></html>