Debian Codegraph @

man/standard-conf.xml

raw
1 <?xml version="1.0"?>
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
4
5 <!--
6 SPDX-License-Identifier: LGPL-2.1-or-later
7 Copyright © 2014 Josh Triplett
8 -->
9
10 <refentry xmlns:xi="http://www.w3.org/2001/XInclude">
11 <refnamediv>
12 <refname/>
13 <refpurpose/>
14 </refnamediv>
15
16 <refsect1 id='confd'>
17 <title>Configuration Directories and Precedence</title>
18
19 <para>Configuration files are read from directories in <filename>/etc/</filename>,
20 <filename>/run/</filename>, <filename>/usr/local/lib/</filename>, and <filename>/usr/lib/</filename>, in
21 order of precedence, as listed in the SYNOPSIS section above. Files must have the
22 <literal>.conf</literal> extension. Files in <filename>/etc/</filename> override files with the same name
23 in <filename>/run/</filename>, <filename>/usr/local/lib/</filename>, and
24 <filename>/usr/lib/</filename>. Files in <filename>/run/</filename> override files with the same name
25 under <filename>/usr/</filename>.</para>
26
27 <para>All configuration files are sorted by their filename in lexicographic order, regardless of which of
28 the directories they reside in. If multiple files specify the same option, the entry in the file with the
29 lexicographically latest name will take precedence. Thus, the configuration in a certain file may either
30 be replaced completely (by placing a file with the same name in a directory with higher priority), or
31 individual settings might be changed (by specifying additional settings in a file with a different name
32 that is ordered later).</para>
33
34 <para>Packages should install their configuration files in <filename>/usr/lib/</filename> (distribution
35 packages) or <filename>/usr/local/lib/</filename> (local installs)
36 <xi:include xpointer="usr-local-footnote" />.
37 Files in <filename>/etc/</filename> are reserved for the local administrator, who may use this logic to
38 override the configuration files installed by vendor packages.</para>
39
40 <para>It is recommended to prefix all filenames with a two-digit number and a dash to simplify the
41 ordering. It is recommended to use the range 10-40 for configuration files in <filename>/usr/</filename>
42 and the range 60-90 for configuration files in <filename>/etc/</filename> and <filename>/run/</filename>,
43 to make sure that local and transient configuration files will always take priority over configuration
44 files shipped by the OS vendor.</para>
45
46 <para>If the administrator wants to disable a configuration file supplied by the vendor, the recommended
47 way is to place a symlink to <filename>/dev/null</filename> in the configuration directory in
48 <filename>/etc/</filename>, with the same filename as the vendor configuration file. If the vendor
49 configuration file is included in the initrd image, the image has to be regenerated.</para>
50 </refsect1>
51
52 <refsect1 id='main-conf'>
53 <title>Configuration Directories and Precedence</title>
54
55 <para>The default configuration is set during compilation, so configuration is only needed when it is
56 necessary to deviate from those defaults. The main configuration file is loaded from one of the
57 listed directories in order of priority, only the first file found is used:
58 <filename>/etc/systemd/</filename>,
59 <filename>/run/systemd/</filename>,
60 <filename>/usr/local/lib/systemd/</filename> <xi:include xpointer="usr-local-footnote" />,
61 <filename>/usr/lib/systemd/</filename>.
62 The vendor version of the file contains commented out entries showing the defaults as a guide to the
63 administrator. Local overrides can also be created by creating drop-ins, as described below. The main
64 configuration file can also be edited for this purpose (or a copy in <filename>/etc/</filename> if it is
65 shipped under <filename>/usr/</filename>), however using drop-ins for local configuration is recommended
66 over modifications to the main configuration file.</para>
67
68 <para>In addition to the main configuration file, drop-in configuration snippets are read from
69 <filename>/usr/lib/systemd/*.conf.d/</filename>, <filename>/usr/local/lib/systemd/*.conf.d/</filename>,
70 and <filename>/etc/systemd/*.conf.d/</filename>. Those drop-ins have higher precedence and override the
71 main configuration file. Files in the <filename>*.conf.d/</filename> configuration subdirectories are
72 sorted by their filename in lexicographic order, regardless of in which of the subdirectories they
73 reside. When multiple files specify the same option, for options which accept just a single value, the
74 entry in the file sorted last takes precedence, and for options which accept a list of values, entries
75 are collected as they occur in the sorted files.</para>
76
77 <para>When packages need to customize the configuration, they can install drop-ins under
78 <filename>/usr/</filename>. Files in <filename>/etc/</filename> are reserved for the local administrator,
79 who may use this logic to override the configuration files installed by vendor packages. Drop-ins have to
80 be used to override package drop-ins, since the main configuration file has lower precedence. It is
81 recommended to prefix all filenames in those subdirectories with a two-digit number and a dash, to
82 simplify the ordering. This also defines a concept of drop-in priorities to allow OS vendors to ship
83 drop-ins within a specific range lower than the range used by users. This should lower the risk of
84 package drop-ins overriding accidentally drop-ins defined by users. It is recommended to use the range
85 10-40 for drop-ins in <filename>/usr/</filename> and the range 60-90 for drop-ins in
86 <filename>/etc/</filename> and <filename>/run/</filename>, to make sure that local and transient drop-ins
87 take priority over drop-ins shipped by the OS vendor.</para>
88
89 <para>To disable a configuration file supplied by the vendor, the recommended way is to place a symlink
90 to <filename>/dev/null</filename> in the configuration directory in <filename>/etc/</filename>, with the
91 same filename as the vendor configuration file.</para>
92 </refsect1>
93
94 <refsect1>
95 <title>Extras</title>
96
97 <para><filename>/usr/local/lib/systemd</filename>
98 <footnote id='usr-local-footnote'>
99 <para>💣💥🧨💥💥💣 Please note that those configuration files must be available at all times. If
100 <filename>/usr/local/</filename> is a separate partition, it may not be available during early boot,
101 and must not be used for configuration.</para>
102 </footnote>
103 </para>
104 </refsect1>
105
106 </refentry>