1SYSTEMD.PRESET(5)               systemd.preset               SYSTEMD.PRESET(5)
2
3
4

NAME

6       systemd.preset - Service enablement presets
7

SYNOPSIS

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

DESCRIPTION

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

PRESET FILE FORMAT

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. Multiple instance names for unit templates may be specified as
51       a space separated list at the end of the line instead of the customary
52       position between "@" and the unit suffix.
53
54       Presets must refer to the "real" unit file, and not to any aliases. See
55       systemd.unit(5) for a description of unit aliasing.
56
57       Two different directives are understood: "enable" may be used to enable
58       units by default, "disable" to disable units by default.
59
60       If multiple lines apply to a unit name, the first matching one takes
61       precedence over all others.
62
63       Each preset file shall be named in the style of
64       <priority>-<policy-name>.preset. Files in /etc/ override files with the
65       same name in /usr/lib/ and /run/. Files in /run/ override files with
66       the same name in /usr/lib/. Packages should install their preset files
67       in /usr/lib/. Files in /etc/ are reserved for the local administrator,
68       who may use this logic to override the preset files installed by vendor
69       packages. All preset files are sorted by their filename in
70       lexicographic order, regardless of which of the directories they reside
71       in. If multiple files specify the same unit name, the entry in the file
72       with the lexicographically earliest name will be applied. It is
73       recommended to prefix all filenames with a two-digit number and a dash,
74       to simplify the ordering of the files.
75
76       If the administrator wants to disable a preset file supplied by the
77       vendor, the recommended way is to place a symlink to /dev/null in
78       /etc/systemd/system-preset/ bearing the same filename.
79

EXAMPLES

81       Example 1. Default to off
82
83           # /usr/lib/systemd/system-preset/99-default.preset
84
85           disable *
86
87       This disables all units. Due to the filename prefix "99-", it will be
88       read last and hence can easily be overridden by spin or administrator
89       preset policy.
90
91       Example 2. Enable multiple template instances
92
93           # /usr/lib/systemd/system-preset/80-dirsrv.preset
94
95           enable dirsrv@.service foo bar baz
96
97       This enables all three of dirsrv@foo.service, dirsrv@bar.service and
98       dirsrv@baz.service.
99
100       Example 3. A GNOME spin
101
102           # /usr/lib/systemd/system-preset/50-gnome.preset
103
104           enable gdm.service
105           enable colord.service
106           enable accounts-daemon.service
107           enable avahi-daemon.*
108
109       This enables the three mentioned units, plus all avahi-daemon
110       regardless of which unit type. A file like this could be useful for
111       inclusion in a GNOME spin of a distribution. It will ensure that the
112       units necessary for GNOME are properly enabled as they are installed.
113       It leaves all other units untouched, and subject to other (later)
114       preset files, for example like the one from the first example above.
115
116       Example 4. Administrator policy
117
118           # /etc/systemd/system-preset/00-lennart.preset
119
120           enable httpd.service
121           enable sshd.service
122           enable postfix.service
123           disable *
124
125       This enables three specific services and disables all others. This is
126       useful for administrators to specifically select the units to enable,
127       and disable all others. Due to the filename prefix "00-" it will be
128       read early and override all other preset policy files.
129

SEE ALSO

131       systemd(1), systemctl(1), systemd-delta(1)
132

NOTES

134        1. Presets
135           https://www.freedesktop.org/wiki/Software/systemd/Preset
136
137
138
139systemd 245                                                  SYSTEMD.PRESET(5)
Impressum