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 This file is part of systemd.
8 Copyright 2010 Lennart Poettering
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
24 <refentry id="os-release">
26 <title>os-release</title>
27 <productname>systemd</productname>
31 <contrib>Developer</contrib>
32 <firstname>Lennart</firstname>
33 <surname>Poettering</surname>
34 <email>lennart@poettering.net</email>
40 <refentrytitle>os-release</refentrytitle>
41 <manvolnum>5</manvolnum>
45 <refname>os-release</refname>
46 <refpurpose>Operating system identification</refpurpose>
50 <para><filename>/etc/os-release</filename></para>
51 <para><filename>/usr/lib/os-release</filename></para>
55 <title>Description</title>
57 <para>The <filename>/etc/os-release</filename> and
58 <filename>/usr/lib/os-release</filename> files contain operating
59 system identification data.</para>
61 <para>The basic file format of <filename>os-release</filename> is
62 a newline-separated list of environment-like shell-compatible
63 variable assignments. It is possible to source the configuration
64 from shell scripts, however, beyond mere variable assignments, no
65 shell features are supported (this means variable expansion is
66 explicitly not supported), allowing applications to read the file
67 without implementing a shell compatible execution engine. Variable
68 assignment values must be enclosed in double or single quotes if
69 they include spaces, semicolons or other special characters
70 outside of A-Z, a-z, 0-9. Shell special characters ("$", quotes,
71 backslash, backtick) must be escaped with backslashes, following
72 shell style. All strings should be in UTF-8 format, and
73 non-printable characters should not be used. It is not supported
74 to concatenate multiple individually quoted strings. Lines
75 beginning with "#" shall be ignored as comments.</para>
77 <para>The file <filename>/etc/os-release</filename> takes
78 precedence over <filename>/usr/lib/os-release</filename>.
79 Applications should check for the former, and exclusively use its
80 data if it exists, and only fall back to
81 <filename>/usr/lib/os-release</filename> if it is missing.
82 Applications should not read data from both files at the same
83 time. <filename>/usr/lib/os-release</filename> is the recommended
84 place to store OS release information as part of vendor trees.
85 <filename>/etc/os-release</filename> should be a relative symlink
86 to <filename>/usr/lib/os-release</filename>, to provide
87 compatibility with applications only looking at
88 <filename>/etc</filename>. A relative symlink instead of an
89 absolute symlink is necessary to avoid breaking the link in a
90 chroot or initrd environment such as dracut.</para>
92 <para><filename>os-release</filename> contains data that is
93 defined by the operating system vendor and should generally not be
94 changed by the administrator.</para>
96 <para>As this file only encodes names and identifiers it should
97 not be localized.</para>
99 <para>The <filename>/etc/os-release</filename> and
100 <filename>/usr/lib/os-release</filename> files might be symlinks
101 to other files, but it is important that the file is available
102 from earliest boot on, and hence must be located on the root file
105 <para>For a longer rationale for <filename>os-release</filename>
106 please refer to the <ulink
107 url="http://0pointer.de/blog/projects/os-release">Announcement of
108 <filename>/etc/os-release</filename></ulink>.</para>
112 <title>Options</title>
114 <para>The following OS identifications parameters may be set using
115 <filename>os-release</filename>:</para>
120 <term><varname>NAME=</varname></term>
122 <listitem><para>A string identifying the operating system,
123 without a version component, and suitable for presentation to
124 the user. If not set, defaults to
125 <literal>NAME=Linux</literal>. Example:
126 <literal>NAME=Fedora</literal> or <literal>NAME="Debian
127 GNU/Linux"</literal>.</para></listitem>
131 <term><varname>VERSION=</varname></term>
133 <listitem><para>A string identifying the operating system
134 version, excluding any OS name information, possibly including
135 a release code name, and suitable for presentation to the
136 user. This field is optional. Example:
137 <literal>VERSION=17</literal> or <literal>VERSION="17 (Beefy
138 Miracle)"</literal>.</para></listitem>
142 <term><varname>ID=</varname></term>
144 <listitem><para>A lower-case string (no spaces or other
145 characters outside of 0-9, a-z, ".", "_" and "-") identifying
146 the operating system, excluding any version information and
147 suitable for processing by scripts or usage in generated
148 filenames. If not set, defaults to
149 <literal>ID=linux</literal>. Example:
150 <literal>ID=fedora</literal> or
151 <literal>ID=debian</literal>.</para></listitem>
155 <term><varname>ID_LIKE=</varname></term>
157 <listitem><para>A space-separated list of operating system
158 identifiers in the same syntax as the <varname>ID=</varname>
159 setting. It should list identifiers of operating systems that
160 are closely related to the local operating system in regards
161 to packaging and programming interfaces, for example listing
162 one or more OS identifiers the local OS is a derivative from.
163 An OS should generally only list other OS identifiers it
164 itself is a derivative of, and not any OSes that are derived
165 from it, though symmetric relationships are possible. Build
166 scripts and similar should check this variable if they need to
167 identify the local operating system and the value of
168 <varname>ID=</varname> is not recognized. Operating systems
169 should be listed in order of how closely the local operating
170 system relates to the listed ones, starting with the closest.
171 This field is optional. Example: for an operating system with
172 <literal>ID=centos</literal>, an assignment of
173 <literal>ID_LIKE="rhel fedora"</literal> would be appropriate.
174 For an operating system with <literal>ID=ubuntu</literal>, an
175 assignment of <literal>ID_LIKE=debian</literal> is
176 appropriate.</para></listitem>
180 <term><varname>VERSION_ID=</varname></term>
182 <listitem><para>A lower-case string (mostly numeric, no spaces
183 or other characters outside of 0-9, a-z, ".", "_" and "-")
184 identifying the operating system version, excluding any OS
185 name information or release code name, and suitable for
186 processing by scripts or usage in generated filenames. This
187 field is optional. Example: <literal>VERSION_ID=17</literal>
188 or <literal>VERSION_ID=11.04</literal>.</para></listitem>
192 <term><varname>PRETTY_NAME=</varname></term>
194 <listitem><para>A pretty operating system name in a format
195 suitable for presentation to the user. May or may not contain
196 a release code name or OS version of some kind, as suitable.
197 If not set, defaults to
198 <literal>PRETTY_NAME="Linux"</literal>. Example:
199 <literal>PRETTY_NAME="Fedora 17 (Beefy
200 Miracle)"</literal>.</para></listitem>
204 <term><varname>ANSI_COLOR=</varname></term>
206 <listitem><para>A suggested presentation color when showing
207 the OS name on the console. This should be specified as string
208 suitable for inclusion in the ESC [ m ANSI/ECMA-48 escape code
209 for setting graphical rendition. This field is optional.
210 Example: <literal>ANSI_COLOR="0;31"</literal> for red, or
211 <literal>ANSI_COLOR="1;34"</literal> for light
212 blue.</para></listitem>
216 <term><varname>CPE_NAME=</varname></term>
218 <listitem><para>A CPE name for the operating system, following
219 the <ulink url="https://cpe.mitre.org/specification/">Common
220 Platform Enumeration Specification</ulink> as proposed by the
221 MITRE Corporation. This field is optional. Example:
222 <literal>CPE_NAME="cpe:/o:fedoraproject:fedora:17"</literal>
227 <term><varname>HOME_URL=</varname></term>
228 <term><varname>SUPPORT_URL=</varname></term>
229 <term><varname>BUG_REPORT_URL=</varname></term>
230 <term><varname>PRIVACY_POLICY_URL=</varname></term>
232 <listitem><para>Links to resources on the Internet related the
233 operating system. <varname>HOME_URL=</varname> should refer to
234 the homepage of the operating system, or alternatively some
235 homepage of the specific version of the operating system.
236 <varname>SUPPORT_URL=</varname> should refer to the main
237 support page for the operating system, if there is any. This
238 is primarily intended for operating systems which vendors
239 provide support for. <varname>BUG_REPORT_URL=</varname> should
240 refer to the main bug reporting page for the operating system,
241 if there is any. This is primarily intended for operating
242 systems that rely on community QA.
243 <varname>PRIVACY_POLICY_URL=</varname> should refer to the
244 main privacy policy page for the operation system, if there is
245 any. These settings are optional, and providing only some of
246 these settings is common. These URLs are intended to be
247 exposed in "About this system" UIs behind links with captions
248 such as "About this Operating System", "Obtain Support",
249 "Report a Bug", or "Privacy Policy". The values should be in
250 <ulink url="https://tools.ietf.org/html/rfc3986">RFC3986
251 format</ulink>, and should be <literal>http:</literal> or
252 <literal>https:</literal> URLs, and possibly
253 <literal>mailto:</literal> or <literal>tel:</literal>. Only
254 one URL shall be listed in each setting. If multiple resources
255 need to be referenced, it is recommended to provide an online
256 landing page linking all available resources. Examples:
257 <literal>HOME_URL="https://fedoraproject.org/"</literal> and
258 <literal>BUG_REPORT_URL="https://bugzilla.redhat.com/"</literal></para></listitem>
262 <term><varname>BUILD_ID=</varname></term>
264 <listitem><para>A string uniquely identifying the system image
265 used as the origin for a distribution (it is not updated with
266 system updates). The field can be identical between different
267 VERSION_IDs as BUILD_ID is an only a unique identifier to a
268 specific version. Distributions that release each update as a
269 new version would only need to use VERSION_ID as each build is
270 already distinct based on the VERSION_ID. This field is
271 optional. Example: <literal>BUILD_ID="2013-03-20.3"</literal>
272 or <literal>BUILD_ID=201303203</literal>.
279 <para>If you are reading this file from C code or a shell script
280 to determine the OS or a specific version of it, use the
281 <varname>ID</varname> and <varname>VERSION_ID</varname> fields,
282 possibly with <varname>ID_LIKE</varname> as fallback for
283 <varname>ID</varname>. When looking for an OS identification
284 string for presentation to the user use the
285 <varname>PRETTY_NAME</varname> field.</para>
287 <para>Note that operating system vendors may choose not to provide
288 version information, for example to accommodate for rolling
289 releases. In this case, <varname>VERSION</varname> and
290 <varname>VERSION_ID</varname> may be unset. Applications should
291 not rely on these fields to be set.</para>
293 <para>Operating system vendors may extend the file
294 format and introduce new fields. It is highly
295 recommended to prefix new fields with an OS specific
296 name in order to avoid name clashes. Applications
297 reading this file must ignore unknown fields. Example:
298 <literal>DEBIAN_BTS="debbugs://bugs.debian.org/"</literal></para>
302 <title>Example</title>
304 <programlisting>NAME=Fedora
305 VERSION="17 (Beefy Miracle)"
308 PRETTY_NAME="Fedora 17 (Beefy Miracle)"
310 CPE_NAME="cpe:/o:fedoraproject:fedora:17"
311 HOME_URL="https://fedoraproject.org/"
312 BUG_REPORT_URL="https://bugzilla.redhat.com/"</programlisting>
316 <title>See Also</title>
318 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
319 <citerefentry><refentrytitle>lsb_release</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
320 <citerefentry><refentrytitle>hostname</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
321 <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
322 <citerefentry><refentrytitle>machine-info</refentrytitle><manvolnum>5</manvolnum></citerefentry>