Debian Codegraph @

upstream/debian-trixie/man5/os-release.5

raw
1 '\" t
2 .TH "OS\-RELEASE" "5" "" "systemd 257.13" "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 See
542 \fBorg.freedesktop.hostname1\fR(5)
543 for a description of how
544 \fBsystemd-hostnamed.service\fR(8)
545 determines the fallback hostname\&.
546 .sp
547 Added in version 248\&.
548 .RE
549 .PP
550 \fIARCHITECTURE=\fR
551 .RS 4
552 A string that specifies which CPU architecture the userspace binaries require\&. The architecture identifiers are the same as for
553 \fIConditionArchitecture=\fR
554 described in
555 \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\&.
556 .sp
557 Added in version 252\&.
558 .RE
559 .PP
560 \fISYSEXT_LEVEL=\fR
561 .RS 4
562 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
563 /usr/lib/extension\-release\&.d/extension\-release\&.\fIIMAGE\fR,
564 \m[blue]\fBinitrd\fR\m[]\&\s-2\u[2]\d\s+2
565 and
566 \fBsystemd-sysext\fR(8)) for more information\&.
567 .sp
568 Examples:
569 "SYSEXT_LEVEL=2",
570 "SYSEXT_LEVEL=15\&.14"\&.
571 .sp
572 Added in version 248\&.
573 .RE
574 .PP
575 \fICONFEXT_LEVEL=\fR
576 .RS 4
577 Semantically the same as
578 \fISYSEXT_LEVEL=\fR
579 but for confext images\&. See
580 /etc/extension\-release\&.d/extension\-release\&.\fIIMAGE\fR
581 for more information\&.
582 .sp
583 Examples:
584 "CONFEXT_LEVEL=2",
585 "CONFEXT_LEVEL=15\&.14"\&.
586 .sp
587 Added in version 254\&.
588 .RE
589 .PP
590 \fISYSEXT_SCOPE=\fR
591 .RS 4
592 Takes a space\-separated list of one or more of the strings
593 "system",
594 "initrd"
595 and
596 "portable"\&. This field is only supported in
597 extension\-release\&.d/
598 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,
599 "SYSEXT_SCOPE=system portable"
600 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\&.
601 .sp
602 Added in version 250\&.
603 .RE
604 .PP
605 \fICONFEXT_SCOPE=\fR
606 .RS 4
607 Semantically the same as
608 \fISYSEXT_SCOPE=\fR
609 but for confext images\&.
610 .sp
611 Added in version 254\&.
612 .RE
613 .PP
614 \fIPORTABLE_PREFIXES=\fR
615 .RS 4
616 Takes a space\-separated list of one or more valid prefix match strings for the
617 \m[blue]\fBPortable Services\fR\m[]\&\s-2\u[3]\d\s+2
618 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\&.
619 .sp
620 Added in version 250\&.
621 .RE
622 .SS "Notes"
623 .PP
624 If you are using this file to determine the OS or a specific version of it, use the
625 \fIID\fR
626 and
627 \fIVERSION_ID\fR
628 fields, possibly with
629 \fIID_LIKE\fR
630 as fallback for
631 \fIID\fR\&. When looking for an OS identification string for presentation to the user use the
632 \fIPRETTY_NAME\fR
633 field\&.
634 .PP
635 Note that operating system vendors may choose not to provide version information, for example to accommodate for rolling releases\&. In this case,
636 \fIVERSION\fR
637 and
638 \fIVERSION_ID\fR
639 may be unset\&. Applications should not rely on these fields to be set\&.
640 .PP
641 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\&.
642 .PP
643 Example:
644 "DEBIAN_BTS="debbugs://bugs\&.debian\&.org/""\&.
645 .PP
646 Container and sandbox runtime managers may make the host\*(Aqs identification data available to applications by providing the host\*(Aqs
647 /etc/os\-release
648 (if available, otherwise
649 /usr/lib/os\-release
650 as a fallback) as
651 /run/host/os\-release\&.
652 .SH "EXAMPLES"
653 .PP
654 \fBExample\ \&1.\ \&os\-release file for Fedora Workstation\fR
655 .sp
656 .if n \{\
657 .RS 4
658 .\}
659 .nf
660 NAME=Fedora
661 VERSION="32 (Workstation Edition)"
662 ID=fedora
663 VERSION_ID=32
664 PRETTY_NAME="Fedora 32 (Workstation Edition)"
665 ANSI_COLOR="0;38;2;60;110;180"
666 LOGO=fedora\-logo\-icon
667 CPE_NAME="cpe:/o:fedoraproject:fedora:32"
668 HOME_URL="https://fedoraproject\&.org/"
669 DOCUMENTATION_URL="https://docs\&.fedoraproject\&.org/en\-US/fedora/f32/system\-administrators\-guide/"
670 SUPPORT_URL="https://fedoraproject\&.org/wiki/Communicating_and_getting_help"
671 BUG_REPORT_URL="https://bugzilla\&.redhat\&.com/"
672 REDHAT_BUGZILLA_PRODUCT="Fedora"
673 REDHAT_BUGZILLA_PRODUCT_VERSION=32
674 REDHAT_SUPPORT_PRODUCT="Fedora"
675 REDHAT_SUPPORT_PRODUCT_VERSION=32
676 PRIVACY_POLICY_URL="https://fedoraproject\&.org/wiki/Legal:PrivacyPolicy"
677 VARIANT="Workstation Edition"
678 VARIANT_ID=workstation
679 .fi
680 .if n \{\
681 .RE
682 .\}
683 .PP
684 \fBExample\ \&2.\ \&extension\-release file for an extension for Fedora Workstation 32\fR
685 .sp
686 .if n \{\
687 .RS 4
688 .\}
689 .nf
690 ID=fedora
691 VERSION_ID=32
692 .fi
693 .if n \{\
694 .RE
695 .\}
696 .PP
697 \fBExample\ \&3.\ \&Reading os\-release in sh(1)\fR
698 .sp
699 .if n \{\
700 .RS 4
701 .\}
702 .nf
703 #!/bin/sh \-eu
704 # SPDX\-License\-Identifier: MIT\-0
705
706 test \-e /etc/os\-release && os_release=\*(Aq/etc/os\-release\*(Aq || os_release=\*(Aq/usr/lib/os\-release\*(Aq
707 \&. "${os_release}"
708
709 echo "Running on ${PRETTY_NAME:\-Linux}"
710
711 if [ "${ID:\-linux}" = "debian" ] || [ "${ID_LIKE#*debian*}" != "${ID_LIKE}" ]; then
712 echo "Looks like Debian!"
713 fi
714 .fi
715 .if n \{\
716 .RE
717 .\}
718 .PP
719 \fBExample\ \&4.\ \&Reading os\-release in python(1) (versions >= 3\&.10)\fR
720 .sp
721 .if n \{\
722 .RS 4
723 .\}
724 .nf
725 #!/usr/bin/python
726 # SPDX\-License\-Identifier: MIT\-0
727
728 import platform
729 os_release = platform\&.freedesktop_os_release()
730
731 pretty_name = os_release\&.get(\*(AqPRETTY_NAME\*(Aq, \*(AqLinux\*(Aq)
732 print(f\*(AqRunning on {pretty_name!r}\*(Aq)
733
734 if \*(Aqfedora\*(Aq in [os_release\&.get(\*(AqID\*(Aq, \*(Aqlinux\*(Aq),
735 *os_release\&.get(\*(AqID_LIKE\*(Aq, \*(Aq\*(Aq)\&.split()]:
736 print(\*(AqLooks like Fedora!\*(Aq)
737 .fi
738 .if n \{\
739 .RE
740 .\}
741 .PP
742 See docs for
743 \m[blue]\fB\fBplatform\&.freedesktop_os_release\fR\fR\m[]\&\s-2\u[7]\d\s+2
744 for more details\&.
745 .PP
746 \fBExample\ \&5.\ \&Reading os\-release in python(1) (any version)\fR
747 .sp
748 .if n \{\
749 .RS 4
750 .\}
751 .nf
752 #!/usr/bin/python
753 # SPDX\-License\-Identifier: MIT\-0
754
755 import ast
756 import re
757 import sys
758
759 def read_os_release():
760 try:
761 filename = \*(Aq/etc/os\-release\*(Aq
762 f = open(filename)
763 except FileNotFoundError:
764 filename = \*(Aq/usr/lib/os\-release\*(Aq
765 f = open(filename)
766
767 for line_number, line in enumerate(f, start=1):
768 line = line\&.rstrip()
769 if not line or line\&.startswith(\*(Aq#\*(Aq):
770 continue
771 m = re\&.match(r\*(Aq([A\-Z][A\-Z_0\-9]+)=(\&.*)\*(Aq, line)
772 if m:
773 name, val = m\&.groups()
774 if val and val[0] in \*(Aq"\e\*(Aq\*(Aq:
775 val = ast\&.literal_eval(val)
776 yield name, val
777 else:
778 print(f\*(Aq{filename}:{line_number}: bad line {line!r}\*(Aq,
779 file=sys\&.stderr)
780
781 os_release = dict(read_os_release())
782
783 pretty_name = os_release\&.get(\*(AqPRETTY_NAME\*(Aq, \*(AqLinux\*(Aq)
784 print(f\*(AqRunning on {pretty_name!r}\*(Aq)
785
786 if \*(Aqdebian\*(Aq in [os_release\&.get(\*(AqID\*(Aq, \*(Aqlinux\*(Aq),
787 *os_release\&.get(\*(AqID_LIKE\*(Aq, \*(Aq\*(Aq)\&.split()]:
788 print(\*(AqLooks like Debian!\*(Aq)
789 .fi
790 .if n \{\
791 .RE
792 .\}
793 .PP
794 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\&.
795 .SH "SEE ALSO"
796 .PP
797 \fBsystemd\fR(1), \fBlsb_release\fR(1), \fBhostname\fR(5), \fBmachine-id\fR(5), \fBmachine-info\fR(5)
798 .SH "NOTES"
799 .IP " 1." 4
800 Announcement of /etc/os-release
801 .RS 4
802 \%https://0pointer.de/blog/projects/os-release
803 .RE
804 .IP " 2." 4
805 initrd
806 .RS 4
807 \%https://docs.kernel.org/admin-guide/initrd.html
808 .RE
809 .IP " 3." 4
810 Portable Services
811 .RS 4
812 \%https://systemd.io/PORTABLE_SERVICES
813 .RE
814 .IP " 4." 4
815 Common Platform Enumeration Specification
816 .RS 4
817 \%http://scap.nist.gov/specifications/cpe/
818 .RE
819 .IP " 5." 4
820 RFC3986 format
821 .RS 4
822 \%https://tools.ietf.org/html/rfc3986
823 .RE
824 .IP " 6." 4
825 freedesktop.org Icon Theme Specification
826 .RS 4
827 \%https://standards.freedesktop.org/icon-theme-spec/latest
828 .RE
829 .IP " 7." 4
830
831 \fBplatform.freedesktop_os_release\fR
832 .RS 4
833 \%https://docs.python.org/3/library/platform.html#platform.freedesktop_os_release
834 .RE