1SYSTEMD.PRESET(5) systemd.preset SYSTEMD.PRESET(5)
2
3
4
6 systemd.preset - Service enablement presets
7
9 /etc/systemd/system-preset/*.preset
10
11 /run/systemd/system-preset/*.preset
12
13 /usr/lib/systemd/system-preset/*.preset
14
15 /etc/systemd/user-preset/*.preset
16
17 /run/systemd/user-preset/*.preset
18
19 /usr/lib/systemd/user-preset/*.preset
20
22 Preset files may be used to encode policy which units shall be enabled
23 by default and which ones shall be disabled. They are read by systemctl
24 preset (for more information see systemctl(1)) which uses this
25 information to enable or disable a unit according to preset policy.
26 systemctl preset is used by the post install scriptlets of RPM packages
27 (or other OS package formats), to enable/disable specific units by
28 default on package installation, enforcing distribution, spin or
29 administrator preset policy. This allows choosing a certain set of
30 units to be enabled/disabled even before installing the actual package.
31
32 For more information on the preset logic please have a look at the
33 Presets[1] document.
34
35 It is not recommended to ship preset files within the respective
36 software packages implementing the units, but rather centralize them in
37 a distribution or spin default policy, which can be amended by
38 administrator policy.
39
40 If no preset files exist, systemctl preset will enable all units that
41 are installed by default. If this is not desired and all units shall
42 rather be disabled, it is necessary to ship a preset file with a
43 single, catchall "disable *" line. (See example 1, below.)
44
46 The preset files contain a list of directives consisting of either the
47 word "enable" or "disable" followed by a space and a unit name
48 (possibly with shell style wildcards), separated by newlines. Empty
49 lines and lines whose first non-whitespace character is # or ; are
50 ignored.
51
52 Presets must refer to the "real" unit file, and not to any aliases. See
53 systemd.unit(5) for a description of unit aliasing.
54
55 Two different directives are understood: "enable" may be used to enable
56 units by default, "disable" to disable units by default.
57
58 If multiple lines apply to a unit name, the first matching one takes
59 precedence over all others.
60
61 Each preset file shall be named in the style of
62 <priority>-<policy-name>.preset. Files in /etc/ override files with the
63 same name in /usr/lib/ and /run/. Files in /run/ override files with
64 the same name in /usr/lib/. Packages should install their preset files
65 in /usr/lib/. Files in /etc/ are reserved for the local administrator,
66 who may use this logic to override the preset files installed by vendor
67 packages. All preset files are sorted by their filename in
68 lexicographic order, regardless of which of the directories they reside
69 in. If multiple files specify the same unit name, the entry in the file
70 with the lexicographically earliest name will be applied. It is
71 recommended to prefix all filenames with a two-digit number and a dash,
72 to simplify the ordering of the files.
73
74 If the administrator wants to disable a preset file supplied by the
75 vendor, the recommended way is to place a symlink to /dev/null in
76 /etc/systemd/system-preset/ bearing the same filename.
77
79 Example 1. Default to off
80
81 # /usr/lib/systemd/system-preset/99-default.preset
82
83 disable *
84
85 This disables all units. Due to the filename prefix "99-", it will be
86 read last and hence can easily be overridden by spin or administrator
87 preset policy.
88
89 Example 2. A GNOME spin
90
91 # /usr/lib/systemd/system-preset/50-gnome.preset
92
93 enable gdm.service
94 enable colord.service
95 enable accounts-daemon.service
96 enable avahi-daemon.*
97
98 This enables the three mentioned units, plus all avahi-daemon
99 regardless of which unit type. A file like this could be useful for
100 inclusion in a GNOME spin of a distribution. It will ensure that the
101 units necessary for GNOME are properly enabled as they are installed.
102 It leaves all other units untouched, and subject to other (later)
103 preset files, for example like the one from the first example above.
104
105 Example 3. Administrator policy
106
107 # /etc/systemd/system-preset/00-lennart.preset
108
109 enable httpd.service
110 enable sshd.service
111 enable postfix.service
112 disable *
113
114 This enables three specific services and disables all others. This is
115 useful for administrators to specifically select the units to enable,
116 and disable all others. Due to the filename prefix "00-" it will be
117 read early and override all other preset policy files.
118
120 systemd(1), systemctl(1), systemd-delta(1)
121
123 1. Presets
124 https://www.freedesktop.org/wiki/Software/systemd/Preset
125
126
127
128systemd 243 SYSTEMD.PRESET(5)