Debian Codegraph @

upstream/mageia-cauldron/man5/os-release.5

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