ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
Zbigniew Jędrzejewski-Szmek 35bb94
From 07ba9da0bc0d4e3309e766d3734ac56683d3298d Mon Sep 17 00:00:00 2001
Zbigniew Jędrzejewski-Szmek 35bb94
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Zbigniew Jędrzejewski-Szmek 35bb94
Date: Wed, 18 Oct 2017 18:47:34 +0200
Zbigniew Jędrzejewski-Szmek 35bb94
Subject: [PATCH] man: describe how machine-id should be initialized (#7051)
Zbigniew Jędrzejewski-Szmek 35bb94
Zbigniew Jędrzejewski-Szmek 35bb94
(cherry picked from commit 74a79c657e17fc43172a59f1f158d4a26aec2be1)
Zbigniew Jędrzejewski-Szmek 35bb94
---
Zbigniew Jędrzejewski-Szmek 35bb94
 man/machine-id.xml | 90 +++++++++++++++++++++++++++++++++++++++++-------------
Zbigniew Jędrzejewski-Szmek 35bb94
 1 file changed, 69 insertions(+), 21 deletions(-)
Zbigniew Jędrzejewski-Szmek 35bb94
Zbigniew Jędrzejewski-Szmek 35bb94
diff --git a/man/machine-id.xml b/man/machine-id.xml
Zbigniew Jędrzejewski-Szmek 35bb94
index 3c261bffcc..e434c89de9 100644
Zbigniew Jędrzejewski-Szmek 35bb94
--- a/man/machine-id.xml
Zbigniew Jędrzejewski-Szmek 35bb94
+++ b/man/machine-id.xml
Zbigniew Jędrzejewski-Szmek 35bb94
@@ -53,18 +53,26 @@
Zbigniew Jędrzejewski-Szmek 35bb94
   <refsect1>
Zbigniew Jędrzejewski-Szmek 35bb94
     <title>Description</title>
Zbigniew Jędrzejewski-Szmek 35bb94
 
Zbigniew Jędrzejewski-Szmek 35bb94
-    <para>The <filename>/etc/machine-id</filename> file contains the unique machine ID of the local
Zbigniew Jędrzejewski-Szmek 35bb94
-    system that is set during installation. The machine ID is a single newline-terminated,
Zbigniew Jędrzejewski-Szmek 35bb94
-    hexadecimal, 32-character, lowercase ID. When decoded from hexadecimal, this corresponds to a
Zbigniew Jędrzejewski-Szmek 35bb94
-    16-byte/128-bit value.</para>
Zbigniew Jędrzejewski-Szmek 35bb94
+    <para>The <filename>/etc/machine-id</filename> file contains the unique machine ID of
Zbigniew Jędrzejewski-Szmek 35bb94
+    the local system that is set during installation or boot. The machine ID is a single
Zbigniew Jędrzejewski-Szmek 35bb94
+    newline-terminated, hexadecimal, 32-character, lowercase ID. When decoded from
Zbigniew Jędrzejewski-Szmek 35bb94
+    hexadecimal, this corresponds to a 16-byte/128-bit value. This ID may not be all
Zbigniew Jędrzejewski-Szmek 35bb94
+    zeros.</para>
Zbigniew Jędrzejewski-Szmek 35bb94
 
Zbigniew Jędrzejewski-Szmek 35bb94
-    <para>The machine ID is usually generated from a random source
Zbigniew Jędrzejewski-Szmek 35bb94
-    during system installation and stays constant for all subsequent
Zbigniew Jędrzejewski-Szmek 35bb94
-    boots. Optionally, for stateless systems, it is generated during
Zbigniew Jędrzejewski-Szmek 35bb94
-    runtime at early boot if it is found to be empty.</para>
Zbigniew Jędrzejewski-Szmek 35bb94
+    <para>The machine ID is usually generated from a random source during system
Zbigniew Jędrzejewski-Szmek 35bb94
+    installation or first boot and stays constant for all subsequent boots. Optionally,
Zbigniew Jędrzejewski-Szmek 35bb94
+    for stateless systems, it is generated during runtime during early boot if necessary.
Zbigniew Jędrzejewski-Szmek 35bb94
+    </para>
Zbigniew Jędrzejewski-Szmek 35bb94
 
Zbigniew Jędrzejewski-Szmek 35bb94
-    <para>The machine ID does not change based on local or network configuration or when hardware is
Zbigniew Jędrzejewski-Szmek 35bb94
-    replaced. Due to this and its greater length, it is a more useful replacement for the
Zbigniew Jędrzejewski-Szmek 35bb94
+    <para>The machine ID may be set, for example when network booting, with the
Zbigniew Jędrzejewski-Szmek 35bb94
+    <varname>systemd.machine_id=</varname> kernel command line parameter or by passing the
Zbigniew Jędrzejewski-Szmek 35bb94
+    option <option>--machine-id=</option> to systemd. An ID is specified in this manner
Zbigniew Jędrzejewski-Szmek 35bb94
+    has higher priority and will be used instead of the ID stored in
Zbigniew Jędrzejewski-Szmek 35bb94
+    <filename>/etc/machine-id</filename>.</para>
Zbigniew Jędrzejewski-Szmek 35bb94
+
Zbigniew Jędrzejewski-Szmek 35bb94
+    <para>The machine ID does not change based on local or network configuration or when
Zbigniew Jędrzejewski-Szmek 35bb94
+    hardware is replaced. Due to this and its greater length, it is a more useful
Zbigniew Jędrzejewski-Szmek 35bb94
+    replacement for the
Zbigniew Jędrzejewski-Szmek 35bb94
     <citerefentry project='man-pages'><refentrytitle>gethostid</refentrytitle><manvolnum>3</manvolnum></citerefentry>
Zbigniew Jędrzejewski-Szmek 35bb94
     call that POSIX specifies.</para>
Zbigniew Jędrzejewski-Szmek 35bb94
 
Zbigniew Jędrzejewski-Szmek 35bb94
@@ -79,19 +87,59 @@
Zbigniew Jędrzejewski-Szmek 35bb94
     the original machine ID from the application-specific one. The
Zbigniew Jędrzejewski-Szmek 35bb94
     <citerefentry><refentrytitle>sd_id128_get_machine_app_specific</refentrytitle><manvolnum>3</manvolnum></citerefentry>
Zbigniew Jędrzejewski-Szmek 35bb94
     API provides an implementation of such an algorithm.</para>
Zbigniew Jędrzejewski-Szmek 35bb94
+  </refsect1>
Zbigniew Jędrzejewski-Szmek 35bb94
 
Zbigniew Jędrzejewski-Szmek 35bb94
-    <para>The
Zbigniew Jędrzejewski-Szmek 35bb94
+  <refsect1>
Zbigniew Jędrzejewski-Szmek 35bb94
+    <title>Initialization</title>
Zbigniew Jędrzejewski-Szmek 35bb94
+
Zbigniew Jędrzejewski-Szmek 35bb94
+    <para>Each machine should have a non-empty ID in normal operation. The ID of each
Zbigniew Jędrzejewski-Szmek 35bb94
+    machine should be unique. To achive those objectives,
Zbigniew Jędrzejewski-Szmek 35bb94
+    <filename>/etc/machine-id</filename> can be initialized in a few different ways.
Zbigniew Jędrzejewski-Szmek 35bb94
+    </para>
Zbigniew Jędrzejewski-Szmek 35bb94
+
Zbigniew Jędrzejewski-Szmek 35bb94
+    <para>For normal operating system installations, where a custom image is created for a
Zbigniew Jędrzejewski-Szmek 35bb94
+    specific machine, <filename>/etc/machine-id</filename> should be populated during
Zbigniew Jędrzejewski-Szmek 35bb94
+    installation.</para>
Zbigniew Jędrzejewski-Szmek 35bb94
+
Zbigniew Jędrzejewski-Szmek 35bb94
+    <para>
Zbigniew Jędrzejewski-Szmek 35bb94
     <citerefentry><refentrytitle>systemd-machine-id-setup</refentrytitle><manvolnum>1</manvolnum></citerefentry>
Zbigniew Jędrzejewski-Szmek 35bb94
-    tool may be used by installer tools to initialize the machine ID
Zbigniew Jędrzejewski-Szmek 35bb94
-    at install time. Use
Zbigniew Jędrzejewski-Szmek 35bb94
-    <citerefentry><refentrytitle>systemd-firstboot</refentrytitle><manvolnum>1</manvolnum></citerefentry>
Zbigniew Jędrzejewski-Szmek 35bb94
-    to initialize it on mounted (but not booted) system images.</para>
Zbigniew Jędrzejewski-Szmek 35bb94
-
Zbigniew Jędrzejewski-Szmek 35bb94
-    <para>The machine-id may also be set, for example when network
Zbigniew Jędrzejewski-Szmek 35bb94
-    booting, by setting the <varname>systemd.machine_id=</varname>
Zbigniew Jędrzejewski-Szmek 35bb94
-    kernel command line parameter or passing the option
Zbigniew Jędrzejewski-Szmek 35bb94
-    <option>--machine-id=</option> to systemd. A machine-id may not
Zbigniew Jędrzejewski-Szmek 35bb94
-    be set to all zeros.</para>
Zbigniew Jędrzejewski-Szmek 35bb94
+    may be used by installer tools to initialize the machine ID at install time, but
Zbigniew Jędrzejewski-Szmek 35bb94
+    <filename>/etc/machine-id</filename> may also be written using any other means.
Zbigniew Jędrzejewski-Szmek 35bb94
+    </para>
Zbigniew Jędrzejewski-Szmek 35bb94
+
Zbigniew Jędrzejewski-Szmek 35bb94
+    <para>For operating system images which are created once and used on multiple
Zbigniew Jędrzejewski-Szmek 35bb94
+    machines, for example for containers or in the cloud,
Zbigniew Jędrzejewski-Szmek 35bb94
+    <filename>/etc/machine-id</filename> should be an empty file in the generic file
Zbigniew Jędrzejewski-Szmek 35bb94
+    system image. An ID will be generated during boot and saved to this file if
Zbigniew Jędrzejewski-Szmek 35bb94
+    possible. Having an empty file in place is useful because it allows a temporary file
Zbigniew Jędrzejewski-Szmek 35bb94
+    to be bind-mounted over the real file, in case the image is used read-only.</para>
Zbigniew Jędrzejewski-Szmek 35bb94
+
Zbigniew Jędrzejewski-Szmek 35bb94
+    <para><citerefentry><refentrytitle>systemd-firstboot</refentrytitle><manvolnum>1</manvolnum></citerefentry>
Zbigniew Jędrzejewski-Szmek 35bb94
+    may be used to to initialize <filename>/etc/machine-id</filename> on mounted (but not
Zbigniew Jędrzejewski-Szmek 35bb94
+    booted) system images.</para>
Zbigniew Jędrzejewski-Szmek 35bb94
+
Zbigniew Jędrzejewski-Szmek 35bb94
+    <para>When a machine is booted with
Zbigniew Jędrzejewski-Szmek 35bb94
+    <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
Zbigniew Jędrzejewski-Szmek 35bb94
+    the ID of the machine will be established. If <varname>systemd.machine_id=</varname>
Zbigniew Jędrzejewski-Szmek 35bb94
+    or <option>--machine-id=</option> options (see first section) are specified, this
Zbigniew Jędrzejewski-Szmek 35bb94
+    value will be used. Otherwise, the value in <filename>/etc/machine-id</filename> will
Zbigniew Jędrzejewski-Szmek 35bb94
+    be used. If this file is empty or missing, <filename>systemd</filename> will attempt
Zbigniew Jędrzejewski-Szmek 35bb94
+    to use the D-Bus machine ID from <filename>/var/lib/dbus/machine-id</filename>, the
Zbigniew Jędrzejewski-Szmek 35bb94
+    value of the kernel command line option <varname>container_uuid</varname>, the KVM DMI
Zbigniew Jędrzejewski-Szmek 35bb94
+    <filename>product_uuid</filename> (on KVM systems), and finally a randomly generated
Zbigniew Jędrzejewski-Szmek 35bb94
+    UUID.</para>
Zbigniew Jędrzejewski-Szmek 35bb94
+
Zbigniew Jędrzejewski-Szmek 35bb94
+    <para>After the machine ID is established,
Zbigniew Jędrzejewski-Szmek 35bb94
+    <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
Zbigniew Jędrzejewski-Szmek 35bb94
+    will attempt to save it to <filename>/etc/machine-id</filename>. If this fails, it
Zbigniew Jędrzejewski-Szmek 35bb94
+    will attempt to bind-mount a temporary file over <filename>/etc/machine-id</filename>.
Zbigniew Jędrzejewski-Szmek 35bb94
+    It is an error if the file system is read-only and does not contain a (possibly empty)
Zbigniew Jędrzejewski-Szmek 35bb94
+    <filename>/etc/machine-id</filename> file.</para>
Zbigniew Jędrzejewski-Szmek 35bb94
+
Zbigniew Jędrzejewski-Szmek 35bb94
+    <para><citerefentry><refentrytitle>systemd-machine-id-commit.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
Zbigniew Jędrzejewski-Szmek 35bb94
+    will attempt to write the machine ID to the file system if
Zbigniew Jędrzejewski-Szmek 35bb94
+    <filename>/etc/machine-id</filename> or <filename>/etc</filename> are read-only during
Zbigniew Jędrzejewski-Szmek 35bb94
+    early boot but become writable later on.</para>
Zbigniew Jędrzejewski-Szmek 35bb94
   </refsect1>
Zbigniew Jędrzejewski-Szmek 35bb94
 
Zbigniew Jędrzejewski-Szmek 35bb94
   <refsect1>