1 <?xml version='
1.0'
?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC
"-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
6 SPDX-License-Identifier: LGPL-2.1+
8 This file is part of systemd.
10 Copyright 2010 Lennart Poettering
12 systemd is free software; you can redistribute it and/or modify it
13 under the terms of the GNU Lesser General Public License as published by
14 the Free Software Foundation; either version 2.1 of the License, or
15 (at your option) any later version.
17 systemd is distributed in the hope that it will be useful, but
18 WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 Lesser General Public License for more details.
22 You should have received a copy of the GNU Lesser General Public License
23 along with systemd; If not, see <http://www.gnu.org/licenses/>.
26 <refentry id=
"os-release">
28 <title>os-release
</title>
29 <productname>systemd
</productname>
33 <contrib>Developer
</contrib>
34 <firstname>Lennart
</firstname>
35 <surname>Poettering
</surname>
36 <email>lennart@poettering.net
</email>
42 <refentrytitle>os-release
</refentrytitle>
43 <manvolnum>5</manvolnum>
47 <refname>os-release
</refname>
48 <refpurpose>Operating system identification
</refpurpose>
52 <para><filename>/etc/os-release
</filename></para>
53 <para><filename>/usr/lib/os-release
</filename></para>
57 <title>Description
</title>
59 <para>The
<filename>/etc/os-release
</filename> and
60 <filename>/usr/lib/os-release
</filename> files contain operating
61 system identification data.
</para>
63 <para>The basic file format of
<filename>os-release
</filename> is
64 a newline-separated list of environment-like shell-compatible
65 variable assignments. It is possible to source the configuration
66 from shell scripts, however, beyond mere variable assignments, no
67 shell features are supported (this means variable expansion is
68 explicitly not supported), allowing applications to read the file
69 without implementing a shell compatible execution engine. Variable
70 assignment values must be enclosed in double or single quotes if
71 they include spaces, semicolons or other special characters
72 outside of A–Z, a–z,
0–
9. Shell special characters (
"$", quotes,
73 backslash, backtick) must be escaped with backslashes, following
74 shell style. All strings should be in UTF-
8 format, and
75 non-printable characters should not be used. It is not supported
76 to concatenate multiple individually quoted strings. Lines
77 beginning with
"#" shall be ignored as comments.
</para>
79 <para>The file
<filename>/etc/os-release
</filename> takes
80 precedence over
<filename>/usr/lib/os-release
</filename>.
81 Applications should check for the former, and exclusively use its
82 data if it exists, and only fall back to
83 <filename>/usr/lib/os-release
</filename> if it is missing.
84 Applications should not read data from both files at the same
85 time.
<filename>/usr/lib/os-release
</filename> is the recommended
86 place to store OS release information as part of vendor trees.
87 <filename>/etc/os-release
</filename> should be a relative symlink
88 to
<filename>/usr/lib/os-release
</filename>, to provide
89 compatibility with applications only looking at
90 <filename>/etc
</filename>. A relative symlink instead of an
91 absolute symlink is necessary to avoid breaking the link in a
92 chroot or initrd environment such as dracut.
</para>
94 <para><filename>os-release
</filename> contains data that is
95 defined by the operating system vendor and should generally not be
96 changed by the administrator.
</para>
98 <para>As this file only encodes names and identifiers it should
99 not be localized.
</para>
101 <para>The
<filename>/etc/os-release
</filename> and
102 <filename>/usr/lib/os-release
</filename> files might be symlinks
103 to other files, but it is important that the file is available
104 from earliest boot on, and hence must be located on the root file
107 <para>For a longer rationale for
<filename>os-release
</filename>
108 please refer to the
<ulink
109 url=
"http://0pointer.de/blog/projects/os-release">Announcement of
<filename>/etc/os-release
</filename></ulink>.
</para>
113 <title>Options
</title>
115 <para>The following OS identifications parameters may be set using
116 <filename>os-release
</filename>:
</para>
121 <term><varname>NAME=
</varname></term>
123 <listitem><para>A string identifying the operating system,
124 without a version component, and suitable for presentation to
125 the user. If not set, defaults to
126 <literal>NAME=Linux
</literal>. Example:
127 <literal>NAME=Fedora
</literal> or
<literal>NAME=
"Debian
128 GNU/Linux"</literal>.
</para></listitem>
132 <term><varname>VERSION=
</varname></term>
134 <listitem><para>A string identifying the operating system
135 version, excluding any OS name information, possibly including
136 a release code name, and suitable for presentation to the
137 user. This field is optional. Example:
138 <literal>VERSION=
17</literal> or
<literal>VERSION=
"17 (Beefy
139 Miracle)"</literal>.
</para></listitem>
143 <term><varname>ID=
</varname></term>
145 <listitem><para>A lower-case string (no spaces or other
146 characters outside of
0–
9, a–z,
".",
"_" and
"-") identifying
147 the operating system, excluding any version information and
148 suitable for processing by scripts or usage in generated
149 filenames. If not set, defaults to
150 <literal>ID=linux
</literal>. Example:
151 <literal>ID=fedora
</literal> or
152 <literal>ID=debian
</literal>.
</para></listitem>
156 <term><varname>ID_LIKE=
</varname></term>
158 <listitem><para>A space-separated list of operating system
159 identifiers in the same syntax as the
<varname>ID=
</varname>
160 setting. It should list identifiers of operating systems that
161 are closely related to the local operating system in regards
162 to packaging and programming interfaces, for example listing
163 one or more OS identifiers the local OS is a derivative from.
164 An OS should generally only list other OS identifiers it
165 itself is a derivative of, and not any OSes that are derived
166 from it, though symmetric relationships are possible. Build
167 scripts and similar should check this variable if they need to
168 identify the local operating system and the value of
169 <varname>ID=
</varname> is not recognized. Operating systems
170 should be listed in order of how closely the local operating
171 system relates to the listed ones, starting with the closest.
172 This field is optional. Example: for an operating system with
173 <literal>ID=centos
</literal>, an assignment of
174 <literal>ID_LIKE=
"rhel fedora"</literal> would be appropriate.
175 For an operating system with
<literal>ID=ubuntu
</literal>, an
176 assignment of
<literal>ID_LIKE=debian
</literal> is
177 appropriate.
</para></listitem>
181 <term><varname>VERSION_CODENAME=
</varname></term>
184 A lower-case string (no spaces or other characters outside of
185 0–
9, a–z,
".",
"_" and
"-") identifying the operating system
186 release code name, excluding any OS name information or
187 release version, and suitable for processing by scripts or
188 usage in generated filenames. This field is optional and may
189 not be implemented on all systems.
191 <literal>VERSION_CODENAME=buster
</literal>,
192 <literal>VERSION_CODENAME=xenial
</literal>
197 <term><varname>VERSION_ID=
</varname></term>
199 <listitem><para>A lower-case string (mostly numeric, no spaces
200 or other characters outside of
0–
9, a–z,
".",
"_" and
"-")
201 identifying the operating system version, excluding any OS
202 name information or release code name, and suitable for
203 processing by scripts or usage in generated filenames. This
204 field is optional. Example:
<literal>VERSION_ID=
17</literal>
205 or
<literal>VERSION_ID=
11.04</literal>.
</para></listitem>
209 <term><varname>PRETTY_NAME=
</varname></term>
211 <listitem><para>A pretty operating system name in a format
212 suitable for presentation to the user. May or may not contain
213 a release code name or OS version of some kind, as suitable.
214 If not set, defaults to
215 <literal>PRETTY_NAME=
"Linux"</literal>. Example:
216 <literal>PRETTY_NAME=
"Fedora 17 (Beefy
217 Miracle)"</literal>.
</para></listitem>
221 <term><varname>ANSI_COLOR=
</varname></term>
223 <listitem><para>A suggested presentation color when showing
224 the OS name on the console. This should be specified as string
225 suitable for inclusion in the ESC [ m ANSI/ECMA-
48 escape code
226 for setting graphical rendition. This field is optional.
227 Example:
<literal>ANSI_COLOR=
"0;31"</literal> for red, or
228 <literal>ANSI_COLOR=
"1;34"</literal> for light
229 blue.
</para></listitem>
233 <term><varname>CPE_NAME=
</varname></term>
235 <listitem><para>A CPE name for the operating system, in URI
236 binding syntax, following the
237 <ulink url=
"http://scap.nist.gov/specifications/cpe/">Common
238 Platform Enumeration Specification
</ulink> as proposed by the
239 NIST. This field is optional. Example:
240 <literal>CPE_NAME=
"cpe:/o:fedoraproject:fedora:17"</literal>
245 <term><varname>HOME_URL=
</varname></term>
246 <term><varname>SUPPORT_URL=
</varname></term>
247 <term><varname>BUG_REPORT_URL=
</varname></term>
248 <term><varname>PRIVACY_POLICY_URL=
</varname></term>
250 <listitem><para>Links to resources on the Internet related the
251 operating system.
<varname>HOME_URL=
</varname> should refer to
252 the homepage of the operating system, or alternatively some
253 homepage of the specific version of the operating system.
254 <varname>SUPPORT_URL=
</varname> should refer to the main
255 support page for the operating system, if there is any. This
256 is primarily intended for operating systems which vendors
257 provide support for.
<varname>BUG_REPORT_URL=
</varname> should
258 refer to the main bug reporting page for the operating system,
259 if there is any. This is primarily intended for operating
260 systems that rely on community QA.
261 <varname>PRIVACY_POLICY_URL=
</varname> should refer to the
262 main privacy policy page for the operation system, if there is
263 any. These settings are optional, and providing only some of
264 these settings is common. These URLs are intended to be
265 exposed in
"About this system" UIs behind links with captions
266 such as
"About this Operating System",
"Obtain Support",
267 "Report a Bug", or
"Privacy Policy". The values should be in
268 <ulink url=
"https://tools.ietf.org/html/rfc3986">RFC3986
269 format
</ulink>, and should be
<literal>http:
</literal> or
270 <literal>https:
</literal> URLs, and possibly
271 <literal>mailto:
</literal> or
<literal>tel:
</literal>. Only
272 one URL shall be listed in each setting. If multiple resources
273 need to be referenced, it is recommended to provide an online
274 landing page linking all available resources. Examples:
275 <literal>HOME_URL=
"https://fedoraproject.org/"</literal> and
276 <literal>BUG_REPORT_URL=
"https://bugzilla.redhat.com/"</literal></para></listitem>
280 <term><varname>BUILD_ID=
</varname></term>
282 <listitem><para>A string uniquely identifying the system image
283 used as the origin for a distribution (it is not updated with
284 system updates). The field can be identical between different
285 VERSION_IDs as BUILD_ID is an only a unique identifier to a
286 specific version. Distributions that release each update as a
287 new version would only need to use VERSION_ID as each build is
288 already distinct based on the VERSION_ID. This field is
289 optional. Example:
<literal>BUILD_ID=
"2013-03-20.3"</literal>
290 or
<literal>BUILD_ID=
201303203</literal>.
296 <term><varname>VARIANT=
</varname></term>
299 A string identifying a specific variant or edition of the
300 operating system suitable for presentation to the user. This
301 field may be used to inform the user that the configuration of
302 this system is subject to a specific divergent set of rules or
303 default configuration settings. This field is optional and may
304 not be implemented on all systems.
306 <literal>VARIANT=
"Server Edition"</literal>,
307 <literal>VARIANT=
"Smart Refrigerator Edition"</literal>
308 Note: this field is for display purposes only. The
309 <varname>VARIANT_ID
</varname> field should be used for making
310 programmatic decisions.
315 <term><varname>VARIANT_ID=
</varname></term>
318 A lower-case string (no spaces or other characters outside of
319 0–
9, a–z,
".",
"_" and
"-"), identifying a specific variant or
320 edition of the operating system. This may be interpreted by
321 other packages in order to determine a divergent default
322 configuration. This field is optional and may not be
323 implemented on all systems.
325 <literal>VARIANT_ID=server
</literal>,
326 <literal>VARIANT_ID=embedded
</literal>
332 <para>If you are reading this file from C code or a shell script
333 to determine the OS or a specific version of it, use the
334 <varname>ID
</varname> and
<varname>VERSION_ID
</varname> fields,
335 possibly with
<varname>ID_LIKE
</varname> as fallback for
336 <varname>ID
</varname>. When looking for an OS identification
337 string for presentation to the user use the
338 <varname>PRETTY_NAME
</varname> field.
</para>
340 <para>Note that operating system vendors may choose not to provide
341 version information, for example to accommodate for rolling
342 releases. In this case,
<varname>VERSION
</varname> and
343 <varname>VERSION_ID
</varname> may be unset. Applications should
344 not rely on these fields to be set.
</para>
346 <para>Operating system vendors may extend the file
347 format and introduce new fields. It is highly
348 recommended to prefix new fields with an OS specific
349 name in order to avoid name clashes. Applications
350 reading this file must ignore unknown fields. Example:
351 <literal>DEBIAN_BTS=
"debbugs://bugs.debian.org/"</literal></para>
355 <title>Example
</title>
357 <programlisting>NAME=Fedora
358 VERSION=
"17 (Beefy Miracle)"
361 PRETTY_NAME=
"Fedora 17 (Beefy Miracle)"
363 CPE_NAME=
"cpe:/o:fedoraproject:fedora:17"
364 HOME_URL=
"https://fedoraproject.org/"
365 BUG_REPORT_URL=
"https://bugzilla.redhat.com/"</programlisting>
369 <title>See Also
</title>
371 <citerefentry><refentrytitle>systemd
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
372 <citerefentry project='die-net'
><refentrytitle>lsb_release
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
373 <citerefentry><refentrytitle>hostname
</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
374 <citerefentry><refentrytitle>machine-id
</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
375 <citerefentry><refentrytitle>machine-info
</refentrytitle><manvolnum>5</manvolnum></citerefentry>