Debian Codegraph @

man/os-release.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="os-release" xmlns:xi="http://www.w3.org/2001/XInclude">
7 <refentryinfo>
8 <title>os-release</title>
9 <productname>systemd</productname>
10 </refentryinfo>
11
12 <refmeta>
13 <refentrytitle>os-release</refentrytitle>
14 <manvolnum>5</manvolnum>
15 </refmeta>
16
17 <refnamediv>
18 <refname>os-release</refname>
19 <refname>initrd-release</refname>
20 <refname>extension-release</refname>
21 <refpurpose>Operating system identification</refpurpose>
22 </refnamediv>
23
24 <refsynopsisdiv>
25 <para><simplelist>
26 <member><filename>/etc/os-release</filename></member>
27 <member><filename>/usr/lib/os-release</filename></member>
28 <member><filename>/etc/initrd-release</filename></member>
29 <member><filename>/usr/lib/extension-release.d/extension-release.<replaceable>IMAGE</replaceable></filename></member>
30 </simplelist></para>
31 </refsynopsisdiv>
32
33 <refsect1>
34 <title>Description</title>
35
36 <para>The <filename>/etc/os-release</filename> and
37 <filename>/usr/lib/os-release</filename> files contain operating
38 system identification data.</para>
39
40 <para>The format of <filename>os-release</filename> is a newline-separated list of
41 environment-like shell-compatible variable assignments. It is possible to source the configuration from
42 Bourne shell scripts, however, beyond mere variable assignments, no shell features are supported (this
43 means variable expansion is explicitly not supported), allowing applications to read the file without
44 implementing a shell compatible execution engine. Variable assignment values must be enclosed in double
45 or single quotes if they include spaces, semicolons or other special characters outside of A–Z, a–z,
46 0–9. (Assignments that do not include these special characters may be enclosed in quotes too, but this is
47 optional.) Shell special characters ("$", quotes, backslash, backtick) must be escaped with backslashes,
48 following shell style. All strings should be in UTF-8 encoding, and non-printable characters should not
49 be used. Concatenation of multiple individually quoted strings is not supported. Lines beginning with "#"
50 are treated as comments. Blank lines are permitted and ignored.</para>
51
52 <para>The file <filename>/etc/os-release</filename> takes
53 precedence over <filename>/usr/lib/os-release</filename>.
54 Applications should check for the former, and exclusively use its
55 data if it exists, and only fall back to
56 <filename>/usr/lib/os-release</filename> if that is missing.
57 Applications should not combine the data from both files.
58 <filename>/usr/lib/os-release</filename> is the recommended
59 place to store OS release information as part of vendor trees.
60 <filename>/etc/os-release</filename> should be a relative symlink
61 to <filename>/usr/lib/os-release</filename>, to provide
62 compatibility with applications only looking at
63 <filename>/etc/</filename>. A relative symlink instead of an
64 absolute symlink is necessary to avoid breaking the link in a
65 chroot or initrd environment.</para>
66
67 <para><filename>os-release</filename> contains data that is
68 defined by the operating system vendor and should generally not be
69 changed by the administrator.</para>
70
71 <para>As this file only encodes names and identifiers it should
72 not be localized.</para>
73
74 <para>The <filename>/etc/os-release</filename> and
75 <filename>/usr/lib/os-release</filename> files might be symlinks
76 to other files, but it is important that the file is available
77 from earliest boot on, and hence must be located on the root file
78 system.</para>
79
80 <para><filename>os-release</filename> must not contain repeating keys. Nevertheless, readers should pick
81 the entries later in the file in case of repeats, similarly to how a shell sourcing the file would. A
82 reader may warn about repeating entries.</para>
83
84 <para>For a longer rationale for <filename>os-release</filename>
85 please refer to the <ulink
86 url="https://0pointer.de/blog/projects/os-release">Announcement of <filename>/etc/os-release</filename></ulink>.</para>
87
88 <refsect2>
89 <title><filename>/etc/initrd-release</filename></title>
90
91 <para>In the <ulink url="https://docs.kernel.org/admin-guide/initrd.html">initrd</ulink>
92 and exitrd,
93 <filename>/etc/initrd-release</filename> plays the same role as <filename>os-release</filename> in the
94 main system. Additionally, the presence of that file means that the system is in the initrd/exitrd phase.
95 <filename>/etc/os-release</filename> should be symlinked to <filename>/etc/initrd-release</filename>
96 (or vice versa), so programs that only look for <filename>/etc/os-release</filename> (as described
97 above) work correctly.</para>
98
99 <para>The rest of this document that talks about <filename>os-release</filename> should be understood
100 to apply to <filename>initrd-release</filename> too.</para>
101 </refsect2>
102
103 <refsect2>
104 <title><filename>/usr/lib/extension-release.d/extension-release.<replaceable>IMAGE</replaceable></filename></title>
105
106 <para><filename>/usr/lib/extension-release.d/extension-release.<replaceable>IMAGE</replaceable></filename>
107 plays the same role for extension images as <filename>os-release</filename> for the main system, and
108 follows the syntax and rules as described in the <ulink
109 url="https://systemd.io/PORTABLE_SERVICES">Portable Services</ulink> page. The purpose of this
110 file is to identify the extension and to allow the operating system to verify that the extension image
111 matches the base OS. This is typically implemented by checking that the extension <varname>ID=</varname>
112 option either matches the host <varname>ID=</varname> option or is included the host <varname>ID_LIKE=</varname>
113 option, and either <varname>SYSEXT_LEVEL=</varname> exists and matches too, or if it is not present,
114 <varname>VERSION_ID=</varname> exists and matches. This ensures ABI/API compatibility between the
115 layers and prevents merging of an incompatible image in an overlay.</para>
116
117 <para>In order to identify the extension image itself, the same fields defined below can be added to the
118 <filename>extension-release</filename> file with a <varname>SYSEXT_</varname> prefix (to disambiguate
119 from fields used to match on the base image). E.g.: <varname>SYSEXT_ID=myext</varname>,
120 <varname>SYSEXT_VERSION_ID=1.2.3</varname>.</para>
121
122 <para>In the <filename>extension-release.<replaceable>IMAGE</replaceable></filename> filename, the
123 <replaceable>IMAGE</replaceable> part must exactly match the file name of the containing image with the
124 suffix removed. In case it is not possible to guarantee that an image file name is stable and does not
125 change between the build and the deployment phases, it is possible to relax this check: if exactly one
126 file whose name matches <literal><filename>extension-release.*</filename></literal> is present in this
127 directory, and the file is tagged with a <varname>user.extension-release.strict</varname>
128 <citerefentry project='man-pages'><refentrytitle>xattr</refentrytitle><manvolnum>7</manvolnum></citerefentry> set to the
129 string <literal>0</literal>, it will be used instead.</para>
130
131 <para>The rest of this document that talks about <filename>os-release</filename> should be understood
132 to apply to <filename>extension-release</filename> too.</para>
133 </refsect2>
134 </refsect1>
135
136 <refsect1>
137 <title>Options</title>
138
139 <para>The following OS identifications parameters may be set using
140 <filename>os-release</filename>:</para>
141
142 <refsect2>
143 <title>General information identifying the operating system</title>
144
145 <variablelist class='environment-variables'>
146 <varlistentry>
147 <term><varname>NAME=</varname></term>
148
149 <listitem><para>A string identifying the operating system, without a version component, and
150 suitable for presentation to the user. If not set, a default of <literal>NAME=Linux</literal> may
151 be used.</para>
152
153 <para>Examples: <literal>NAME=Fedora</literal>, <literal>NAME="Debian GNU/Linux"</literal>.
154 </para></listitem>
155 </varlistentry>
156
157 <varlistentry>
158 <term><varname>ID=</varname></term>
159
160 <listitem><para>A lower-case string (no spaces or other characters outside of 0–9, a–z, ".", "_"
161 and "-") identifying the operating system, excluding any version information and suitable for
162 processing by scripts or usage in generated filenames. If not set, a default of
163 <literal>ID=linux</literal> may be used. Note that even though this string may not include
164 characters that require shell quoting, quoting may nevertheless be used.</para>
165
166 <para>Examples: <literal>ID=fedora</literal>, <literal>ID=debian</literal>.</para></listitem>
167 </varlistentry>
168
169 <varlistentry>
170 <term><varname>ID_LIKE=</varname></term>
171
172 <listitem><para>A space-separated list of operating system identifiers in the same syntax as the
173 <varname>ID=</varname> setting. It should list identifiers of operating systems that are closely
174 related to the local operating system in regards to packaging and programming interfaces, for
175 example listing one or more OS identifiers the local OS is a derivative from. An OS should
176 generally only list other OS identifiers it itself is a derivative of, and not any OSes that are
177 derived from it, though symmetric relationships are possible. Build scripts and similar should
178 check this variable if they need to identify the local operating system and the value of
179 <varname>ID=</varname> is not recognized. Operating systems should be listed in order of how
180 closely the local operating system relates to the listed ones, starting with the closest. This
181 field is optional.</para>
182
183 <para>Examples: for an operating system with <literal>ID=centos</literal>, an assignment of
184 <literal>ID_LIKE="rhel fedora"</literal> would be appropriate. For an operating system with
185 <literal>ID=ubuntu</literal>, an assignment of <literal>ID_LIKE=debian</literal> is appropriate.
186 </para></listitem>
187 </varlistentry>
188
189 <varlistentry>
190 <term><varname>PRETTY_NAME=</varname></term>
191
192 <listitem><para>A pretty operating system name in a format suitable for presentation to the
193 user. May or may not contain a release code name or OS version of some kind, as suitable. If not
194 set, a default of <literal>PRETTY_NAME="Linux"</literal> may be used.</para>
195
196 <para>Example: <literal>PRETTY_NAME="Fedora 17 (Beefy Miracle)"</literal></para></listitem>
197 </varlistentry>
198
199 <varlistentry>
200 <term><varname>FANCY_NAME=</varname></term>
201
202 <listitem><para>Similar to <varname>PRETTY_NAME=</varname>, but may contain ANSI sequences and
203 fancy UTF-8 characters such as emojis. If defined this shall preferably used when displaying the OS
204 name on modern terminal emulators. If the terminal emulator does not support emojis,
205 <varname>PRETTY_NAME=</varname> shall be shown instead, possibly with
206 <varname>ANSI_COLOR=</varname> coloring. Use <literal>\033</literal> to encode the ESC
207 character and <literal>\\</literal> to encode the backslash character.</para>
208
209 <!-- NB: the code actually does a full blown C style unescaping, but we are not going to mention
210 this here: people may add ANSI sequences, but maybe not the full expressivity of ASCII control
211 characters. -->
212
213 <para>Unlike <varname>PRETTY_NAME=</varname> this field must not contain information that is
214 present in other fields, in particular the version (already specified in
215 <varname>VERSION=</varname>) or the codename (already specified in
216 <varname>VERSION_CODENAME=</varname>).</para>
217
218 <para>Example:
219 <literal>FANCY_NAME="🍅 \033[31mTomato\033[0;1mOS\033[0m"</literal></para>
220
221 <xi:include href="version-info.xml" xpointer="v260"/></listitem>
222 </varlistentry>
223
224 <varlistentry>
225 <term><varname>CPE_NAME=</varname></term>
226
227 <listitem><para>A CPE name for the operating system, in URI binding syntax, following the <ulink
228 url="http://scap.nist.gov/specifications/cpe/">Common Platform Enumeration Specification</ulink> as
229 proposed by the NIST. This field is optional.</para>
230
231 <para>Example: <literal>CPE_NAME="cpe:/o:fedoraproject:fedora:17"</literal></para></listitem>
232 </varlistentry>
233
234 <varlistentry>
235 <term><varname>VARIANT=</varname></term>
236
237 <listitem><para>A string identifying a specific variant or edition of the operating system suitable
238 for presentation to the user. This field may be used to inform the user that the configuration of
239 this system is subject to a specific divergent set of rules or default configuration settings. This
240 field is optional and may not be implemented on all systems.</para>
241
242 <para>Examples: <literal>VARIANT="Server Edition"</literal>, <literal>VARIANT="Smart Refrigerator
243 Edition"</literal>.</para>
244
245 <para>Note: this field is for display purposes only. The <varname>VARIANT_ID</varname> field should
246 be used for making programmatic decisions.</para>
247
248 <xi:include href="version-info.xml" xpointer="v220"/></listitem>
249 </varlistentry>
250
251 <varlistentry>
252 <term><varname>VARIANT_ID=</varname></term>
253
254 <listitem><para>A lower-case string (no spaces or other characters outside of 0–9, a–z, ".", "_" and
255 "-"), identifying a specific variant or edition of the operating system. This may be interpreted by
256 other packages in order to determine a divergent default configuration. This field is optional and
257 may not be implemented on all systems.</para>
258
259 <para>Examples: <literal>VARIANT_ID=server</literal>, <literal>VARIANT_ID=embedded</literal>.
260 </para>
261
262 <xi:include href="version-info.xml" xpointer="v220"/></listitem>
263 </varlistentry>
264 </variablelist>
265 </refsect2>
266
267 <refsect2>
268 <title>Information about the version of the operating system</title>
269
270 <variablelist class='environment-variables'>
271 <varlistentry>
272 <term><varname>VERSION=</varname></term>
273
274 <listitem><para>A string identifying the operating system version, excluding any OS name
275 information, possibly including a release code name, and suitable for presentation to the
276 user. This field is optional.</para>
277
278 <para>Examples: <literal>VERSION=17</literal>, <literal>VERSION="17 (Beefy Miracle)"</literal>.
279 </para></listitem>
280 </varlistentry>
281
282 <varlistentry>
283 <term><varname>VERSION_ID=</varname></term>
284
285 <listitem><para>A lower-case string (mostly numeric, no spaces or other characters outside of 0–9,
286 a–z, ".", "_" and "-") identifying the operating system version, excluding any OS name information
287 or release code name, and suitable for processing by scripts or usage in generated filenames. This
288 field is optional.</para>
289
290 <para>Examples: <literal>VERSION_ID=17</literal>, <literal>VERSION_ID=11.04</literal>.
291 </para></listitem>
292 </varlistentry>
293
294 <varlistentry>
295 <term><varname>VERSION_CODENAME=</varname></term>
296
297 <listitem><para>A lower-case string (no spaces or other characters outside of 0–9, a–z, ".", "_"
298 and "-") identifying the operating system release code name, excluding any OS name information or
299 release version, and suitable for processing by scripts or usage in generated filenames. This field
300 is optional and may not be implemented on all systems.</para>
301
302 <para>Examples: <literal>VERSION_CODENAME=buster</literal>,
303 <literal>VERSION_CODENAME=xenial</literal>.</para>
304
305 <xi:include href="version-info.xml" xpointer="v231"/></listitem>
306 </varlistentry>
307
308 <varlistentry>
309 <term><varname>BUILD_ID=</varname></term>
310
311 <listitem><para>A string uniquely identifying the system image originally used as the installation
312 base. In most cases, <varname>VERSION_ID</varname> or
313 <varname>IMAGE_ID</varname>+<varname>IMAGE_VERSION</varname> are updated when the entire system
314 image is replaced during an update. <varname>BUILD_ID</varname> may be used in distributions where
315 the original installation image version is important: <varname>VERSION_ID</varname> would change
316 during incremental system updates, but <varname>BUILD_ID</varname> would not. This field is
317 optional.</para>
318
319 <para>Examples: <literal>BUILD_ID="2013-03-20.3"</literal>, <literal>BUILD_ID=201303203</literal>.
320 </para>
321
322 <xi:include href="version-info.xml" xpointer="v200"/></listitem>
323 </varlistentry>
324
325 <varlistentry>
326 <term><varname>IMAGE_ID=</varname></term>
327
328 <listitem><para> A lower-case string (no spaces or other characters outside of 0–9, a–z, ".", "_"
329 and "-"), identifying a specific image of the operating system. This is supposed to be used for
330 environments where OS images are prepared, built, shipped and updated as comprehensive, consistent
331 OS images. This field is optional and may not be implemented on all systems, in particularly not on
332 those that are not managed via images but put together and updated from individual packages and on
333 the local system.</para>
334
335 <para>Examples: <literal>IMAGE_ID=vendorx-cashier-system</literal>,
336 <literal>IMAGE_ID=netbook-image</literal>.</para>
337
338 <xi:include href="version-info.xml" xpointer="v249"/></listitem>
339 </varlistentry>
340
341 <varlistentry>
342 <term><varname>IMAGE_VERSION=</varname></term>
343
344 <listitem><para>A lower-case string (mostly numeric, no spaces or other characters outside of 0–9,
345 a–z, ".", "_" and "-") identifying the OS image version. This is supposed to be used together with
346 <varname>IMAGE_ID</varname> described above, to discern different versions of the same image.
347 </para>
348
349 <para>Examples: <literal>IMAGE_VERSION=33</literal>, <literal>IMAGE_VERSION=47.1rc1</literal>.
350 </para>
351
352 <xi:include href="version-info.xml" xpointer="v249"/></listitem>
353 </varlistentry>
354
355 <varlistentry>
356 <term><varname>RELEASE_TYPE=</varname></term>
357
358 <listitem><para>A lower-case string (no spaces or other characters outside of 0-9, a-z, ".",
359 "_", and "-"), describing what kind of release this version of the OS is. Known values follow:
360 </para>
361
362 <itemizedlist>
363 <listitem><para><literal>stable</literal> is for normal releases of the system, suitable for
364 production use. Generally, stable releases become end-of-life soon after the next major stable
365 release is out, although this might not be the case if, for example, a distribution adopts a
366 rolling release model and still be production ready. Examples include Fedora 40, Ubuntu 23.10,
367 OpenSUSE Tumbleweed, and Arch Linux.</para></listitem>
368
369 <listitem><para><literal>lts</literal> is for long term support releases of the system, suitable
370 for production use and supported for an extended period of time. Generally, LTS releases
371 continue to receive support even if newer major releases of the distribution are available.
372 Examples include Ubuntu 24.04, Debian 12 Bookworm, and RHEL 9.4.</para></listitem>
373
374 <listitem><para><literal>development</literal> is for unstable versions of the system,
375 unsuitable for production use, such as alpha, beta, or rolling unstable releases. Examples
376 include Fedora Rawhide, Debian Testing, Fedora 40 Beta, and GNOME OS Nightly.</para></listitem>
377
378 <listitem><para><literal>experiment</literal> is for experimental builds of the system, created
379 specifically to test some work-in-progress feature. This is meant to be used in combination with
380 <varname>EXPERIMENT=</varname>.</para></listitem>
381 </itemizedlist>
382
383 <para>If unset, or an unknown value, assume that the release is <literal>stable</literal>.</para>
384
385 <para>Examples: <literal>RELEASE_TYPE=development</literal>, <literal>RELEASE_TYPE=lts</literal>.
386 </para>
387
388 <xi:include href="version-info.xml" xpointer="v257"/></listitem>
389 </varlistentry>
390 </variablelist>
391
392 <para>To summarize: if the image updates are built and shipped as comprehensive units,
393 <varname>IMAGE_ID</varname>+<varname>IMAGE_VERSION</varname> is the best fit. Otherwise, if updates
394 eventually completely replace previously installed contents, as in a typical binary distribution,
395 <varname>VERSION_ID</varname> should be used to identify major releases of the operating system.
396 <varname>BUILD_ID</varname> may be used instead or in addition to <varname>VERSION_ID</varname> when
397 the original system image version is important.</para>
398 </refsect2>
399
400 <refsect2>
401 <title>Presentation information and links</title>
402
403 <variablelist class='environment-variables'>
404 <varlistentry>
405 <term><varname>HOME_URL=</varname></term>
406 <term><varname>DOCUMENTATION_URL=</varname></term>
407 <term><varname>SUPPORT_URL=</varname></term>
408 <term><varname>BUG_REPORT_URL=</varname></term>
409 <term><varname>PRIVACY_POLICY_URL=</varname></term>
410
411 <listitem><para>Links to resources on the Internet related to the operating system.
412 <varname>HOME_URL=</varname> should refer to the homepage of the operating system, or alternatively
413 some homepage of the specific version of the operating system.
414 <varname>DOCUMENTATION_URL=</varname> should refer to the main documentation page for this
415 operating system. <varname>SUPPORT_URL=</varname> should refer to the main support page for the
416 operating system, if there is any. This is primarily intended for operating systems which vendors
417 provide support for. <varname>BUG_REPORT_URL=</varname> should refer to the main bug reporting page
418 for the operating system, if there is any. This is primarily intended for operating systems that
419 rely on community QA. <varname>PRIVACY_POLICY_URL=</varname> should refer to the main privacy
420 policy page for the operating system, if there is any. These settings are optional, and providing
421 only some of these settings is common. These URLs are intended to be exposed in "About this system"
422 UIs behind links with captions such as "About this Operating System", "Obtain Support", "Report a
423 Bug", or "Privacy Policy". The values should be in <ulink
424 url="https://tools.ietf.org/html/rfc3986">RFC3986 format</ulink>, and should be
425 <literal>http:</literal> or <literal>https:</literal> URLs, and possibly <literal>mailto:</literal>
426 or <literal>tel:</literal>. Only one URL shall be listed in each setting. If multiple resources
427 need to be referenced, it is recommended to provide an online landing page linking all available
428 resources.</para>
429
430 <para>Examples: <literal>HOME_URL="https://fedoraproject.org/"</literal>,
431 <literal>BUG_REPORT_URL="https://bugzilla.redhat.com/"</literal>.</para></listitem>
432 </varlistentry>
433
434 <varlistentry>
435 <term><varname>SUPPORT_END=</varname></term>
436
437 <listitem><para>The date at which support for this version of the OS ends. (What exactly "lack of
438 support" means varies between vendors, but generally users should assume that updates, including
439 security fixes, will not be provided.) The value is a date in the ISO 8601 format
440 <literal>YYYY-MM-DD</literal>, and specifies the first day on which support <emphasis>is
441 not</emphasis> provided.</para>
442
443 <para>For example, <literal>SUPPORT_END=2001-01-01</literal> means that the system was supported
444 until the end of the last day of the previous millennium.</para>
445
446 <xi:include href="version-info.xml" xpointer="v252"/></listitem>
447 </varlistentry>
448
449 <varlistentry>
450 <term><varname>LOGO=</varname></term>
451
452 <listitem><para>A string, specifying the name of an icon as defined by <ulink
453 url="https://standards.freedesktop.org/icon-theme-spec/latest">freedesktop.org Icon Theme
454 Specification</ulink>. This can be used by graphical applications to display an operating system's
455 or distributor's logo. This field is optional and may not necessarily be implemented on all
456 systems.</para>
457
458 <para>Examples: <literal>LOGO=fedora-logo</literal>, <literal>LOGO=distributor-logo-opensuse</literal>
459 </para>
460
461 <xi:include href="version-info.xml" xpointer="v240"/></listitem>
462 </varlistentry>
463
464 <varlistentry>
465 <term><varname>ANSI_COLOR=</varname></term>
466
467 <listitem><para>A suggested presentation (foreground) text color when showing the OS name on the
468 console. This should be specified as string suitable for inclusion in the ESC [ m ANSI/ECMA-48
469 escape code for setting graphical rendition. This field is optional.</para>
470
471 <para>Examples: <literal>ANSI_COLOR="0;31"</literal> for red, <literal>ANSI_COLOR="1;34"</literal>
472 for light blue, or <literal>ANSI_COLOR="0;38;2;60;110;180"</literal> for Fedora blue.
473 </para></listitem>
474 </varlistentry>
475
476 <varlistentry>
477 <term><varname>ANSI_COLOR_REVERSE=</varname></term>
478
479 <listitem><para>Similar to <varname>ANSI_COLOR=</varname>, but should encode the desired
480 presentation color as background color, along with a suitable foreground color. This is may be used
481 by console applications to set off "chrome" UI elements from the main terminal contents. This field
482 is optional.</para>
483
484 <xi:include href="version-info.xml" xpointer="v259"/></listitem>
485 </varlistentry>
486
487 <varlistentry>
488 <term><varname>VENDOR_NAME=</varname></term>
489
490 <listitem><para>The name of the OS vendor. This is the name of the organization or company which
491 produces the OS. This field is optional.</para>
492
493 <para>This name is intended to be exposed in "About this system" UIs or software update UIs when
494 needed to distinguish the OS vendor from the OS itself. It is intended to be human-readable.</para>
495
496 <para>Examples: <literal>VENDOR_NAME="Fedora Project"</literal> for Fedora Linux,
497 <literal>VENDOR_NAME="Canonical"</literal> for Ubuntu.</para>
498
499 <xi:include href="version-info.xml" xpointer="v254"/></listitem>
500 </varlistentry>
501
502 <varlistentry>
503 <term><varname>VENDOR_URL=</varname></term>
504
505 <listitem><para>The homepage of the OS vendor. This field is optional. The
506 <varname>VENDOR_NAME=</varname> field should be set if this one is, although clients must be
507 robust against either field not being set.</para>
508
509 <para>The value should be in <ulink
510 url="https://tools.ietf.org/html/rfc3986">RFC3986 format</ulink>, and should be
511 <literal>http:</literal> or <literal>https:</literal> URLs. Only one URL shall be listed in the
512 setting.</para>
513
514 <para>Examples: <literal>VENDOR_URL="https://fedoraproject.org/"</literal>,
515 <literal>VENDOR_URL="https://canonical.com/"</literal>.</para>
516
517 <xi:include href="version-info.xml" xpointer="v254"/></listitem>
518 </varlistentry>
519 <varlistentry>
520 <term><varname>EXPERIMENT=</varname></term>
521
522 <listitem><para>A human-presentable description of what makes this build of the OS experimental.
523 This field is optional. The <varname>RELEASE_TYPE</varname> field should be set to <literal>experiment</literal>
524 if this field is set, otherwise clients should ignore this field.</para>
525
526 <para>This description is intended to be exposed at system installation time, or in "About this system" UIs,
527 to warn the user that they're installing/running an experimental build of the OS. If <varname>RELEASE_TYPE</varname>
528 is <literal>experiment</literal> but this field is unset, the UI should still warn the user, but it
529 will be unable to explain what exactly is experimental about the current build of the OS.</para>
530
531 <para>Examples: <literal>EXPERIMENT="Switch to DNF5"</literal> for an experimental build of Fedora
532 Linux made to test DNF5, <literal>EXPERIMENT="Port to Apple M3 chip"</literal> for experimental
533 builds of Asahi Linux ported to the Apple M3 SoC,
534 <literal>EXPERIMENT="Mutter !1441: Dynamic triple/double buffering (v4)"</literal> for builds of GNOME
535 OS created by Mutter's CI for merge request !1441.</para>
536
537 <xi:include href="version-info.xml" xpointer="v257"/></listitem>
538 </varlistentry>
539
540 <varlistentry>
541 <term><varname>EXPERIMENT_URL=</varname></term>
542
543 <listitem><para>The main informational page about what makes the current OS build experimental, where users
544 can learn more about the experiment's status and potentially leave feedback. This field is optional. The
545 <varname>EXPERIMENT=</varname> field should be set if this one is, although clients must be robust against
546 either field not being set.</para>
547
548 <para>The value should be in <ulink
549 url="https://tools.ietf.org/html/rfc3986">RFC3986 format</ulink>, and should be
550 <literal>http:</literal> or <literal>https:</literal> URLs. Only one URL shall be listed in the
551 setting.</para>
552
553 <para>Examples, corresponding to the examples above in <varname>EXPERIMENT=</varname>:
554 <literal>EXPERIMENT_URL="https://fedoraproject.org/wiki/Changes/SwitchToDnf5"</literal>,
555 <literal>EXPERIMENT_URL="https://github.com/AsahiLinux/docs/wiki/M3-Series-Feature-Support"</literal>,
556 <literal>EXPERIMENT_URL="https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1441"</literal>.</para>
557
558 <xi:include href="version-info.xml" xpointer="v257"/></listitem>
559 </varlistentry>
560 </variablelist>
561 </refsect2>
562
563 <refsect2>
564 <title>Distribution-level defaults and metadata</title>
565
566 <variablelist class='environment-variables'>
567 <varlistentry>
568 <term><varname>DEFAULT_HOSTNAME=</varname></term>
569
570 <listitem><para>A string specifying the hostname if
571 <citerefentry><refentrytitle>hostname</refentrytitle><manvolnum>5</manvolnum></citerefentry> is not
572 present and no other configuration source specifies the hostname. Must be either a single DNS label
573 (a string composed of 7-bit ASCII lower-case characters and no spaces or dots, limited to the
574 format allowed for DNS domain name labels), or a sequence of such labels separated by single dots
575 that forms a valid DNS FQDN. The hostname must be at most 64 characters, which is a Linux
576 limitation (DNS allows longer names).</para>
577
578 <xi:include href="hostname.xml" xpointer="question-mark-hostname-pattern"/>
579
580 <para>See <citerefentry><refentrytitle>org.freedesktop.hostname1</refentrytitle><manvolnum>5</manvolnum></citerefentry>
581 for a description of how
582 <citerefentry><refentrytitle>systemd-hostnamed.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
583 determines the fallback hostname.</para>
584
585 <xi:include href="version-info.xml" xpointer="v248"/></listitem>
586 </varlistentry>
587
588 <varlistentry>
589 <term><varname>ARCHITECTURE=</varname></term>
590 <listitem><para>A string that specifies which CPU architecture the userspace binaries require.
591 The architecture identifiers are the same as for <varname>ConditionArchitecture=</varname>
592 described in <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
593 The field is optional and should only be used when just single architecture is supported.
594 It may provide redundant information when used in a GPT partition with a GUID type that already
595 encodes the architecture. If this is not the case, the architecture should be specified in
596 e.g., an extension image, to prevent an incompatible host from loading it.
597 </para>
598
599 <xi:include href="version-info.xml" xpointer="v252"/></listitem>
600 </varlistentry>
601
602 <varlistentry>
603 <term><varname>SYSEXT_LEVEL=</varname></term>
604
605 <listitem><para>A lower-case string (mostly numeric, no spaces or other characters outside of 0–9,
606 a–z, ".", "_" and "-") identifying the operating system extensions support level, to indicate which
607 extension images are supported. See <filename>/usr/lib/extension-release.d/extension-release.<replaceable>IMAGE</replaceable></filename>,
608 <ulink url="https://docs.kernel.org/admin-guide/initrd.html">initrd</ulink> and
609 <citerefentry><refentrytitle>systemd-sysext</refentrytitle><manvolnum>8</manvolnum></citerefentry>)
610 for more information.</para>
611
612 <para>Examples: <literal>SYSEXT_LEVEL=2</literal>, <literal>SYSEXT_LEVEL=15.14</literal>.
613 </para>
614
615 <xi:include href="version-info.xml" xpointer="v248"/></listitem>
616 </varlistentry>
617
618 <varlistentry>
619 <term><varname>CONFEXT_LEVEL=</varname></term>
620
621 <listitem><para>Semantically the same as <varname>SYSEXT_LEVEL=</varname> but for confext images.
622 See <filename>/etc/extension-release.d/extension-release.<replaceable>IMAGE</replaceable></filename>
623 for more information.</para>
624
625 <para>Examples: <literal>CONFEXT_LEVEL=2</literal>, <literal>CONFEXT_LEVEL=15.14</literal>.
626 </para>
627
628 <xi:include href="version-info.xml" xpointer="v254"/></listitem>
629 </varlistentry>
630
631 <varlistentry>
632 <term><varname>SYSEXT_SCOPE=</varname></term>
633 <listitem><para>Takes a space-separated list of one or more of the strings
634 <literal>system</literal>, <literal>initrd</literal> and <literal>portable</literal>. This field is
635 only supported in <filename>extension-release.d/</filename> files and indicates what environments
636 the system extension is applicable to: i.e. to regular systems, to initrds and exitrds, or to
637 portable service images. If not specified, <literal>SYSEXT_SCOPE=system portable</literal> is
638 implied, i.e. any system extension without this field is applicable to regular systems and to
639 portable service environments, but not to initrd/exitrd environments.</para>
640
641 <xi:include href="version-info.xml" xpointer="v250"/></listitem>
642 </varlistentry>
643
644 <varlistentry>
645 <term><varname>CONFEXT_SCOPE=</varname></term>
646
647 <listitem><para>Semantically the same as <varname>SYSEXT_SCOPE=</varname> but for confext images.</para>
648
649 <xi:include href="version-info.xml" xpointer="v254"/></listitem>
650 </varlistentry>
651
652 <varlistentry>
653 <term><varname>PORTABLE_PREFIXES=</varname></term>
654 <listitem><para>Takes a space-separated list of one or more valid prefix match strings for the
655 <ulink url="https://systemd.io/PORTABLE_SERVICES">Portable Services</ulink> logic.
656 This field serves two purposes: it is informational, identifying portable service images as such
657 (and thus allowing them to be distinguished from other OS images, such as bootable system images).
658 It is also used when a portable service image is attached: the specified or implied portable
659 service prefix is checked against the list specified here, to enforce restrictions how images may
660 be attached to a system.</para>
661
662 <xi:include href="version-info.xml" xpointer="v250"/></listitem>
663 </varlistentry>
664
665 <varlistentry>
666 <term><varname>PORTABLE_SCOPE=</varname></term>
667 <listitem><para>Specifies the scope of the portable service. Takes one of <literal>system</literal>,
668 <literal>user</literal>, or <literal>any</literal>. When set to <literal>system</literal>, the
669 portable service can only be attached to the system instance of <command>systemd-portabled</command>.
670 When set to <literal>user</literal>, the portable service can only be attached to the user instance
671 of <command>systemd-portabled</command>. When set to <literal>any</literal>, the portable service
672 can be attached to both the system and user instances of <command>systemd-portabled</command>.
673 If not set, <literal>PORTABLE_SCOPE=system</literal> is implied.</para>
674
675 <xi:include href="version-info.xml" xpointer="v259"/></listitem>
676 </varlistentry>
677 </variablelist>
678 </refsect2>
679
680 <refsect2>
681 <title>Notes</title>
682
683 <para>If you are using this file to determine the OS or a specific version of it, use the
684 <varname>ID</varname> and <varname>VERSION_ID</varname> fields, possibly with
685 <varname>ID_LIKE</varname> as fallback for <varname>ID</varname>. When looking for an OS identification
686 string for presentation to the user use the <varname>PRETTY_NAME</varname> field.</para>
687
688 <para>Note that operating system vendors may choose not to provide version information, for example to
689 accommodate for rolling releases. In this case, <varname>VERSION</varname> and
690 <varname>VERSION_ID</varname> may be unset. Applications should not rely on these fields to be
691 set.</para>
692
693 <para>Operating system vendors may extend the file format and introduce new fields. It is highly
694 recommended to prefix new fields with an OS-specific name in order to avoid name clashes. Applications
695 reading this file must ignore unknown fields.</para>
696
697 <para>Example: <literal>DEBIAN_BTS="debbugs://bugs.debian.org/"</literal>.</para>
698
699 <para>Container and sandbox runtime managers may make the host's identification data available to
700 applications by providing the host's <filename>/etc/os-release</filename> (if available, otherwise
701 <filename>/usr/lib/os-release</filename> as a fallback) as
702 <filename>/run/host/os-release</filename>.</para>
703 </refsect2>
704 </refsect1>
705
706 <refsect1>
707 <title>Examples</title>
708
709 <example>
710 <title><filename>os-release</filename> file for Fedora Workstation</title>
711
712 <programlisting>NAME=Fedora
713 VERSION="32 (Workstation Edition)"
714 ID=fedora
715 VERSION_ID=32
716 PRETTY_NAME="Fedora 32 (Workstation Edition)"
717 ANSI_COLOR="0;38;2;60;110;180"
718 LOGO=fedora-logo-icon
719 CPE_NAME="cpe:/o:fedoraproject:fedora:32"
720 HOME_URL="https://fedoraproject.org/"
721 DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f32/system-administrators-guide/"
722 SUPPORT_URL="https://fedoraproject.org/wiki/Communicating_and_getting_help"
723 BUG_REPORT_URL="https://bugzilla.redhat.com/"
724 REDHAT_BUGZILLA_PRODUCT="Fedora"
725 REDHAT_BUGZILLA_PRODUCT_VERSION=32
726 REDHAT_SUPPORT_PRODUCT="Fedora"
727 REDHAT_SUPPORT_PRODUCT_VERSION=32
728 PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy"
729 VARIANT="Workstation Edition"
730 VARIANT_ID=workstation</programlisting>
731 </example>
732
733 <example>
734 <title><filename>extension-release</filename> file for an extension for Fedora Workstation 32</title>
735
736 <programlisting>ID=fedora
737 VERSION_ID=32</programlisting>
738 </example>
739
740 <example>
741 <title>Reading <filename>os-release</filename> in
742 <citerefentry project='man-pages'><refentrytitle>sh</refentrytitle><manvolnum>1</manvolnum></citerefentry></title>
743
744 <programlisting><xi:include href="check-os-release.sh" parse="text" /></programlisting>
745 </example>
746
747 <example>
748 <title>Reading <filename>os-release</filename> in
749 <citerefentry project='die-net'><refentrytitle>python</refentrytitle><manvolnum>1</manvolnum></citerefentry> (versions &gt;= 3.10)</title>
750
751 <programlisting><xi:include href="check-os-release-simple.py" parse="text" /></programlisting>
752
753 <para>See docs for <function><ulink
754 url="https://docs.python.org/3/library/platform.html#platform.freedesktop_os_release">platform.freedesktop_os_release</ulink></function>
755 for more details.
756 </para>
757 </example>
758
759 <example>
760 <title>Reading <filename>os-release</filename> in
761 <citerefentry project='die-net'><refentrytitle>python</refentrytitle><manvolnum>1</manvolnum></citerefentry> (any version)</title>
762
763 <programlisting><xi:include href="check-os-release.py" parse="text" /></programlisting>
764
765 <para>Note that the above version that uses the built-in implementation is preferred
766 in most cases, and the open-coded version here is provided for reference.</para>
767 </example>
768
769 </refsect1>
770
771 <refsect1>
772 <title>See Also</title>
773 <para><simplelist type="inline">
774 <member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
775 <member><citerefentry project='die-net'><refentrytitle>lsb_release</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
776 <member><citerefentry><refentrytitle>hostname</refentrytitle><manvolnum>5</manvolnum></citerefentry></member>
777 <member><citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry></member>
778 <member><citerefentry><refentrytitle>machine-info</refentrytitle><manvolnum>5</manvolnum></citerefentry></member>
779 </simplelist></para>
780 </refsect1>
781
782 </refentry>