]>
Commit | Line | Data |
---|---|---|
1 | <?xml version="1.0"?> | |
2 | <!DOCTYPE refsection 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+ | |
7 | Copyright © 2014 Josh Triplett | |
8 | --> | |
9 | ||
10 | <refsection> | |
11 | <refsection id='confd'> | |
12 | <title>Configuration Directories and Precedence</title> | |
13 | ||
14 | <para>Configuration files are read from directories in <filename>/etc/</filename>, | |
15 | <filename>/run/</filename>, <filename>/usr/local/lib/</filename>, and <filename>/usr/lib/</filename>, in | |
16 | order of precedence, as listed in the SYNOPSIS section above. Files must have the | |
17 | <literal>.conf</literal> extension. Files in <filename>/etc/</filename> override files with the same name | |
18 | in <filename>/run/</filename>, <filename>/usr/local/lib/</filename>, and | |
19 | <filename>/usr/lib/</filename>. Files in <filename>/run/</filename> override files with the same name | |
20 | under <filename>/usr/</filename>.</para> | |
21 | ||
22 | <para>All configuration files are sorted by their filename in lexicographic order, regardless of which of | |
23 | the directories they reside in. If multiple files specify the same option, the entry in the file with the | |
24 | lexicographically latest name will take precedence. Thus, the configuration in a certain file may either | |
25 | be replaced completely (by placing a file with the same name in a directory with higher priority), or | |
26 | individual settings might be changed (by specifying additional settings in a file with a different name | |
27 | that is ordered later).</para> | |
28 | ||
29 | <para>Packages should install their configuration files in <filename>/usr/lib/</filename> (distribution | |
30 | packages) or <filename>/usr/local/lib/</filename> (local installs). Files in <filename>/etc/</filename> | |
31 | are reserved for the local administrator, who may use this logic to override the configuration files | |
32 | installed by vendor packages. It is recommended to prefix all filenames with a two-digit number and a | |
33 | dash, to simplify the ordering of the files.</para> | |
34 | ||
35 | <para>If the administrator wants to disable a configuration file supplied by the vendor, the recommended | |
36 | way is to place a symlink to <filename>/dev/null</filename> in the configuration directory in | |
37 | <filename>/etc/</filename>, with the same filename as the vendor configuration file. If the vendor | |
38 | configuration file is included in the initrd image, the image has to be regenerated.</para> | |
39 | </refsection> | |
40 | ||
41 | <refsection id='main-conf'> | |
42 | <title>Configuration Directories and Precedence</title> | |
43 | ||
44 | <para>The default configuration is defined during compilation, so a | |
45 | configuration file is only needed when it is necessary to deviate | |
46 | from those defaults. By default, the configuration file in | |
47 | <filename>/etc/systemd/</filename> contains commented out entries | |
48 | showing the defaults as a guide to the administrator. This file | |
49 | can be edited to create local overrides. | |
50 | </para> | |
51 | ||
52 | <para>When packages need to customize the configuration, they can install configuration snippets in | |
53 | <filename>/usr/lib/systemd/*.conf.d/</filename> or <filename>/usr/local/lib/systemd/*.conf.d/</filename>. | |
54 | The main configuration file is read before any of the configuration directories, and has the lowest | |
55 | precedence; entries in a file in any configuration directory override entries in the single configuration | |
56 | file. Files in the <filename>*.conf.d/</filename> configuration subdirectories are sorted by their | |
57 | filename in lexicographic order, regardless of in which of the subdirectories they reside. When multiple | |
58 | files specify the same option, for options which accept just a single value, the entry in the file with | |
59 | the lexicographically latest name takes precedence. For options which accept a list of values, entries | |
60 | are collected as they occur in files sorted lexicographically.</para> | |
61 | ||
62 | <para>Files in <filename>/etc/</filename> are reserved for the local administrator, who may use this | |
63 | logic to override the configuration files installed by vendor packages. It is recommended to prefix all | |
64 | filenames in those subdirectories with a two-digit number and a dash, to simplify the ordering of the | |
65 | files.</para> | |
66 | ||
67 | <para>To disable a configuration file supplied by the vendor, the | |
68 | recommended way is to place a symlink to | |
69 | <filename>/dev/null</filename> in the configuration directory in | |
70 | <filename>/etc/</filename>, with the same filename as the vendor | |
71 | configuration file.</para> | |
72 | </refsection> | |
73 | </refsection> |