Debian Codegraph @

man/systemd-id128.xml

raw
1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
4 <!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
5
6 <refentry id="systemd-id128" xmlns:xi="http://www.w3.org/2001/XInclude">
7
8 <refentryinfo>
9 <title>systemd-id128</title>
10 <productname>systemd</productname>
11 </refentryinfo>
12
13 <refmeta>
14 <refentrytitle>systemd-id128</refentrytitle>
15 <manvolnum>1</manvolnum>
16 </refmeta>
17
18 <refnamediv>
19 <refname>systemd-id128</refname>
20 <refpurpose>Generate and print sd-128 identifiers</refpurpose>
21 </refnamediv>
22
23 <refsynopsisdiv>
24 <cmdsynopsis>
25 <command>systemd-id128</command>
26 <arg choice="opt" rep="repeat">OPTIONS</arg>
27 <arg choice="plain">new</arg>
28 </cmdsynopsis>
29
30 <cmdsynopsis>
31 <command>systemd-id128</command>
32 <arg choice="opt" rep="repeat">OPTIONS</arg>
33 <arg choice="plain">machine-id</arg>
34 </cmdsynopsis>
35
36 <cmdsynopsis>
37 <command>systemd-id128</command>
38 <arg choice="opt" rep="repeat">OPTIONS</arg>
39 <arg choice="plain">boot-id</arg>
40 </cmdsynopsis>
41
42 <cmdsynopsis>
43 <command>systemd-id128</command>
44 <arg choice="opt" rep="repeat">OPTIONS</arg>
45 <arg choice="plain">invocation-id</arg>
46 </cmdsynopsis>
47
48 <cmdsynopsis>
49 <command>systemd-id128</command>
50 <arg choice="opt" rep="repeat">OPTIONS</arg>
51 <arg choice="plain">var-partition-uuid</arg>
52 </cmdsynopsis>
53
54 <cmdsynopsis>
55 <command>systemd-id128</command>
56 <arg choice="opt" rep="repeat">OPTIONS</arg>
57 <arg choice="plain">show</arg>
58 <arg choice="opt" rep="repeat">NAME|UUID</arg>
59 </cmdsynopsis>
60 </refsynopsisdiv>
61
62 <refsect1>
63 <title>Description</title>
64
65 <para><command>id128</command> may be used to conveniently print
66 <citerefentry><refentrytitle>sd-id128</refentrytitle><manvolnum>3</manvolnum></citerefentry>
67 UUIDs. What identifier is printed depends on the specific verb.</para>
68
69 <para>With <command>new</command>, a new random identifier will be generated.</para>
70
71 <para>With <command>machine-id</command>, the identifier of the current machine will be
72 printed. See
73 <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
74 </para>
75
76 <para>With <command>boot-id</command>, the identifier of the current boot will be
77 printed.</para>
78
79 <para>With <command>invocation-id</command>, the identifier of the current service invocation
80 will be printed. This is available in systemd services. See
81 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
82 </para>
83
84 <para>With <command>show</command>, well-known IDs are printed (for now, only GPT partition type UUIDs),
85 along with brief identifier strings. When no arguments are specified, all known IDs are shown. When
86 arguments are specified, they may be the identifiers or ID values of one or more known IDs, which are
87 then printed with their name, or arbitrary IDs, which are then printed with a placeholder name. Combine
88 with <option>--uuid</option> to list the IDs in UUID style, i.e. the way GPT partition type UUIDs are
89 usually shown.</para>
90
91 <para><command>machine-id</command>, <command>boot-id</command>, and <command>show</command> may be
92 combined with the <option>--app-specific=<replaceable>app-id</replaceable></option> switch to generate
93 application-specific IDs. See
94 <citerefentry><refentrytitle>sd_id128_get_machine</refentrytitle><manvolnum>3</manvolnum></citerefentry>
95 for the discussion when this is useful. Support for <command>show --app-specific=</command> was added in
96 version 255.</para>
97
98 <para><command>var-partition-uuid</command> prints a UUID which, following the <ulink
99 url="https://uapi-group.org/specifications/specs/discoverable_partitions_specification">UAPI.2 Discoverable
100 Partitions Specification</ulink>, should be used as the GPT partition UUID for
101 <filename>/var/</filename>, being derived from the GPT partition type, keyed by the local
102 <filename>/etc/machine-id</filename>. Added in version 257.</para>
103 </refsect1>
104
105 <refsect1>
106 <title>Options</title>
107
108 <para>The following options are understood:</para>
109
110 <variablelist>
111 <varlistentry>
112 <term><option>-p</option></term>
113 <term><option>--pretty</option></term>
114
115 <listitem><para>Generate output as programming language snippets.</para>
116
117 <xi:include href="version-info.xml" xpointer="v240"/></listitem>
118 </varlistentry>
119
120 <varlistentry>
121 <term><option>-P</option></term>
122 <term><option>--value</option></term>
123
124 <listitem><para>Only print the value. May be combined with
125 <option>-u</option>/<option>--uuid</option>.</para>
126
127 <xi:include href="version-info.xml" xpointer="v255"/></listitem>
128 </varlistentry>
129
130 <varlistentry>
131 <term><option>-a <replaceable>app-id</replaceable></option></term>
132 <term><option>--app-specific=<replaceable>app-id</replaceable></option></term>
133
134 <listitem><para>With this option, identifiers will be printed that are the result of hashing the
135 application identifier <replaceable>app-id</replaceable> and another ID. The
136 <replaceable>app-id</replaceable> argument must be a valid sd-id128 string identifying the
137 application. When used with <command>machine-id</command>, the other ID will be the machine ID as
138 described in
139 <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry>, when
140 used with <command>boot-id</command>, the other ID will be the boot ID, and when used with
141 <command>show</command>, the other ID or IDs should be specified via the positional arguments.</para>
142
143 <xi:include href="version-info.xml" xpointer="v240"/>
144 </listitem>
145 </varlistentry>
146
147 <varlistentry>
148 <term><option>-u</option></term>
149 <term><option>--uuid</option></term>
150
151 <listitem><para>Generate output as a UUID formatted in the "canonical representation", with five
152 groups of digits separated by hyphens. See the Wikipedia entry for
153 <ulink url="https://en.wikipedia.org/wiki/Universally_unique_identifier#Format">Universally Unique Identifiers</ulink>
154 for more discussion.</para>
155
156 <xi:include href="version-info.xml" xpointer="v244"/></listitem>
157 </varlistentry>
158
159 <xi:include href="standard-options.xml" xpointer="no-pager" />
160 <xi:include href="standard-options.xml" xpointer="no-legend" />
161 <xi:include href="standard-options.xml" xpointer="json" />
162 <xi:include href="standard-options.xml" xpointer="j" />
163 <xi:include href="standard-options.xml" xpointer="help" />
164 <xi:include href="standard-options.xml" xpointer="version" />
165 </variablelist>
166 </refsect1>
167
168 <refsect1>
169 <title>Exit status</title>
170
171 <para>On success 0 is returned, and a non-zero failure code otherwise.</para>
172 </refsect1>
173
174 <refsect1>
175 <title>Examples</title>
176
177 <example>
178 <title>Show a well-known UUID</title>
179 <programlisting>
180 $ systemd-id128 show --value user-home
181 773f91ef66d449b5bd83d683bf40ad16
182
183 $ systemd-id128 show --value --uuid user-home
184 773f91ef-66d4-49b5-bd83-d683bf40ad16
185
186 $ systemd-id128 show 773f91ef-66d4-49b5-bd83-d683bf40ad16
187 NAME ID
188 user-home 773f91ef66d449b5bd83d683bf40ad16
189 </programlisting>
190 </example>
191
192 <example>
193 <title>Generate an application-specific UUID</title>
194
195 <programlisting>
196 $ systemd-id128 machine-id -u
197 3a9d668b-4db7-4939-8a4a-5e78a03bffb7
198
199 $ systemd-id128 new -u
200 1fb8f24b-02df-458d-9659-cc8ace68e28a
201
202 $ systemd-id128 machine-id -u -a 1fb8f24b-02df-458d-9659-cc8ace68e28a
203 47b82cb1-5339-43da-b2a6-1c350aef1bd1
204
205 $ systemd-id128 -Pu show 3a9d668b-4db7-4939-8a4a-5e78a03bffb7 \
206 -a 1fb8f24b-02df-458d-9659-cc8ace68e28a
207 47b82cb1-5339-43da-b2a6-1c350aef1bd1
208 </programlisting>
209
210 <para>On a given machine with the ID 3a9d668b-4db7-4939-8a4a-5e78a03bffb7, for the application
211 1fb8f24b-02df-458d-9659-cc8ace68e28a, we generate an application-specific machine ID
212 (47b82cb1-5339-43da-b2a6-1c350aef1bd1). If we want to later recreate the same calculation on a
213 different machine, we need to specify both IDs explicitly as parameters to <command>show</command>.
214 </para>
215 </example>
216 </refsect1>
217
218 <refsect1>
219 <title>See Also</title>
220 <para><simplelist type="inline">
221 <member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
222 <member><citerefentry><refentrytitle>sd-id128</refentrytitle><manvolnum>3</manvolnum></citerefentry></member>
223 <member><citerefentry><refentrytitle>sd_id128_get_machine</refentrytitle><manvolnum>3</manvolnum></citerefentry></member>
224 </simplelist></para>
225 </refsect1>
226
227 </refentry>