Debian Codegraph @

upstream/fedora-44/man5/os-release.5

raw
1 '\" t
2 .TH "OS\-RELEASE" "5" "" "systemd 259.5" "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 (foreground) text 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 \fIANSI_COLOR_REVERSE=\fR
453 .RS 4
454 Similar to
455 \fIANSI_COLOR=\fR, but should encode the desired presentation color as background color, along with a suitable foreground color\&. This is may be used by console applications to set off "chrome" UI elements from the main terminal contents\&. This field is optional\&.
456 .sp
457 Added in version 259\&.
458 .RE
459 .PP
460 \fIVENDOR_NAME=\fR
461 .RS 4
462 The name of the OS vendor\&. This is the name of the organization or company which produces the OS\&. This field is optional\&.
463 .sp
464 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\&.
465 .sp
466 Examples:
467 "VENDOR_NAME="Fedora Project""
468 for Fedora Linux,
469 "VENDOR_NAME="Canonical""
470 for Ubuntu\&.
471 .sp
472 Added in version 254\&.
473 .RE
474 .PP
475 \fIVENDOR_URL=\fR
476 .RS 4
477 The homepage of the OS vendor\&. This field is optional\&. The
478 \fIVENDOR_NAME=\fR
479 field should be set if this one is, although clients must be robust against either field not being set\&.
480 .sp
481 The value should be in
482 \m[blue]\fBRFC3986 format\fR\m[]\&\s-2\u[5]\d\s+2, and should be
483 "http:"
484 or
485 "https:"
486 URLs\&. Only one URL shall be listed in the setting\&.
487 .sp
488 Examples:
489 "VENDOR_URL="https://fedoraproject\&.org/"",
490 "VENDOR_URL="https://canonical\&.com/""\&.
491 .sp
492 Added in version 254\&.
493 .RE
494 .PP
495 \fIEXPERIMENT=\fR
496 .RS 4
497 A human\-presentable description of what makes this build of the OS experimental\&. This field is optional\&. The
498 \fIRELEASE_TYPE\fR
499 field should be set to
500 "experiment"
501 if this field is set, otherwise clients should ignore this field\&.
502 .sp
503 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
504 \fIRELEASE_TYPE\fR
505 is
506 "experiment"
507 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\&.
508 .sp
509 Examples:
510 "EXPERIMENT="Switch to DNF5""
511 for an experimental build of Fedora Linux made to test DNF5,
512 "EXPERIMENT="Port to Apple M3 chip""
513 for experimental builds of Asahi Linux ported to the Apple M3 SoC,
514 "EXPERIMENT="Mutter !1441: Dynamic triple/double buffering (v4)""
515 for builds of GNOME OS created by Mutter\*(Aqs CI for merge request !1441\&.
516 .sp
517 Added in version 257\&.
518 .RE
519 .PP
520 \fIEXPERIMENT_URL=\fR
521 .RS 4
522 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
523 \fIEXPERIMENT=\fR
524 field should be set if this one is, although clients must be robust against either field not being set\&.
525 .sp
526 The value should be in
527 \m[blue]\fBRFC3986 format\fR\m[]\&\s-2\u[5]\d\s+2, and should be
528 "http:"
529 or
530 "https:"
531 URLs\&. Only one URL shall be listed in the setting\&.
532 .sp
533 Examples, corresponding to the examples above in
534 \fIEXPERIMENT=\fR:
535 "EXPERIMENT_URL="https://fedoraproject\&.org/wiki/Changes/SwitchToDnf5"",
536 "EXPERIMENT_URL="https://github\&.com/AsahiLinux/docs/wiki/M3\-Series\-Feature\-Support"",
537 "EXPERIMENT_URL="https://gitlab\&.gnome\&.org/GNOME/mutter/\-/merge_requests/1441""\&.
538 .sp
539 Added in version 257\&.
540 .RE
541 .SS "Distribution\-level defaults and metadata"
542 .PP
543 \fIDEFAULT_HOSTNAME=\fR
544 .RS 4
545 A string specifying the hostname if
546 \fBhostname\fR(5)
547 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)\&.
548 .sp
549 If the question mark character
550 "?"
551 appears in the hostname, it is automatically substituted by a hexadecimal character derived from the
552 \fBmachine-id\fR(5)
553 when applied, securely and deterministically by cryptographic hashing\&. Example:
554 "foobar\-????\-????"
555 will automatically expand to
556 "foobar\-92a9\-061c"
557 or similar, depending on the local machine ID\&.
558 .sp
559 See
560 \fBorg.freedesktop.hostname1\fR(5)
561 for a description of how
562 \fBsystemd-hostnamed.service\fR(8)
563 determines the fallback hostname\&.
564 .sp
565 Added in version 248\&.
566 .RE
567 .PP
568 \fIARCHITECTURE=\fR
569 .RS 4
570 A string that specifies which CPU architecture the userspace binaries require\&. The architecture identifiers are the same as for
571 \fIConditionArchitecture=\fR
572 described in
573 \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\&.
574 .sp
575 Added in version 252\&.
576 .RE
577 .PP
578 \fISYSEXT_LEVEL=\fR
579 .RS 4
580 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
581 /usr/lib/extension\-release\&.d/extension\-release\&.\fIIMAGE\fR,
582 \m[blue]\fBinitrd\fR\m[]\&\s-2\u[2]\d\s+2
583 and
584 \fBsystemd-sysext\fR(8)) for more information\&.
585 .sp
586 Examples:
587 "SYSEXT_LEVEL=2",
588 "SYSEXT_LEVEL=15\&.14"\&.
589 .sp
590 Added in version 248\&.
591 .RE
592 .PP
593 \fICONFEXT_LEVEL=\fR
594 .RS 4
595 Semantically the same as
596 \fISYSEXT_LEVEL=\fR
597 but for confext images\&. See
598 /etc/extension\-release\&.d/extension\-release\&.\fIIMAGE\fR
599 for more information\&.
600 .sp
601 Examples:
602 "CONFEXT_LEVEL=2",
603 "CONFEXT_LEVEL=15\&.14"\&.
604 .sp
605 Added in version 254\&.
606 .RE
607 .PP
608 \fISYSEXT_SCOPE=\fR
609 .RS 4
610 Takes a space\-separated list of one or more of the strings
611 "system",
612 "initrd"
613 and
614 "portable"\&. This field is only supported in
615 extension\-release\&.d/
616 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,
617 "SYSEXT_SCOPE=system portable"
618 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\&.
619 .sp
620 Added in version 250\&.
621 .RE
622 .PP
623 \fICONFEXT_SCOPE=\fR
624 .RS 4
625 Semantically the same as
626 \fISYSEXT_SCOPE=\fR
627 but for confext images\&.
628 .sp
629 Added in version 254\&.
630 .RE
631 .PP
632 \fIPORTABLE_PREFIXES=\fR
633 .RS 4
634 Takes a space\-separated list of one or more valid prefix match strings for the
635 \m[blue]\fBPortable Services\fR\m[]\&\s-2\u[3]\d\s+2
636 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\&.
637 .sp
638 Added in version 250\&.
639 .RE
640 .SS "Notes"
641 .PP
642 If you are using this file to determine the OS or a specific version of it, use the
643 \fIID\fR
644 and
645 \fIVERSION_ID\fR
646 fields, possibly with
647 \fIID_LIKE\fR
648 as fallback for
649 \fIID\fR\&. When looking for an OS identification string for presentation to the user use the
650 \fIPRETTY_NAME\fR
651 field\&.
652 .PP
653 Note that operating system vendors may choose not to provide version information, for example to accommodate for rolling releases\&. In this case,
654 \fIVERSION\fR
655 and
656 \fIVERSION_ID\fR
657 may be unset\&. Applications should not rely on these fields to be set\&.
658 .PP
659 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\&.
660 .PP
661 Example:
662 "DEBIAN_BTS="debbugs://bugs\&.debian\&.org/""\&.
663 .PP
664 Container and sandbox runtime managers may make the host\*(Aqs identification data available to applications by providing the host\*(Aqs
665 /etc/os\-release
666 (if available, otherwise
667 /usr/lib/os\-release
668 as a fallback) as
669 /run/host/os\-release\&.
670 .SH "EXAMPLES"
671 .PP
672 \fBExample\ \&1.\ \&os\-release file for Fedora Workstation\fR
673 .sp
674 .if n \{\
675 .RS 4
676 .\}
677 .nf
678 NAME=Fedora
679 VERSION="32 (Workstation Edition)"
680 ID=fedora
681 VERSION_ID=32
682 PRETTY_NAME="Fedora 32 (Workstation Edition)"
683 ANSI_COLOR="0;38;2;60;110;180"
684 LOGO=fedora\-logo\-icon
685 CPE_NAME="cpe:/o:fedoraproject:fedora:32"
686 HOME_URL="https://fedoraproject\&.org/"
687 DOCUMENTATION_URL="https://docs\&.fedoraproject\&.org/en\-US/fedora/f32/system\-administrators\-guide/"
688 SUPPORT_URL="https://fedoraproject\&.org/wiki/Communicating_and_getting_help"
689 BUG_REPORT_URL="https://bugzilla\&.redhat\&.com/"
690 REDHAT_BUGZILLA_PRODUCT="Fedora"
691 REDHAT_BUGZILLA_PRODUCT_VERSION=32
692 REDHAT_SUPPORT_PRODUCT="Fedora"
693 REDHAT_SUPPORT_PRODUCT_VERSION=32
694 PRIVACY_POLICY_URL="https://fedoraproject\&.org/wiki/Legal:PrivacyPolicy"
695 VARIANT="Workstation Edition"
696 VARIANT_ID=workstation
697 .fi
698 .if n \{\
699 .RE
700 .\}
701 .PP
702 \fBExample\ \&2.\ \&extension\-release file for an extension for Fedora Workstation 32\fR
703 .sp
704 .if n \{\
705 .RS 4
706 .\}
707 .nf
708 ID=fedora
709 VERSION_ID=32
710 .fi
711 .if n \{\
712 .RE
713 .\}
714 .PP
715 \fBExample\ \&3.\ \&Reading os\-release in sh(1)\fR
716 .sp
717 .if n \{\
718 .RS 4
719 .\}
720 .nf
721 #!/bin/sh \-eu
722 # SPDX\-License\-Identifier: MIT\-0
723
724 test \-e /etc/os\-release && os_release=\*(Aq/etc/os\-release\*(Aq || os_release=\*(Aq/usr/lib/os\-release\*(Aq
725 \&. "${os_release}"
726
727 echo "Running on ${PRETTY_NAME:\-Linux}"
728
729 if [ "${ID:\-linux}" = "debian" ] || [ "${ID_LIKE#*debian*}" != "${ID_LIKE}" ]; then
730 echo "Looks like Debian!"
731 fi
732 .fi
733 .if n \{\
734 .RE
735 .\}
736 .PP
737 \fBExample\ \&4.\ \&Reading os\-release in python(1) (versions >= 3\&.10)\fR
738 .sp
739 .if n \{\
740 .RS 4
741 .\}
742 .nf
743 #!/usr/bin/python
744 # SPDX\-License\-Identifier: MIT\-0
745
746 import platform
747 os_release = platform\&.freedesktop_os_release()
748
749 pretty_name = os_release\&.get(\*(AqPRETTY_NAME\*(Aq, \*(AqLinux\*(Aq)
750 print(f\*(AqRunning on {pretty_name!r}\*(Aq)
751
752 if \*(Aqfedora\*(Aq in [os_release\&.get(\*(AqID\*(Aq, \*(Aqlinux\*(Aq),
753 *os_release\&.get(\*(AqID_LIKE\*(Aq, \*(Aq\*(Aq)\&.split()]:
754 print(\*(AqLooks like Fedora!\*(Aq)
755 .fi
756 .if n \{\
757 .RE
758 .\}
759 .PP
760 See docs for
761 \m[blue]\fB\fBplatform\&.freedesktop_os_release\fR\fR\m[]\&\s-2\u[7]\d\s+2
762 for more details\&.
763 .PP
764 \fBExample\ \&5.\ \&Reading os\-release in python(1) (any version)\fR
765 .sp
766 .if n \{\
767 .RS 4
768 .\}
769 .nf
770 #!/usr/bin/python
771 # SPDX\-License\-Identifier: MIT\-0
772
773 import ast
774 import re
775 import sys
776
777 def read_os_release():
778 try:
779 filename = \*(Aq/etc/os\-release\*(Aq
780 f = open(filename)
781 except FileNotFoundError:
782 filename = \*(Aq/usr/lib/os\-release\*(Aq
783 f = open(filename)
784
785 for line_number, line in enumerate(f, start=1):
786 line = line\&.rstrip()
787 if not line or line\&.startswith(\*(Aq#\*(Aq):
788 continue
789 m = re\&.match(r\*(Aq([A\-Z][A\-Z_0\-9]+)=(\&.*)\*(Aq, line)
790 if m:
791 name, val = m\&.groups()
792 if val and val[0] in \*(Aq"\e\*(Aq\*(Aq:
793 val = ast\&.literal_eval(val)
794 yield name, val
795 else:
796 print(f\*(Aq{filename}:{line_number}: bad line {line!r}\*(Aq,
797 file=sys\&.stderr)
798
799 os_release = dict(read_os_release())
800
801 pretty_name = os_release\&.get(\*(AqPRETTY_NAME\*(Aq, \*(AqLinux\*(Aq)
802 print(f\*(AqRunning on {pretty_name!r}\*(Aq)
803
804 if \*(Aqdebian\*(Aq in [os_release\&.get(\*(AqID\*(Aq, \*(Aqlinux\*(Aq),
805 *os_release\&.get(\*(AqID_LIKE\*(Aq, \*(Aq\*(Aq)\&.split()]:
806 print(\*(AqLooks like Debian!\*(Aq)
807 .fi
808 .if n \{\
809 .RE
810 .\}
811 .PP
812 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\&.
813 .SH "SEE ALSO"
814 .PP
815 \fBsystemd\fR(1), \fBlsb_release\fR(1), \fBhostname\fR(5), \fBmachine-id\fR(5), \fBmachine-info\fR(5)
816 .SH "NOTES"
817 .IP " 1." 4
818 Announcement of /etc/os-release
819 .RS 4
820 \%https://0pointer.de/blog/projects/os-release
821 .RE
822 .IP " 2." 4
823 initrd
824 .RS 4
825 \%https://docs.kernel.org/admin-guide/initrd.html
826 .RE
827 .IP " 3." 4
828 Portable Services
829 .RS 4
830 \%https://systemd.io/PORTABLE_SERVICES
831 .RE
832 .IP " 4." 4
833 Common Platform Enumeration Specification
834 .RS 4
835 \%http://scap.nist.gov/specifications/cpe/
836 .RE
837 .IP " 5." 4
838 RFC3986 format
839 .RS 4
840 \%https://tools.ietf.org/html/rfc3986
841 .RE
842 .IP " 6." 4
843 freedesktop.org Icon Theme Specification
844 .RS 4
845 \%https://standards.freedesktop.org/icon-theme-spec/latest
846 .RE
847 .IP " 7." 4
848
849 \fBplatform.freedesktop_os_release\fR
850 .RS 4
851 \%https://docs.python.org/3/library/platform.html#platform.freedesktop_os_release
852 .RE