Debian Codegraph @

upstream/fedora-rawhide/man5/systemd.unit.5

raw
1 '\" t
2 .TH "SYSTEMD\&.UNIT" "5" "" "systemd 261~rc2" "systemd.unit"
3 .\" -----------------------------------------------------------------
4 .\" * Define some portability stuff
5 .\" -----------------------------------------------------------------
6 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 .\" http://bugs.debian.org/507673
8 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
9 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10 .ie \n(.g .ds Aq \(aq
11 .el .ds Aq '
12 .\" -----------------------------------------------------------------
13 .\" * set default formatting
14 .\" -----------------------------------------------------------------
15 .\" disable hyphenation
16 .nh
17 .\" disable justification (adjust text to left margin only)
18 .ad l
19 .\" -----------------------------------------------------------------
20 .\" * MAIN CONTENT STARTS HERE *
21 .\" -----------------------------------------------------------------
22 .SH "NAME"
23 systemd.unit \- Unit configuration
24 .SH "SYNOPSIS"
25 .PP
26 \fIservice\fR\&.service, \fIsocket\fR\&.socket, \fIdevice\fR\&.device, \fImount\fR\&.mount, \fIautomount\fR\&.automount, \fIswap\fR\&.swap, \fItarget\fR\&.target, \fIpath\fR\&.path, \fItimer\fR\&.timer, \fIslice\fR\&.slice, \fIscope\fR\&.scope
27 .SS "System Unit Search Path"
28 .PP
29 .RS 4
30 /etc/systemd/system\&.control/*
31 .RE
32 .RS 4
33 /run/systemd/system\&.control/*
34 .RE
35 .RS 4
36 /run/systemd/transient/*
37 .RE
38 .RS 4
39 /run/systemd/generator\&.early/*
40 .RE
41 .RS 4
42 /etc/systemd/system/*
43 .RE
44 .RS 4
45 /etc/systemd/system\&.attached/*
46 .RE
47 .RS 4
48 /run/systemd/system/*
49 .RE
50 .RS 4
51 /run/systemd/system\&.attached/*
52 .RE
53 .RS 4
54 /run/systemd/generator/*
55 .RE
56 .RS 4
57 \&...
58 .RE
59 .RS 4
60 /usr/local/lib/systemd/system/*
61 .RE
62 .RS 4
63 /usr/lib/systemd/system/*
64 .RE
65 .RS 4
66 /run/systemd/generator\&.late/*
67 .RE
68 .SS "User Unit Search Path"
69 .PP
70 .RS 4
71 ~/\&.config/systemd/user\&.control/*
72 .RE
73 .RS 4
74 $XDG_RUNTIME_DIR/systemd/user\&.control/*
75 .RE
76 .RS 4
77 $XDG_RUNTIME_DIR/systemd/transient/*
78 .RE
79 .RS 4
80 $XDG_RUNTIME_DIR/systemd/generator\&.early/*
81 .RE
82 .RS 4
83 ~/\&.config/systemd/user/*
84 .RE
85 .RS 4
86 $XDG_CONFIG_DIRS/systemd/user/*
87 .RE
88 .RS 4
89 /etc/systemd/user/*
90 .RE
91 .RS 4
92 $XDG_RUNTIME_DIR/systemd/user/*
93 .RE
94 .RS 4
95 /run/systemd/user/*
96 .RE
97 .RS 4
98 $XDG_RUNTIME_DIR/systemd/generator/*
99 .RE
100 .RS 4
101 $XDG_DATA_HOME/systemd/user/*
102 .RE
103 .RS 4
104 $XDG_DATA_DIRS/systemd/user/*
105 .RE
106 .RS 4
107 \&...
108 .RE
109 .RS 4
110 /usr/local/lib/systemd/user/*
111 .RE
112 .RS 4
113 /usr/lib/systemd/user/*
114 .RE
115 .RS 4
116 $XDG_RUNTIME_DIR/systemd/generator\&.late/*
117 .RE
118 .SH "DESCRIPTION"
119 .PP
120 A unit file is a plain text ini\-style file that encodes information about a service, a socket, a device, a mount point, an automount point, a swap file or partition, a start\-up target, a watched file system path, a timer controlled and supervised by
121 \fBsystemd\fR(1), a resource management slice or a group of externally created processes\&. See
122 \fBsystemd.syntax\fR(7)
123 for a general description of the syntax\&.
124 .PP
125 This man page lists the common configuration options of all the unit types\&. These options need to be configured in the [Unit] or [Install] sections of the unit files\&.
126 .PP
127 In addition to the generic [Unit] and [Install] sections described here, each unit may have a type\-specific section, e\&.g\&. [Service] for a service unit\&. See the respective man pages for more information:
128 \fBsystemd.service\fR(5),
129 \fBsystemd.socket\fR(5),
130 \fBsystemd.device\fR(5),
131 \fBsystemd.mount\fR(5),
132 \fBsystemd.automount\fR(5),
133 \fBsystemd.swap\fR(5),
134 \fBsystemd.target\fR(5),
135 \fBsystemd.path\fR(5),
136 \fBsystemd.timer\fR(5),
137 \fBsystemd.slice\fR(5),
138 \fBsystemd.scope\fR(5)\&.
139 .PP
140 Unit files are loaded from a set of paths determined during compilation, described in the next section\&.
141 .PP
142 Valid unit names consist of a "unit name prefix", and a suffix specifying the unit type which begins with a dot\&. The "unit name prefix" must consist of one or more valid characters (ASCII letters, digits,
143 ":",
144 "\-",
145 "_",
146 "\&.", and
147 "\e")\&. The total length of the unit name including the suffix must not exceed 255 characters\&. The unit type suffix must be one of
148 "\&.service",
149 "\&.socket",
150 "\&.device",
151 "\&.mount",
152 "\&.automount",
153 "\&.swap",
154 "\&.target",
155 "\&.path",
156 "\&.timer",
157 "\&.slice", or
158 "\&.scope"\&.
159 .PP
160 Unit names can be parameterized by a single argument called the "instance name"\&. The unit is then constructed based on a "template file" which serves as the definition of multiple services or other units\&. A template unit must have a single
161 "@"
162 at the end of the unit name prefix (right before the type suffix)\&. The name of the full unit is formed by inserting the instance name between
163 "@"
164 and the unit type suffix\&. In the unit file itself, the instance parameter may be referred to using
165 "%i"
166 and other specifiers, see below\&.
167 .PP
168 Unit files may contain additional options on top of those listed here\&. If systemd encounters an unknown option, it will write a warning log message but continue loading the unit\&. If an option or section name is prefixed with
169 \fBX\-\fR, it is ignored completely by systemd\&. Options within an ignored section do not need the prefix\&. Applications may use this to include additional information in the unit files\&. To access those options, applications need to parse the unit files on their own\&.
170 .PP
171 Units can be aliased (have an alternative name), by creating a symlink from the new name to the existing name in one of the unit search paths\&. For example,
172 systemd\-networkd\&.service
173 has the alias
174 dbus\-org\&.freedesktop\&.network1\&.service, created during installation as a symlink, so when
175 \fBsystemd\fR
176 is asked through D\-Bus to load
177 dbus\-org\&.freedesktop\&.network1\&.service, it\*(Aqll load
178 systemd\-networkd\&.service\&. As another example,
179 default\&.target
180 \(em the default system target started at boot \(em is commonly aliased to either
181 multi\-user\&.target
182 or
183 graphical\&.target
184 to select what is started by default\&. Alias names may be used in commands like
185 \fBdisable\fR,
186 \fBstart\fR,
187 \fBstop\fR,
188 \fBstatus\fR, and similar, and in all unit dependency directives, including
189 \fIWants=\fR,
190 \fIRequires=\fR,
191 \fIBefore=\fR,
192 \fIAfter=\fR\&. Aliases cannot be used with the
193 \fBpreset\fR
194 command\&.
195 .PP
196 Aliases obey the following restrictions: a unit of a certain type ("\&.service",
197 "\&.socket", \&...) can only be aliased by a name with the same type suffix\&. A plain unit (not a template or an instance), may only be aliased by a plain name\&. A template instance may only be aliased by another template instance, and the instance part must be identical\&. A template may be aliased by another template (in which case the alias applies to all instances of the template)\&. As a special case, a template instance (e\&.g\&.
198 "alias@inst\&.service") may be a symlink to different template (e\&.g\&.
199 "template@inst\&.service")\&. In that case, just this specific instance is aliased, while other instances of the template (e\&.g\&.
200 "alias@foo\&.service",
201 "alias@bar\&.service") are not aliased\&. Those rules preserve the requirement that the instance (if any) is always uniquely defined for a given unit and all its aliases\&. The target of alias symlink must point to a valid unit file location, i\&.e\&. the symlink target name must match the symlink source name as described, and the destination path must be in one of the unit search paths, see UNIT FILE LOAD PATH section below for more details\&. Note that the target file might not exist, i\&.e\&. the symlink may be dangling\&.
202 .PP
203 Unit files may specify aliases through the
204 \fIAlias=\fR
205 directive in the [Install] section\&. When the unit is enabled, symlinks will be created for those names, and removed when the unit is disabled\&. For example,
206 reboot\&.target
207 specifies
208 \fIAlias=ctrl\-alt\-del\&.target\fR, so when enabled, the symlink
209 /etc/systemd/system/ctrl\-alt\-del\&.target
210 pointing to the
211 reboot\&.target
212 file will be created, and when
213 Ctrl+Alt+Del
214 is invoked,
215 \fBsystemd\fR
216 will look for
217 ctrl\-alt\-del\&.target, follow the symlink to
218 reboot\&.target, and execute
219 reboot\&.service
220 as part of that target\&.
221 \fBsystemd\fR
222 does not look at the [Install] section at all during normal operation, so any directives in that section only have an effect through the symlinks created during enablement\&.
223 .PP
224 Along with a unit file
225 foo\&.service, the directory
226 foo\&.service\&.wants/
227 may exist\&. All unit files symlinked from such a directory are implicitly added as dependencies of type
228 \fIWants=\fR
229 to the unit\&. Similar functionality exists for
230 \fIRequires=\fR
231 type dependencies as well, the directory suffix is
232 \&.requires/
233 in this case\&. This functionality is useful to hook units into the start\-up of other units, without having to modify their unit files\&. For details about the semantics of
234 \fIWants=\fR
235 and
236 \fIRequires=\fR, see below\&. The preferred way to create symlinks in the
237 \&.wants/
238 or
239 \&.requires/
240 directories is by specifying the dependency in [Install] section of the target unit, and creating the symlink in the file system with the
241 \fBenable\fR
242 or
243 \fBpreset\fR
244 commands of
245 \fBsystemctl\fR(1)\&. The target can be a normal unit (either plain or a specific instance of a template unit)\&. In case when the source unit is a template, the target can also be a template, in which case the instance will be "propagated" to the target unit to form a valid unit instance\&. The target of symlinks in
246 \&.wants/
247 or
248 \&.requires/
249 must thus point to a valid unit file location, i\&.e\&. the symlink target name must satisfy the described requirements, and the destination path must be in one of the unit search paths, see UNIT FILE LOAD PATH section below for more details\&. Note that the target file might not exist, i\&.e\&. the symlink may be dangling\&.
250 .PP
251 Along with a unit file
252 foo\&.service, a "drop\-in" directory
253 foo\&.service\&.d/
254 may exist\&. All files with the suffix
255 "\&.conf"
256 from this directory will be merged in the alphanumeric order and parsed after the main unit file itself has been parsed\&. This is useful to alter or add configuration settings for a unit, without having to modify unit files\&. Each drop\-in file must contain appropriate section headers\&. For instantiated units, this logic will first look for the instance
257 "\&.d/"
258 subdirectory (e\&.g\&.
259 "foo@bar\&.service\&.d/") and read its
260 "\&.conf"
261 files, followed by the template
262 "\&.d/"
263 subdirectory (e\&.g\&.
264 "foo@\&.service\&.d/") and the
265 "\&.conf"
266 files there\&. Moreover, for unit names containing dashes ("\-"), the set of directories generated by repeatedly truncating the unit name after all dashes is searched too\&. Specifically, for a unit name
267 foo\-bar\-baz\&.service
268 not only the regular drop\-in directory
269 foo\-bar\-baz\&.service\&.d/
270 is searched but also both
271 foo\-bar\-\&.service\&.d/
272 and
273 foo\-\&.service\&.d/\&. This is useful for defining common drop\-ins for a set of related units, whose names begin with a common prefix\&. This scheme is particularly useful for mount, automount and slice units, whose systematic naming structure is built around dashes as component separators\&. Note that equally named drop\-in files further down the prefix hierarchy override those further up, i\&.e\&.
274 foo\-bar\-\&.service\&.d/10\-override\&.conf
275 overrides
276 foo\-\&.service\&.d/10\-override\&.conf\&.
277 .PP
278 In cases of unit aliases (described above), dropins for the aliased name and all aliases are loaded\&. In the example of
279 default\&.target
280 aliasing
281 graphical\&.target,
282 default\&.target\&.d/,
283 default\&.target\&.wants/,
284 default\&.target\&.requires/,
285 graphical\&.target\&.d/,
286 graphical\&.target\&.wants/,
287 graphical\&.target\&.requires/
288 would all be read\&. For templates, dropins for the template, any template aliases, the template instance, and all alias instances are read\&. When just a specific template instance is aliased, then the dropins for the target template, the target template instance, and the alias template instance are read\&.
289 .PP
290 In addition to
291 /etc/systemd/system, the drop\-in
292 "\&.d/"
293 directories for system services can be placed in
294 /usr/lib/systemd/system
295 or
296 /run/systemd/system
297 directories\&. Drop\-in files in
298 /etc/
299 take precedence over those in
300 /run/
301 which in turn take precedence over those in
302 /usr/lib/\&. Drop\-in files under any of these directories take precedence over unit files wherever located\&. Multiple drop\-in files with different names are applied in lexicographic order, regardless of which of the directories they reside in\&.
303 .PP
304 Units also support a top\-level drop\-in with
305 \fItype\fR\&.d/, where
306 \fItype\fR
307 may be e\&.g\&.
308 "service"
309 or
310 "socket", that allows altering or adding to the settings of all corresponding unit files on the system\&. The formatting and precedence of applying drop\-in configurations follow what is defined above\&. Files in
311 \fItype\fR\&.d/
312 have lower precedence compared to files in name\-specific override directories\&. The usual rules apply: multiple drop\-in files with different names are applied in lexicographic order, regardless of which of the directories they reside in, so a file in
313 \fItype\fR\&.d/
314 applies to a unit only if there are no drop\-ins or masks with that name in directories with higher precedence\&. See Examples\&.
315 .PP
316 Note that while systemd offers a flexible dependency system between units it is recommended to use this functionality only sparingly and instead rely on techniques such as bus\-based or socket\-based activation which make dependencies implicit, resulting in a both simpler and more flexible system\&.
317 .PP
318 As mentioned above, a unit may be instantiated from a template file\&. This allows creation of multiple units from a single configuration file\&. If systemd looks for a unit configuration file, it will first search for the literal unit name in the file system\&. If that yields no success and the unit name contains an
319 "@"
320 character, systemd will look for a unit template that shares the same name but with the instance string (i\&.e\&. the part between the
321 "@"
322 character and the suffix) removed\&. Example: if a service
323 getty@tty3\&.service
324 is requested and no file by that name is found, systemd will look for
325 getty@\&.service
326 and instantiate a service from that configuration file if it is found\&.
327 .PP
328 To refer to the instance string from within the configuration file you may use the special
329 "%i"
330 specifier in many of the configuration options\&. See below for details\&.
331 .PP
332 If a unit file is empty (i\&.e\&. has the file size 0) or is symlinked to
333 /dev/null, its configuration will not be loaded and it appears with a load state of
334 "masked", and cannot be activated\&. Use this as an effective way to fully disable a unit, making it impossible to start it even manually\&.
335 .PP
336 Files (including directories) with names that match certain patterns are generally ignored\&. This includes names that start with a
337 "\&."
338 or end with a
339 "\&.ignore"\&.
340 .PP
341 When unit aliasing is introduced during reload/reexec (e\&.g\&., converting
342 b\&.service
343 to a symlink pointing to
344 a\&.service), the running state of the canonical unit (a\&.service) is preserved\&. The old serialized state of the now\-aliased unit is migrated to a new stub orphaned unit to prevent stale data from corrupting the canonical unit\*(Aqs live state\&. Dependencies referencing the alias name are automatically resolved to the canonical unit, and the dependency graph is rebuilt from unit files, ensuring consistency\&. If the now\-aliased unit had resources such as running processes, they will now be tracked under the new orphaned unit\&. Once all resources are gone (e\&.g\&. all processes have exited) the orphaned unit will be garbage collected automatically\&.
345 .PP
346 The unit file format is covered by the
347 \m[blue]\fBInterface Portability and Stability Promise\fR\m[]\&\s-2\u[1]\d\s+2\&.
348 .SH "STRING ESCAPING FOR INCLUSION IN UNIT NAMES"
349 .PP
350 Sometimes it is useful to convert arbitrary strings into unit names\&. To facilitate this, a method of string escaping is used, in order to map strings containing arbitrary byte values (except
351 \fBNUL\fR) into valid unit names and their restricted character set\&. A common special case are unit names that reflect paths to objects in the file system hierarchy\&. Example: a device unit
352 dev\-sda\&.device
353 refers to a device with the device node
354 /dev/sda
355 in the file system\&.
356 .PP
357 The escaping algorithm operates as follows: given a string, any
358 "/"
359 character is replaced by
360 "\-", and all other characters which are not ASCII alphanumerics,
361 ":",
362 "_"
363 or
364 "\&."
365 are replaced by C\-style
366 "\ex2d"
367 escapes\&. In addition,
368 "\&."
369 is replaced with such a C\-style escape when it would appear as the first character in the escaped string\&.
370 .PP
371 When the input qualifies as absolute file system path, this algorithm is extended slightly: the path to the root directory
372 "/"
373 is encoded as single dash
374 "\-"\&. In addition, any leading, trailing or duplicate
375 "/"
376 characters are removed from the string before transformation\&. Example:
377 /foo//bar/baz/
378 becomes
379 "foo\-bar\-baz"\&.
380 .PP
381 This escaping is fully reversible, as long as it is known whether the escaped string was a path (the unescaping results are different for paths and non\-path strings)\&. The
382 \fBsystemd-escape\fR(1)
383 command may be used to apply and reverse escaping on arbitrary strings\&. Use
384 \fBsystemd\-escape \-\-path\fR
385 to escape path strings, and
386 \fBsystemd\-escape\fR
387 without
388 \fB\-\-path\fR
389 otherwise\&.
390 .SH "AUTOMATIC DEPENDENCIES"
391 .SS "Implicit Dependencies"
392 .PP
393 A number of unit dependencies are implicitly established, depending on unit type and unit configuration\&. These implicit dependencies can make unit configuration file cleaner\&. For the implicit dependencies in each unit type, please refer to section "Implicit Dependencies" in respective man pages\&.
394 .PP
395 For example, service units with
396 \fIType=dbus\fR
397 automatically acquire dependencies of type
398 \fIRequires=\fR
399 and
400 \fIAfter=\fR
401 on
402 dbus\&.socket\&. See
403 \fBsystemd.service\fR(5)
404 for details\&.
405 .SS "Default Dependencies"
406 .PP
407 Default dependencies are similar to implicit dependencies, but can be turned on and off by setting
408 \fIDefaultDependencies=\fR
409 to
410 \fIyes\fR
411 (the default) and
412 \fIno\fR, while implicit dependencies are always in effect\&. See section "Default Dependencies" in respective man pages for the effect of enabling
413 \fIDefaultDependencies=\fR
414 in each unit types\&.
415 .PP
416 For example, target units will complement all configured dependencies of type
417 \fIWants=\fR
418 or
419 \fIRequires=\fR
420 with dependencies of type
421 \fIAfter=\fR\&. See
422 \fBsystemd.target\fR(5)
423 for details\&. Note that this behavior can be opted out by setting
424 \fIDefaultDependencies=no\fR
425 in the specified units, or it can be selectively overridden via an explicit
426 \fIBefore=\fR
427 dependency\&.
428 .SH "UNIT FILE LOAD PATH"
429 .PP
430 Unit files are loaded from a set of paths determined during compilation, described in the two tables below\&. Unit files found in directories listed earlier override files with the same name in directories lower in the list
431 \&\s-2\u[2]\d\s+2\&.
432 .PP
433 When the variable
434 \fI$SYSTEMD_UNIT_PATH\fR
435 is set, the contents of this variable overrides the unit load path\&. If
436 \fI$SYSTEMD_UNIT_PATH\fR
437 ends with an empty component (":"), the usual unit load path will be appended to the contents of the variable\&.
438 .sp
439 .it 1 an-trap
440 .nr an-no-space-flag 1
441 .nr an-break-flag 1
442 .br
443 .B Table\ \&1.\ \& Load path when running in system mode (\-\-system)\&.
444 .TS
445 allbox tab(:);
446 lB lB.
447 T{
448 Path
449 T}:T{
450 Description
451 T}
452 .T&
453 l l
454 l ^
455 l l
456 l l
457 l l
458 l l
459 l l
460 l l
461 l l
462 l l.
463 T{
464 /etc/systemd/system\&.control
465 T}:T{
466 Persistent and transient configuration created using the dbus API
467 T}
468 T{
469 /run/systemd/system\&.control
470 T}:
471 T{
472 /run/systemd/transient
473 T}:T{
474 Dynamic configuration for transient units
475 T}
476 T{
477 /run/systemd/generator\&.early
478 T}:T{
479 Generated units with high priority (see \fIearly\-dir\fR in \fBsystemd.generator\fR(7))
480 T}
481 T{
482 /etc/systemd/system
483 T}:T{
484 System units created by the administrator
485 T}
486 T{
487 /run/systemd/system
488 T}:T{
489 Runtime units
490 T}
491 T{
492 /run/systemd/generator
493 T}:T{
494 Generated units with medium priority (see \fInormal\-dir\fR in \fBsystemd.generator\fR(7))
495 T}
496 T{
497 /usr/local/lib/systemd/system
498 T}:T{
499 System units installed by the administrator
500 T}
501 T{
502 /usr/lib/systemd/system
503 T}:T{
504 System units installed by the distribution package manager
505 T}
506 T{
507 /run/systemd/generator\&.late
508 T}:T{
509 Generated units with low priority (see \fIlate\-dir\fR in \fBsystemd.generator\fR(7))
510 T}
511 .TE
512 .sp 1
513 .sp
514 .it 1 an-trap
515 .nr an-no-space-flag 1
516 .nr an-break-flag 1
517 .br
518 .B Table\ \&2.\ \& Load path when running in user mode (\-\-user)\&.
519 .TS
520 allbox tab(:);
521 lB lB.
522 T{
523 Path
524 T}:T{
525 Description
526 T}
527 .T&
528 l l
529 l ^
530 l l
531 l l
532 l l
533 l l
534 l l
535 l l
536 l l
537 l l
538 l l
539 l l
540 l l
541 l l
542 l l
543 l l.
544 T{
545 $XDG_CONFIG_HOME/systemd/user\&.control or ~/\&.config/systemd/user\&.control
546 T}:T{
547 Persistent and transient configuration created using the dbus API (\fI$XDG_CONFIG_HOME\fR is used if set, ~/\&.config otherwise)
548 T}
549 T{
550 $XDG_RUNTIME_DIR/systemd/user\&.control
551 T}:
552 T{
553 $XDG_RUNTIME_DIR/systemd/transient
554 T}:T{
555 Dynamic configuration for transient units
556 T}
557 T{
558 $XDG_RUNTIME_DIR/systemd/generator\&.early
559 T}:T{
560 Generated units with high priority (see \fIearly\-dir\fR in \fBsystemd.generator\fR(7))
561 T}
562 T{
563 $XDG_CONFIG_HOME/systemd/user or $HOME/\&.config/systemd/user
564 T}:T{
565 User configuration (\fI$XDG_CONFIG_HOME\fR is used if set, ~/\&.config otherwise)
566 T}
567 T{
568 $XDG_CONFIG_DIRS/systemd/user or /etc/xdg/systemd/user
569 T}:T{
570 Additional configuration directories as specified by the XDG base directory specification (\fI$XDG_CONFIG_DIRS\fR is used if set, /etc/xdg otherwise)
571 T}
572 T{
573 /etc/systemd/user
574 T}:T{
575 User units created by the administrator
576 T}
577 T{
578 $XDG_RUNTIME_DIR/systemd/user
579 T}:T{
580 Runtime units (only used when $XDG_RUNTIME_DIR is set)
581 T}
582 T{
583 /run/systemd/user
584 T}:T{
585 Runtime units
586 T}
587 T{
588 $XDG_RUNTIME_DIR/systemd/generator
589 T}:T{
590 Generated units with medium priority (see \fInormal\-dir\fR in \fBsystemd.generator\fR(7))
591 T}
592 T{
593 $XDG_DATA_HOME/systemd/user or $HOME/\&.local/share/systemd/user
594 T}:T{
595 Units of packages that have been installed in the home directory (\fI$XDG_DATA_HOME\fR is used if set, ~/\&.local/share otherwise)
596 T}
597 T{
598 $XDG_DATA_DIRS/systemd/user or /usr/local/share/systemd/user and /usr/share/systemd/user
599 T}:T{
600 Additional data directories as specified by the XDG base directory specification (\fI$XDG_DATA_DIRS\fR is used if set, /usr/local/share and /usr/share otherwise)
601 T}
602 T{
603 $dir/systemd/user for each \fI$dir\fR in \fI$XDG_DATA_DIRS\fR
604 T}:T{
605 Additional locations for installed user units, one for each entry in \fI$XDG_DATA_DIRS\fR
606 T}
607 T{
608 /usr/local/lib/systemd/user
609 T}:T{
610 User units installed by the administrator
611 T}
612 T{
613 /usr/lib/systemd/user
614 T}:T{
615 User units installed by the distribution package manager
616 T}
617 T{
618 $XDG_RUNTIME_DIR/systemd/generator\&.late
619 T}:T{
620 Generated units with low priority (see \fIlate\-dir\fR in \fBsystemd.generator\fR(7))
621 T}
622 .TE
623 .sp 1
624 .PP
625 The set of load paths for the user manager instance may be augmented or changed using various environment variables\&. And environment variables may in turn be set using environment generators, see
626 \fBsystemd.environment-generator\fR(7)\&. In particular,
627 \fI$XDG_DATA_HOME\fR
628 and
629 \fI$XDG_DATA_DIRS\fR
630 may be easily set using
631 \fBsystemd-environment-d-generator\fR(8)\&. Thus, directories listed here are just the defaults\&. To see the actual list that would be used based on compilation options and current environment use
632 .sp
633 .if n \{\
634 .RS 4
635 .\}
636 .nf
637 systemd\-analyze \-\-user unit\-paths
638 .fi
639 .if n \{\
640 .RE
641 .\}
642 .PP
643 Moreover, additional units might be loaded into systemd from directories not on the unit load path by creating a symlink pointing to a unit file in the directories\&. You can use
644 \fBsystemctl link\fR
645 for this; see
646 \fBsystemctl\fR(1)\&. The file system where the linked unit files are located must be accessible when systemd is started (e\&.g\&. anything underneath
647 /home/
648 or
649 /var/
650 is not allowed, unless those directories are located on the root file system)\&.
651 .PP
652 It is important to distinguish "linked unit files" from "unit file aliases": any symlink where the symlink
653 \fItarget\fR
654 is within the unit load path becomes an alias: the source name and the target file name must satisfy specific constraints listed above in the discussion of aliases, but the symlink target does not have to exist, and in fact the symlink target path is not used, except to check whether the target is within the unit load path\&. In contrast, a symlink which goes outside of the unit load path signifies a linked unit file\&. The symlink is followed when loading the file, but the destination name is otherwise unused (and may even not be a valid unit file name)\&. For example, symlinks
655 /etc/systemd/system/alias1\&.service
656 โ†’
657 service1\&.service,
658 /etc/systemd/system/alias2\&.service
659 โ†’
660 /usr/lib/systemd/service1\&.service,
661 /etc/systemd/system/alias3\&.service
662 โ†’
663 /etc/systemd/system/service1\&.service
664 are all valid aliases and
665 service1\&.service
666 will have four names, even if the unit file is located at
667 /run/systemd/system/service1\&.service\&. In contrast, a symlink
668 /etc/systemd/system/link1\&.service
669 โ†’
670 \&.\&./link1_service_file
671 means that
672 link1\&.service
673 is a "linked unit" and the contents of
674 /etc/systemd/link1_service_file
675 provide its configuration\&.
676 .SH "UNIT GARBAGE COLLECTION"
677 .PP
678 The system and service manager loads a unit\*(Aqs configuration automatically when a unit is referenced for the first time\&. It will automatically unload the unit configuration and state again when the unit is not needed anymore ("garbage collection")\&. A unit may be referenced through a number of different mechanisms:
679 .sp
680 .RS 4
681 .ie n \{\
682 \h'-04' 1.\h'+01'\c
683 .\}
684 .el \{\
685 .sp -1
686 .IP " 1." 4.2
687 .\}
688 Another loaded unit references it with a dependency such as
689 \fIAfter=\fR,
690 \fIWants=\fR, \&...
691 .RE
692 .sp
693 .RS 4
694 .ie n \{\
695 \h'-04' 2.\h'+01'\c
696 .\}
697 .el \{\
698 .sp -1
699 .IP " 2." 4.2
700 .\}
701 The unit is currently starting, running, reloading or stopping\&.
702 .RE
703 .sp
704 .RS 4
705 .ie n \{\
706 \h'-04' 3.\h'+01'\c
707 .\}
708 .el \{\
709 .sp -1
710 .IP " 3." 4.2
711 .\}
712 The unit is currently in the
713 \fBfailed\fR
714 state\&. (But see below\&.)
715 .RE
716 .sp
717 .RS 4
718 .ie n \{\
719 \h'-04' 4.\h'+01'\c
720 .\}
721 .el \{\
722 .sp -1
723 .IP " 4." 4.2
724 .\}
725 A job for the unit is pending\&.
726 .RE
727 .sp
728 .RS 4
729 .ie n \{\
730 \h'-04' 5.\h'+01'\c
731 .\}
732 .el \{\
733 .sp -1
734 .IP " 5." 4.2
735 .\}
736 The unit is pinned by an active IPC client program\&.
737 .RE
738 .sp
739 .RS 4
740 .ie n \{\
741 \h'-04' 6.\h'+01'\c
742 .\}
743 .el \{\
744 .sp -1
745 .IP " 6." 4.2
746 .\}
747 The unit is a special "perpetual" unit that is always active and loaded\&. Examples for perpetual units are the root mount unit
748 \-\&.mount
749 or the scope unit
750 init\&.scope
751 that the service manager itself lives in\&.
752 .RE
753 .sp
754 .RS 4
755 .ie n \{\
756 \h'-04' 7.\h'+01'\c
757 .\}
758 .el \{\
759 .sp -1
760 .IP " 7." 4.2
761 .\}
762 The unit has running processes associated with it\&.
763 .RE
764 .PP
765 The garbage collection logic may be altered with the
766 \fICollectMode=\fR
767 option, which allows configuration whether automatic unloading of units that are in
768 \fBfailed\fR
769 state is permissible, see below\&.
770 .PP
771 Note that when a unit\*(Aqs configuration and state is unloaded, all execution results, such as exit codes, exit signals, resource consumption and other statistics are lost, except for what is stored in the log subsystem\&.
772 .PP
773 Use
774 \fBsystemctl daemon\-reload\fR
775 or an equivalent command to reload unit configuration while the unit is already loaded\&. In this case, all configuration settings are flushed out and replaced with the new configuration (which however might not be in effect immediately), however all runtime state is saved/restored\&.
776 .SH "[UNIT] SECTION OPTIONS"
777 .PP
778 The unit file may include a [Unit] section, which carries generic information about the unit that is not dependent on the type of unit:
779 .PP
780 \fIDescription=\fR
781 .RS 4
782 A brief, meaningful, human\-readable text identifying the unit\&. This may be used by
783 \fBsystemd\fR
784 (and suitable UIs) as a user\-visible label for the unit, so this string should identify the unit rather than just describe it, despite the name\&. This string also should not just repeat the unit name\&.
785 "Apache HTTP Server"
786 or
787 "Postfix Mail Server"
788 are good examples\&. Bad examples are
789 "high\-performance lightweight HTTP server"
790 (too generic) or
791 "Apache"
792 (meaningless for people who do not know the Apache HTTP server project, duplicates the unit name)\&.
793 \fBsystemd\fR
794 may use this string as a noun in status messages ("Starting \fIDescription\fR\&.\&.\&.",
795 "Started \fIDescription\fR\&.",
796 "Reached target \fIDescription\fR\&.",
797 "Failed to start \fIDescription\fR\&."), so it should be capitalized, and should not be a full sentence, or a phrase with a verb conjugated in the present continuous, or end in a full stop\&. Bad examples include
798 "exiting the container",
799 "updating the database once per day\&.", or
800 "OpenSSH server second instance daemon"\&.
801 .sp
802 Added in version 201\&.
803 .RE
804 .PP
805 \fIDocumentation=\fR
806 .RS 4
807 A space\-separated list of URIs referencing documentation for this unit or its configuration\&. Accepted are only URIs of the types
808 "http://",
809 "https://",
810 "file:",
811 "info:",
812 "man:"\&. For more information about the syntax of these URIs, see
813 \fBuri\fR(7)\&. The URIs should be listed in order of relevance, starting with the most relevant\&. It is a good idea to first reference documentation that explains what the unit\*(Aqs purpose is, followed by how it is configured, followed by any other related documentation\&. This option may be specified more than once, in which case the specified list of URIs is merged\&. If the empty string is assigned to this option, the list is reset and all prior assignments will have no effect\&.
814 .sp
815 Added in version 201\&.
816 .RE
817 .PP
818 \fIWants=\fR
819 .RS 4
820 Configures (weak) requirement dependencies on other units\&. This option may be specified more than once or multiple space\-separated units may be specified in one option in which case dependencies for all listed names will be created\&. Dependencies of this type may also be configured outside of the unit configuration file by adding a symlink to a
821 \&.wants/
822 directory accompanying the unit file\&. For details, see above\&.
823 .sp
824 Units listed in this option will be started if the configuring unit is\&. However, if the listed units fail to start or cannot be added to the transaction, this has no impact on the validity of the transaction as a whole, and this unit will still be started\&. This is the recommended way to hook the start\-up of one unit to the start\-up of another unit\&.
825 .sp
826 Note that requirement dependencies do not influence the order in which services are started or stopped\&. This has to be configured independently with the
827 \fIAfter=\fR
828 or
829 \fIBefore=\fR
830 options\&. If unit
831 foo\&.service
832 pulls in unit
833 bar\&.service
834 as configured with
835 \fIWants=\fR
836 and no ordering is configured with
837 \fIAfter=\fR
838 or
839 \fIBefore=\fR, then both units will be started simultaneously and without any delay between them if
840 foo\&.service
841 is activated\&.
842 .sp
843 Added in version 201\&.
844 .RE
845 .PP
846 \fIRequires=\fR
847 .RS 4
848 Similar to
849 \fIWants=\fR, but declares a stronger requirement dependency\&. Dependencies of this type may also be configured by adding a symlink to a
850 \&.requires/
851 directory accompanying the unit file\&.
852 .sp
853 If this unit gets activated, the units listed will be activated as well\&. If one of the other units fails to activate, and an ordering dependency
854 \fIAfter=\fR
855 on the failing unit is set, this unit will not be started\&. Besides, with or without specifying
856 \fIAfter=\fR, this unit will be stopped (or restarted) if one of the other units is explicitly stopped (or restarted)\&.
857 .sp
858 Often, it is a better choice to use
859 \fIWants=\fR
860 instead of
861 \fIRequires=\fR
862 in order to achieve a system that is more robust when dealing with failing services\&.
863 .sp
864 Note that this dependency type does not imply that the other unit always has to be in active state when this unit is running\&. Specifically: failing condition checks (such as
865 \fIConditionPathExists=\fR,
866 \fIConditionPathIsSymbolicLink=\fR, \&... \(em see below) do not cause the start job of a unit with a
867 \fIRequires=\fR
868 dependency on it to fail\&. Also, some unit types may deactivate on their own (for example, a service process may decide to exit cleanly, or a device may be unplugged by the user), which is not propagated to units having a
869 \fIRequires=\fR
870 dependency\&. Use the
871 \fIBindsTo=\fR
872 dependency type together with
873 \fIAfter=\fR
874 to ensure that a unit may never be in active state without a specific other unit also in active state (see below)\&.
875 .sp
876 Added in version 201\&.
877 .RE
878 .PP
879 \fIRequisite=\fR
880 .RS 4
881 Similar to
882 \fIRequires=\fR\&. However, if the units listed here are not started already, they will not be started and the starting of this unit will fail immediately\&.
883 \fIRequisite=\fR
884 does not imply an ordering dependency, even if both units are started in the same transaction\&. Hence this setting should usually be combined with
885 \fIAfter=\fR, to ensure this unit is not started before the other unit\&.
886 .sp
887 When
888 \fIRequisite=b\&.service\fR
889 is used on
890 a\&.service, this dependency will show as
891 \fIRequisiteOf=a\&.service\fR
892 in property listing of
893 b\&.service\&.
894 \fIRequisiteOf=\fR
895 dependency cannot be specified directly\&.
896 .sp
897 Added in version 201\&.
898 .RE
899 .PP
900 \fIBindsTo=\fR
901 .RS 4
902 Configures requirement dependencies, very similar in style to
903 \fIRequires=\fR\&. However, this dependency type is stronger: in addition to the effects of
904 \fIRequires=\fR, which already stops (or restarts) the configuring unit when a listed unit is explicitly stopped (or restarted), it also does so when a listed unit stops unexpectedly (which includes when it fails)\&. Units can suddenly, unexpectedly enter inactive state for different reasons: the main process of a service unit might terminate on its own choice, the backing device of a device unit might be unplugged or the mount point of a mount unit might be unmounted without involvement of the system and service manager\&.
905 .sp
906 When used in conjunction with
907 \fIAfter=\fR
908 on the same unit the behaviour of
909 \fIBindsTo=\fR
910 is even stronger\&. In this case, the unit bound to strictly has to be in active state for this unit to also be in active state\&. This not only means a unit bound to another unit that suddenly enters inactive state, but also one that is bound to another unit that gets skipped due to an unmet condition check (such as
911 \fIConditionPathExists=\fR,
912 \fIConditionPathIsSymbolicLink=\fR, \&... \(em see below) will be stopped, should it be running\&. Hence, in many cases it is best to combine
913 \fIBindsTo=\fR
914 with
915 \fIAfter=\fR\&.
916 .sp
917 When
918 \fIBindsTo=b\&.service\fR
919 is used on
920 a\&.service, this dependency will show as
921 \fIBoundBy=a\&.service\fR
922 in property listing of
923 b\&.service\&.
924 \fIBoundBy=\fR
925 dependency cannot be specified directly\&.
926 .sp
927 Added in version 201\&.
928 .RE
929 .PP
930 \fIPartOf=\fR
931 .RS 4
932 Configures dependencies similar to
933 \fIRequires=\fR, but limited to stopping and restarting of units\&. When systemd stops or restarts the units listed here, the action is propagated to this unit\&. Note that this is a one\-way dependency\ \&\(em changes to this unit do not affect the listed units\&.
934 .sp
935 When
936 \fIPartOf=b\&.service\fR
937 is used on
938 a\&.service, this dependency will show as
939 \fIConsistsOf=a\&.service\fR
940 in property listing of
941 b\&.service\&.
942 \fIConsistsOf=\fR
943 dependency cannot be specified directly\&.
944 .sp
945 Added in version 201\&.
946 .RE
947 .PP
948 \fIUpholds=\fR
949 .RS 4
950 Configures dependencies similar to
951 \fIWants=\fR, but as long as this unit is up, all units listed in
952 \fIUpholds=\fR
953 are started whenever found to be inactive or failed, and no job is queued for them\&. While a
954 \fIWants=\fR
955 dependency on another unit has a one\-time effect when this units started, a
956 \fIUpholds=\fR
957 dependency on it has a continuous effect, constantly restarting the unit if necessary\&. This is an alternative to the
958 \fIRestart=\fR
959 setting of service units, to ensure they are kept running whatever happens\&. The restart happens without delay, and usual per\-unit rate\-limit applies\&.
960 .sp
961 When
962 \fIUpholds=b\&.service\fR
963 is used on
964 a\&.service, this dependency will show as
965 \fIUpheldBy=a\&.service\fR
966 in the property listing of
967 b\&.service\&.
968 .sp
969 Added in version 249\&.
970 .RE
971 .PP
972 \fIConflicts=\fR
973 .RS 4
974 A space\-separated list of unit names\&. Configures negative requirement dependencies\&. If a unit has a
975 \fIConflicts=\fR
976 requirement on a set of other units, then starting it will stop all of them and starting any of them will stop it\&.
977 .sp
978 Note that this setting does not imply an ordering dependency, similarly to the
979 \fIWants=\fR
980 and
981 \fIRequires=\fR
982 dependencies described above\&. This means that to ensure that the conflicting unit is stopped before the other unit is started, an
983 \fIAfter=\fR
984 or
985 \fIBefore=\fR
986 dependency must be declared\&. It does not matter which of the two ordering dependencies is used, because stop jobs are always ordered before start jobs, see the discussion in
987 \fIBefore=\fR/\fIAfter=\fR
988 below\&.
989 .sp
990 If unit A that conflicts with unit B is scheduled to be started at the same time as B, the transaction will either fail (in case both are required parts of the transaction) or be modified to be fixed (in case one or both jobs are not a required part of the transaction)\&. In the latter case, the job that is not required will be removed, or in case both are not required, the unit that conflicts will be started and the unit that is conflicted is stopped\&.
991 .sp
992 Added in version 201\&.
993 .RE
994 .PP
995 \fIBefore=\fR, \fIAfter=\fR
996 .RS 4
997 These two settings expect a space\-separated list of unit names\&. They may be specified more than once, in which case dependencies for all listed names are created\&.
998 .sp
999 Those two settings configure ordering dependencies between units\&. If unit
1000 foo\&.service
1001 contains the setting
1002 \fBBefore=bar\&.service\fR
1003 and both units are being started,
1004 bar\&.service\*(Aqs start\-up is delayed until
1005 foo\&.service
1006 has finished starting up\&.
1007 \fIAfter=\fR
1008 is the inverse of
1009 \fIBefore=\fR, i\&.e\&. while
1010 \fIBefore=\fR
1011 ensures that the configured unit is started before the listed unit begins starting up,
1012 \fIAfter=\fR
1013 ensures the opposite, that the listed unit is fully started up before the configured unit is started\&.
1014 .sp
1015 When two units with an ordering dependency between them are shut down, the inverse of the start\-up order is applied\&. I\&.e\&. if a unit is configured with
1016 \fIAfter=\fR
1017 on another unit, the former is stopped before the latter if both are shut down\&. Given two units with any ordering dependency between them, if one unit is shut down and the other is started up, the shutdown is ordered before the start\-up\&. It does not matter if the ordering dependency is
1018 \fIAfter=\fR
1019 or
1020 \fIBefore=\fR, in this case\&. It also does not matter which of the two is shut down, as long as one is shut down and the other is started up; the shutdown is ordered before the start\-up in all cases\&. If two units have no ordering dependencies between them, they are shut down or started up simultaneously, and no ordering takes place\&. It depends on the unit type when precisely a unit has finished starting up\&. Most importantly, for service units start\-up is considered completed for the purpose of
1021 \fIBefore=\fR/\fIAfter=\fR
1022 when all its configured start\-up commands have been invoked and they either failed or reported start\-up success\&. Note that this includes
1023 \fIExecStartPost=\fR
1024 (or
1025 \fIExecStopPost=\fR
1026 for the shutdown case)\&.
1027 .sp
1028 Note that those settings are independent of and orthogonal to the requirement dependencies as configured by
1029 \fIRequires=\fR,
1030 \fIWants=\fR,
1031 \fIRequisite=\fR, or
1032 \fIBindsTo=\fR\&. It is a common pattern to include a unit name in both the
1033 \fIAfter=\fR
1034 and
1035 \fIWants=\fR
1036 options, in which case the unit listed will be started before the unit that is configured with these options\&.
1037 .sp
1038 Note that
1039 \fIBefore=\fR
1040 dependencies on device units have no effect and are not supported\&. Devices generally become available as a result of an external hotplug event, and systemd creates the corresponding device unit without delay\&.
1041 .sp
1042 Added in version 201\&.
1043 .RE
1044 .PP
1045 \fIOnFailure=\fR
1046 .RS 4
1047 A space\-separated list of one or more units that are activated when this unit enters the
1048 "failed"
1049 state\&.
1050 .sp
1051 Added in version 201\&.
1052 .RE
1053 .PP
1054 \fIOnSuccess=\fR
1055 .RS 4
1056 A space\-separated list of one or more units that are activated when this unit enters the
1057 "inactive"
1058 state\&.
1059 .sp
1060 Added in version 249\&.
1061 .RE
1062 .PP
1063 \fIPropagatesReloadTo=\fR, \fIReloadPropagatedFrom=\fR
1064 .RS 4
1065 A space\-separated list of one or more units to which reload requests from this unit shall be propagated to, or units from which reload requests shall be propagated to this unit, respectively\&. Issuing a reload request on a unit will automatically also enqueue reload requests on all units that are linked to it using these two settings\&.
1066 .sp
1067 Added in version 201\&.
1068 .RE
1069 .PP
1070 \fIPropagatesStopTo=\fR, \fIStopPropagatedFrom=\fR
1071 .RS 4
1072 A space\-separated list of one or more units to which stop requests from this unit shall be propagated to, or units from which stop requests shall be propagated to this unit, respectively\&. Issuing a stop request on a unit will automatically also enqueue stop requests on all units that are linked to it using these two settings\&.
1073 .sp
1074 Added in version 249\&.
1075 .RE
1076 .PP
1077 \fIJoinsNamespaceOf=\fR
1078 .RS 4
1079 For units that start processes (such as service units), lists one or more other units whose network and/or temporary file namespace to join\&. If this is specified on a unit (say,
1080 a\&.service
1081 has
1082 \fIJoinsNamespaceOf=b\&.service\fR), then the inverse dependency (\fIJoinsNamespaceOf=a\&.service\fR
1083 for b\&.service) is implied\&. This only applies to unit types which support the
1084 \fIPrivateNetwork=\fR,
1085 \fINetworkNamespacePath=\fR,
1086 \fIPrivateIPC=\fR,
1087 \fIIPCNamespacePath=\fR, and
1088 \fIPrivateTmp=\fR
1089 directives (see
1090 \fBsystemd.exec\fR(5)
1091 for details)\&. If a unit that has this setting set is started, its processes will see the same
1092 /tmp/,
1093 /var/tmp/, IPC namespace and network namespace as one listed unit that is started\&. If multiple listed units are already started and these do not share their namespace, then it is not defined which namespace is joined\&. Note that this setting only has an effect if
1094 \fIPrivateNetwork=\fR/\fINetworkNamespacePath=\fR,
1095 \fIPrivateIPC=\fR/\fIIPCNamespacePath=\fR
1096 and/or
1097 \fIPrivateTmp=\fR
1098 is enabled for both the unit that joins the namespace and the unit whose namespace is joined\&.
1099 .sp
1100 Added in version 209\&.
1101 .RE
1102 .PP
1103 \fIRequiresMountsFor=\fR
1104 .RS 4
1105 Takes a space\-separated list of absolute paths\&. Automatically adds dependencies of type
1106 \fIRequires=\fR
1107 and
1108 \fIAfter=\fR
1109 for all mount units required to access the specified path\&.
1110 .sp
1111 Mount points marked with
1112 \fBnoauto\fR
1113 are not mounted automatically through
1114 local\-fs\&.target, but are still honored for the purposes of this option, i\&.e\&. they will be pulled in by this unit\&.
1115 .sp
1116 Added in version 201\&.
1117 .RE
1118 .PP
1119 \fIWantsMountsFor=\fR
1120 .RS 4
1121 Same as
1122 \fIRequiresMountsFor=\fR, but adds dependencies of type
1123 \fIWants=\fR
1124 instead of
1125 \fIRequires=\fR\&.
1126 .sp
1127 Added in version 256\&.
1128 .RE
1129 .PP
1130 \fIOnSuccessJobMode=\fR, \fIOnFailureJobMode=\fR
1131 .RS 4
1132 Takes a value of
1133 "fail",
1134 "replace",
1135 "replace\-irreversibly",
1136 "isolate",
1137 "flush",
1138 "ignore\-dependencies"
1139 or
1140 "ignore\-requirements"\&.
1141 "OnFailureJobMode="
1142 defaults to
1143 "replace",
1144 "OnSuccessJobMode="
1145 defaults to
1146 "fail"\&. Specifies how the units listed in
1147 \fIOnSuccess=\fR/\fIOnFailure=\fR
1148 will be enqueued\&. See
1149 \fBsystemctl\fR(1)\*(Aqs
1150 \fB\-\-job\-mode=\fR
1151 option for details on the possible values\&. If this is set to
1152 "isolate", only a single unit may be listed in
1153 \fIOnSuccess=\fR/\fIOnFailure=\fR\&.
1154 .sp
1155 Added in version 209\&.
1156 .RE
1157 .PP
1158 \fIIgnoreOnIsolate=\fR
1159 .RS 4
1160 Takes a boolean argument\&. If
1161 \fBtrue\fR, this unit will not be stopped when isolating another unit\&. Defaults to
1162 \fBfalse\fR
1163 for service, target, socket, timer, and path units, and
1164 \fBtrue\fR
1165 for slice, scope, device, swap, mount, and automount units\&.
1166 .sp
1167 Added in version 201\&.
1168 .RE
1169 .PP
1170 \fIStopWhenUnneeded=\fR
1171 .RS 4
1172 Takes a boolean argument\&. If
1173 \fBtrue\fR, this unit will be stopped when it is no longer used\&. Note that, in order to minimize the work to be executed, systemd will not stop units by default unless they are conflicting with other units, or the user explicitly requested their shut down\&. If this option is set, a unit will be automatically cleaned up if no other active unit requires it\&. Defaults to
1174 \fBfalse\fR\&.
1175 .sp
1176 Added in version 201\&.
1177 .RE
1178 .PP
1179 \fIRefuseManualStart=\fR, \fIRefuseManualStop=\fR
1180 .RS 4
1181 Takes a boolean argument\&. If
1182 \fBtrue\fR, this unit can only be activated or deactivated indirectly\&. In this case, explicit start\-up or termination requested by the user is denied, however if it is started or stopped as a dependency of another unit, start\-up or termination will succeed\&. This is mostly a safety feature to ensure that the user does not accidentally activate units that are not intended to be activated explicitly, and not accidentally deactivate units that are not intended to be deactivated\&. These options default to
1183 \fBfalse\fR\&.
1184 .sp
1185 Added in version 201\&.
1186 .RE
1187 .PP
1188 \fIAllowIsolate=\fR
1189 .RS 4
1190 Takes a boolean argument\&. If
1191 \fBtrue\fR, this unit may be used with the
1192 \fBsystemctl isolate\fR
1193 command\&. Otherwise, this will be refused\&. It probably is a good idea to leave this disabled except for target units that shall be used similar to runlevels in SysV init systems, just as a precaution to avoid unusable system states\&. This option defaults to
1194 \fBfalse\fR\&.
1195 .sp
1196 Added in version 201\&.
1197 .RE
1198 .PP
1199 \fIDefaultDependencies=\fR
1200 .RS 4
1201 Takes a boolean argument\&. If
1202 \fByes\fR, (the default), a few default dependencies will implicitly be created for the unit\&. The actual dependencies created depend on the unit type\&. For example, for service units, these dependencies ensure that the service is started only after basic system initialization is completed and is properly terminated on system shutdown\&. See the respective man pages for details\&. Generally, only services involved with early boot or late shutdown should set this option to
1203 \fBno\fR\&. It is highly recommended to leave this option enabled for the majority of common units\&. If set to
1204 \fBno\fR, this option does not disable all implicit dependencies, just non\-essential ones\&.
1205 .sp
1206 Added in version 201\&.
1207 .RE
1208 .PP
1209 \fISurviveFinalKillSignal=\fR
1210 .RS 4
1211 Takes a boolean argument\&. Defaults to
1212 \fBno\fR\&. If
1213 \fByes\fR, processes belonging to this unit will not be sent the final
1214 "SIGTERM"
1215 and
1216 "SIGKILL"
1217 signals during the final phase of the system shutdown process\&. This functionality replaces the older mechanism that allowed a program to set
1218 "argv[0][0] = \*(Aq@\*(Aq"
1219 as described at
1220 \m[blue]\fBsystemd and Storage Daemons for the Root File System\fR\m[]\&\s-2\u[3]\d\s+2, which however continues to be supported\&.
1221 .sp
1222 Added in version 255\&.
1223 .RE
1224 .PP
1225 \fICollectMode=\fR
1226 .RS 4
1227 Tweaks the "garbage collection" algorithm for this unit\&. Takes one of
1228 \fBinactive\fR
1229 or
1230 \fBinactive\-or\-failed\fR\&. If set to
1231 \fBinactive\fR
1232 the unit will be unloaded if it is in the
1233 \fBinactive\fR
1234 state and is not referenced by clients, jobs or other units \(em however it is not unloaded if it is in the
1235 \fBfailed\fR
1236 state\&. In
1237 \fBfailed\fR
1238 mode, failed units are not unloaded until the user invoked
1239 \fBsystemctl reset\-failed\fR
1240 on them to reset the
1241 \fBfailed\fR
1242 state, or an equivalent command\&. This behaviour is altered if this option is set to
1243 \fBinactive\-or\-failed\fR: in this case, the unit is unloaded even if the unit is in a
1244 \fBfailed\fR
1245 state, and thus an explicitly resetting of the
1246 \fBfailed\fR
1247 state is not necessary\&. Note that if this mode is used unit results (such as exit codes, exit signals, consumed resources, \&...) are flushed out immediately after the unit completed, except for what is stored in the logging subsystem\&. Defaults to
1248 \fBinactive\fR\&.
1249 .sp
1250 Since v261, if
1251 \fIFileDescriptorStorePreserve=\fR
1252 is set to
1253 \fByes\fR, and the unit has file descriptors stored, garbage collection will be disabled until the unit is removed, the service manager exits, or the file descriptors get
1254 \fBEPOLLHUP\fR
1255 or
1256 \fBEPOLLERR\fR\&.
1257 .sp
1258 Added in version 236\&.
1259 .RE
1260 .PP
1261 \fIFailureAction=\fR, \fISuccessAction=\fR
1262 .RS 4
1263 Configure the action to take when the unit stops and enters a failed state or inactive state\&. Takes one of
1264 \fBnone\fR,
1265 \fBreboot\fR,
1266 \fBreboot\-force\fR,
1267 \fBreboot\-immediate\fR,
1268 \fBpoweroff\fR,
1269 \fBpoweroff\-force\fR,
1270 \fBpoweroff\-immediate\fR,
1271 \fBexit\fR,
1272 \fBexit\-force\fR,
1273 \fBsoft\-reboot\fR,
1274 \fBsoft\-reboot\-force\fR,
1275 \fBkexec\fR,
1276 \fBkexec\-force\fR,
1277 \fBhalt\fR,
1278 \fBhalt\-force\fR
1279 and
1280 \fBhalt\-immediate\fR\&. In system mode, all options are allowed\&. In user mode, only
1281 \fBnone\fR,
1282 \fBexit\fR, and
1283 \fBexit\-force\fR
1284 are allowed\&. Both options default to
1285 \fBnone\fR\&.
1286 .sp
1287 If
1288 \fBnone\fR
1289 is set, no action will be triggered\&.
1290 \fBreboot\fR
1291 causes a reboot following the normal shutdown procedure (i\&.e\&. equivalent to
1292 \fBsystemctl reboot\fR)\&.
1293 \fBreboot\-force\fR
1294 causes a forced reboot which will terminate all processes forcibly but should cause no dirty file systems on reboot (i\&.e\&. equivalent to
1295 \fBsystemctl reboot \-f\fR) and
1296 \fBreboot\-immediate\fR
1297 causes immediate execution of the
1298 \fBreboot\fR(2)
1299 system call, which might result in data loss (i\&.e\&. equivalent to
1300 \fBsystemctl reboot \-ff\fR)\&. Similarly,
1301 \fBpoweroff\fR,
1302 \fBpoweroff\-force\fR,
1303 \fBpoweroff\-immediate\fR,
1304 \fBkexec\fR,
1305 \fBkexec\-force\fR,
1306 \fBhalt\fR,
1307 \fBhalt\-force\fR
1308 and
1309 \fBhalt\-immediate\fR
1310 have the effect of powering down the system, executing kexec, and halting the system respectively with similar semantics\&.
1311 \fBexit\fR
1312 causes the manager to exit following the normal shutdown procedure, and
1313 \fBexit\-force\fR
1314 causes it terminate without shutting down services\&. When
1315 \fBexit\fR
1316 or
1317 \fBexit\-force\fR
1318 is used by default the exit status of the main process of the unit (if this applies) is returned from the service manager\&. However, this may be overridden with
1319 \fIFailureActionExitStatus=\fR/\fISuccessActionExitStatus=\fR, see below\&.
1320 \fBsoft\-reboot\fR
1321 will trigger a userspace reboot operation\&.
1322 \fBsoft\-reboot\-force\fR
1323 does that too, but does not go through the shutdown transaction beforehand\&.
1324 .sp
1325 Added in version 236\&.
1326 .RE
1327 .PP
1328 \fIFailureActionExitStatus=\fR, \fISuccessActionExitStatus=\fR
1329 .RS 4
1330 Controls the exit status to propagate back to an invoking container manager (in case of a system service) or service manager (in case of a user manager) when the
1331 \fIFailureAction=\fR/\fISuccessAction=\fR
1332 are set to
1333 \fBexit\fR
1334 or
1335 \fBexit\-force\fR
1336 and the action is triggered\&. By default, the exit status of the main process of the triggering unit (if this applies) is propagated\&. Takes a value in the range 0\&...255 or the empty string to request default behaviour\&.
1337 .sp
1338 Added in version 240\&.
1339 .RE
1340 .PP
1341 \fIJobTimeoutSec=\fR, \fIJobRunningTimeoutSec=\fR
1342 .RS 4
1343 \fIJobTimeoutSec=\fR
1344 specifies a timeout for the whole job that starts running when the job is queued\&.
1345 \fIJobRunningTimeoutSec=\fR
1346 specifies a timeout that starts running when the queued job is actually started\&. If either limit is reached, the job will be cancelled, the unit however will not change state or even enter the
1347 "failed"
1348 mode\&.
1349 .sp
1350 Both settings take a time span with the default unit of seconds, but other units may be specified, see
1351 \fBsystemd.time\fR(7)\&. The default is
1352 "infinity"
1353 (job timeouts disabled), except for device units where
1354 \fIJobRunningTimeoutSec=\fR
1355 defaults to
1356 \fIDefaultDeviceTimeoutSec=\fR\&.
1357 .sp
1358 Note: these timeouts are independent from any unit\-specific timeouts (for example, the timeout set with
1359 \fITimeoutStartSec=\fR
1360 in service units)\&. The job timeout has no effect on the unit itself\&. Or in other words: unit\-specific timeouts are useful to abort unit state changes, and revert them\&. The job timeout set with this option however is useful to abort only the job waiting for the unit state to change\&.
1361 .sp
1362 Added in version 201\&.
1363 .RE
1364 .PP
1365 \fIJobTimeoutAction=\fR, \fIJobTimeoutRebootArgument=\fR
1366 .RS 4
1367 \fIJobTimeoutAction=\fR
1368 optionally configures an additional action to take when the timeout is hit, see description of
1369 \fIJobTimeoutSec=\fR
1370 and
1371 \fIJobRunningTimeoutSec=\fR
1372 above\&. It takes the same values as
1373 \fIFailureAction=\fR/\fISuccessAction=\fR\&. Defaults to
1374 \fBnone\fR\&.
1375 .sp
1376 \fIJobTimeoutRebootArgument=\fR
1377 configures an optional reboot string to pass to the
1378 \fBreboot\fR(2)
1379 system call\&.
1380 .sp
1381 Added in version 240\&.
1382 .RE
1383 .PP
1384 \fIStartLimitIntervalSec=\fR\fI\fIinterval\fR\fR, \fIStartLimitBurst=\fR\fI\fIburst\fR\fR
1385 .RS 4
1386 Configure unit start rate limiting\&. Units which are started more than
1387 \fIburst\fR
1388 times within an
1389 \fIinterval\fR
1390 time span are not permitted to start any more\&. Use
1391 \fIStartLimitIntervalSec=\fR
1392 to configure the checking interval and
1393 \fIStartLimitBurst=\fR
1394 to configure how many starts per interval are allowed\&.
1395 .sp
1396 \fIinterval\fR
1397 is a time span with the default unit of seconds, but other units may be specified, see
1398 \fBsystemd.time\fR(7)\&. The special value
1399 "infinity"
1400 can be used to limit the total number of start attempts, even if they happen at large time intervals\&. Defaults to
1401 \fIDefaultStartLimitIntervalSec=\fR
1402 in manager configuration file, and may be set to 0 to disable any kind of rate limiting\&.
1403 \fIburst\fR
1404 is a number and defaults to
1405 \fIDefaultStartLimitBurst=\fR
1406 in manager configuration file\&.
1407 .sp
1408 These configuration options are particularly useful in conjunction with the service setting
1409 \fIRestart=\fR
1410 (see
1411 \fBsystemd.service\fR(5)); however, they apply to all kinds of starts (including manual), not just those triggered by the
1412 \fIRestart=\fR
1413 logic\&.
1414 .sp
1415 Note that units which are configured for
1416 \fIRestart=\fR, and which reach the start limit are not attempted to be restarted anymore; however, they may still be restarted manually or from a timer or socket at a later point, after the
1417 \fIinterval\fR
1418 has passed\&. From that point on, the restart logic is activated again\&.
1419 \fBsystemctl reset\-failed\fR
1420 will cause the restart rate counter for a service to be flushed, which is useful if the administrator wants to manually start a unit and the start limit interferes with that\&. Rate\-limiting is enforced after any unit condition checks are executed, and hence unit activations with failing conditions do not count towards the rate limit\&.
1421 .sp
1422 When a unit is unloaded due to the garbage collection logic (see above) its rate limit counters are flushed out too\&. This means that configuring start rate limiting for a unit that is not referenced continuously has no effect\&.
1423 .sp
1424 This setting does not apply to slice, target, device, and scope units, since they are unit types whose activation may either never fail, or may succeed only a single time\&.
1425 .sp
1426 Added in version 229\&.
1427 .RE
1428 .PP
1429 \fIStartLimitAction=\fR
1430 .RS 4
1431 Configure an additional action to take if the rate limit configured with
1432 \fIStartLimitIntervalSec=\fR
1433 and
1434 \fIStartLimitBurst=\fR
1435 is hit\&. Takes the same values as the
1436 \fIFailureAction=\fR/\fISuccessAction=\fR
1437 settings\&. If
1438 \fBnone\fR
1439 is set, hitting the rate limit will trigger no action except that the start will not be permitted\&. Defaults to
1440 \fBnone\fR\&.
1441 .sp
1442 Added in version 229\&.
1443 .RE
1444 .PP
1445 \fIRebootArgument=\fR
1446 .RS 4
1447 Configure the optional argument for the
1448 \fBreboot\fR(2)
1449 system call if
1450 \fIStartLimitAction=\fR
1451 or
1452 \fIFailureAction=\fR
1453 is a reboot action\&. This works just like the optional argument to
1454 \fBsystemctl reboot\fR
1455 command\&.
1456 .sp
1457 Added in version 229\&.
1458 .RE
1459 .PP
1460 \fISourcePath=\fR
1461 .RS 4
1462 A path to a configuration file this unit has been generated from\&. This is primarily useful for implementation of generator tools that convert configuration from an external configuration file format into native unit files\&. This functionality should not be used in normal units\&.
1463 .sp
1464 Added in version 201\&.
1465 .RE
1466 .SS "Conditions and Asserts"
1467 .PP
1468 Unit files may also include a number of
1469 \fICondition\&...=\fR
1470 and
1471 \fIAssert\&...=\fR
1472 settings\&. Before the unit is started, systemd will verify that the specified conditions and asserts are true\&. If not, the starting of the unit will be (mostly silently) skipped (in case of conditions), or aborted with an error message (in case of asserts)\&. Failing conditions or asserts will not result in the unit being moved into the
1473 "failed"
1474 state\&. The conditions and asserts are checked at the time the queued start job is to be executed\&. The ordering dependencies are still respected, so other units are still pulled in and ordered as if this unit was successfully activated, and the conditions and asserts are executed the precise moment the unit would normally start and thus can validate system state after the units ordered before completed initialization\&. Use condition expressions for skipping units that do not apply to the local system, for example because the kernel or runtime environment does not require their functionality\&.
1475 .PP
1476 If multiple conditions are specified, the unit will be executed if all of them apply (i\&.e\&. a logical AND is applied)\&. Condition checks can use a pipe symbol ("|") after the equals sign ("Condition\&...=|\&..."), which causes the condition to become a
1477 \fItriggering\fR
1478 condition\&. If at least one triggering condition is defined for a unit, then the unit will be started if at least one of the triggering conditions of the unit applies and all of the regular (i\&.e\&. non\-triggering) conditions apply\&. If you prefix an argument with the pipe symbol and an exclamation mark, the pipe symbol must be passed first, the exclamation second\&. If any of these options is assigned the empty string, the list of conditions is reset completely, all previous condition settings (of any kind) will have no effect\&.
1479 .PP
1480 The
1481 \fIAssertArchitecture=\fR,
1482 \fIAssertVirtualization=\fR, \&... options are similar to conditions but cause the start job to fail (instead of being skipped)\&. The failed check is logged\&. Units with unmet conditions are considered to be in a clean state and will be garbage collected if they are not referenced\&. This means that when queried, the condition failure may or may not show up in the state of the unit\&.
1483 .PP
1484 Note that neither assertion nor condition expressions result in unit state changes\&. Also note that both are checked at the time the job is to be executed, i\&.e\&. long after depending jobs and it itself were queued\&. Thus, neither condition nor assertion expressions are suitable for conditionalizing unit dependencies\&.
1485 .PP
1486 The
1487 \fBcondition\fR
1488 verb of
1489 \fBsystemd-analyze\fR(1)
1490 can be used to test condition and assert expressions\&.
1491 .PP
1492 Except for
1493 \fIConditionPathIsSymbolicLink=\fR, all path checks follow symlinks\&.
1494 .PP
1495 \fIConditionArchitecture=\fR
1496 .RS 4
1497 Check whether the system is running on a specific architecture\&. Takes one of
1498 "x86",
1499 "x86\-64",
1500 "ppc",
1501 "ppc\-le",
1502 "ppc64",
1503 "ppc64\-le",
1504 "ia64",
1505 "parisc",
1506 "parisc64",
1507 "s390",
1508 "s390x",
1509 "sparc",
1510 "sparc64",
1511 "mips",
1512 "mips\-le",
1513 "mips64",
1514 "mips64\-le",
1515 "alpha",
1516 "arm",
1517 "arm\-be",
1518 "arm64",
1519 "arm64\-be",
1520 "sh",
1521 "sh64",
1522 "m68k",
1523 "tilegx",
1524 "cris",
1525 "arc",
1526 "arc\-be", or
1527 "native"\&.
1528 .sp
1529 Use
1530 \fBsystemd-analyze\fR(1)
1531 for the complete list of known architectures\&.
1532 .sp
1533 The architecture is determined from the information returned by
1534 \fBuname\fR(2)
1535 and is thus subject to
1536 \fBpersonality\fR(2)\&. Note that a
1537 \fIPersonality=\fR
1538 setting in the same unit file has no effect on this condition\&. A special architecture name
1539 "native"
1540 is mapped to the architecture the system manager itself is compiled for\&. The test may be negated by prepending an exclamation mark\&.
1541 .sp
1542 Added in version 201\&.
1543 .RE
1544 .PP
1545 \fIConditionFirmware=\fR
1546 .RS 4
1547 Check whether the system\*(Aqs firmware is of a certain type\&. The following values are possible:
1548 .sp
1549 .RS 4
1550 .ie n \{\
1551 \h'-04'\(bu\h'+03'\c
1552 .\}
1553 .el \{\
1554 .sp -1
1555 .IP \(bu 2.3
1556 .\}
1557 "uefi"
1558 matches systems with EFI\&.
1559 .RE
1560 .sp
1561 .RS 4
1562 .ie n \{\
1563 \h'-04'\(bu\h'+03'\c
1564 .\}
1565 .el \{\
1566 .sp -1
1567 .IP \(bu 2.3
1568 .\}
1569 "device\-tree"
1570 matches systems with a device tree\&.
1571 .RE
1572 .sp
1573 .RS 4
1574 .ie n \{\
1575 \h'-04'\(bu\h'+03'\c
1576 .\}
1577 .el \{\
1578 .sp -1
1579 .IP \(bu 2.3
1580 .\}
1581 "device\-tree\-compatible(\fIvalue\fR)"
1582 matches systems with a device tree that are compatible with
1583 "value"\&.
1584 .RE
1585 .sp
1586 .RS 4
1587 .ie n \{\
1588 \h'-04'\(bu\h'+03'\c
1589 .\}
1590 .el \{\
1591 .sp -1
1592 .IP \(bu 2.3
1593 .\}
1594 "smbios\-field(\fIfield\fR \fIoperator\fR \fIvalue\fR)"
1595 matches systems with a SMBIOS field containing a certain value\&.
1596 \fIfield\fR
1597 is the name of the SMBIOS field exposed as
1598 "sysfs"
1599 attribute file below
1600 /sys/class/dmi/id/\&.
1601 \fIoperator\fR
1602 is one of
1603 "<",
1604 "<=",
1605 ">=",
1606 ">",
1607 "==",
1608 "<>"
1609 for version comparisons,
1610 "="
1611 and
1612 "!="
1613 for literal string comparisons, or
1614 "$=",
1615 "!$="
1616 for shell\-style glob comparisons\&.
1617 \fIvalue\fR
1618 is the expected value of the SMBIOS field value (possibly containing shell style globs in case
1619 "$="/"!$="
1620 is used)\&.
1621 .RE
1622 .sp
1623 Added in version 249\&.
1624 .RE
1625 .PP
1626 \fIConditionVirtualization=\fR
1627 .RS 4
1628 Check whether the system is executed in a virtualized environment and optionally test whether it is a specific implementation\&. Takes either boolean value to check if being executed in any virtualized environment, or one of
1629 "vm"
1630 and
1631 "container"
1632 to test against a generic type of virtualization solution, or one of
1633 "qemu",
1634 "kvm",
1635 "amazon",
1636 "zvm",
1637 "vmware",
1638 "microsoft",
1639 "oracle",
1640 "powervm",
1641 "xen",
1642 "bochs",
1643 "uml",
1644 "bhyve",
1645 "qnx",
1646 "apple",
1647 "sre",
1648 "openvz",
1649 "lxc",
1650 "lxc\-libvirt",
1651 "systemd\-nspawn",
1652 "docker",
1653 "podman",
1654 "rkt",
1655 "wsl",
1656 "proot",
1657 "pouch",
1658 "acrn"
1659 to test against a specific implementation, or
1660 "private\-users"
1661 to check whether we are running in a user namespace\&. See
1662 \fBsystemd-detect-virt\fR(1)
1663 for a full list of known virtualization technologies and their identifiers\&. If multiple virtualization technologies are nested, only the innermost is considered\&. The test may be negated by prepending an exclamation mark\&.
1664 .sp
1665 Added in version 244\&.
1666 .RE
1667 .PP
1668 \fIConditionHost=\fR
1669 .RS 4
1670 \fIConditionHost=\fR
1671 may be used to match against the hostname, machine ID, boot ID or product UUID of the host\&. This either takes a hostname string (optionally with shell style globs) which is tested against the locally set hostname as returned by
1672 \fBgethostname\fR(2), or a 128bit ID or UUID, formatted as string\&. The latter is compared against machine ID, boot ID and the firmware product UUID if there is any\&. See
1673 \fBmachine-id\fR(5)
1674 for details about the machine ID\&. The test may be negated by prepending an exclamation mark\&.
1675 .sp
1676 Added in version 244\&.
1677 .RE
1678 .PP
1679 \fIConditionFraction=\fR
1680 .RS 4
1681 \fIConditionFraction=\fR
1682 may be used to enable a unit on a stable, pseudo\-random subset of a fleet of machines\&. It is primarily useful for staged rollouts: the same unit (or drop\-in) is distributed to every machine in a fleet, but only the configured fraction of them will actually have it enabled\&. The decision is derived locally from the machine ID (see
1683 \fBmachine-id\fR(5)), so it requires no central coordination and is stable over time: a given machine always lands on the same side of the threshold\&.
1684 .sp
1685 The argument consists of an optional
1686 \fItag\fR
1687 followed by a percentage, separated by whitespace, for example
1688 "30%"
1689 or
1690 "myrollout 30%"\&. The percentage may include up to two decimal places (e\&.g\&.
1691 "0\&.5%")\&. The condition is satisfied on approximately the configured percentage of all machines;
1692 "0%"
1693 matches no machine and
1694 "100%"
1695 matches every machine\&.
1696 .sp
1697 The optional tag is an arbitrary string (not containing whitespace) that is mixed into the derivation, so that independent rollouts select
1698 \fIindependent\fR
1699 subsets of the fleet\&. Without it, all untagged
1700 \fIConditionFraction=\fR
1701 checks would select the very same machines (the same machines would always be picked first)\&. Use distinct tags for unrelated rollouts, and a shared tag to deliberately target the same machines across several units\&.
1702 .sp
1703 The test may be negated by prepending an exclamation mark, in which case it is satisfied on the complementary fraction of machines (e\&.g\&.
1704 "!myrollout 30%"
1705 matches the other โ‰ˆ70%)\&. If the machine ID cannot be determined, the condition fails\&.
1706 .sp
1707 Added in version 261\&.
1708 .RE
1709 .PP
1710 \fIConditionKernelCommandLine=\fR
1711 .RS 4
1712 \fIConditionKernelCommandLine=\fR
1713 may be used to check whether a specific kernel command line option is set (or if prefixed with the exclamation mark \(em unset)\&. The argument must either be a single word, or an assignment (i\&.e\&. two words, separated by
1714 "=")\&. In the former case the kernel command line is searched for the word appearing as is, or as left hand side of an assignment\&. In the latter case, the exact assignment is looked for with right and left hand side matching\&. This operates on the kernel command line communicated to userspace via
1715 /proc/cmdline, except when the service manager is invoked as payload of a container manager, in which case the command line of
1716 PID 1
1717 is used instead (i\&.e\&.
1718 /proc/1/cmdline)\&.
1719 .sp
1720 Added in version 244\&.
1721 .RE
1722 .PP
1723 \fIConditionKernelVersion=\fR
1724 .RS 4
1725 \fIConditionKernelVersion=\fR
1726 may be used to check whether the kernel version (as reported by
1727 \fBuname \-r\fR) matches a certain expression, or if prefixed with the exclamation mark, does not match\&. The argument must be a list of (potentially quoted) expressions\&. Each expression starts with one of
1728 "="
1729 or
1730 "!="
1731 for string comparisons,
1732 "<",
1733 "<=",
1734 "==",
1735 "<>",
1736 ">=",
1737 ">"
1738 for version comparisons, or
1739 "$=",
1740 "!$="
1741 for a shell\-style glob match\&. If no operator is specified,
1742 "$="
1743 is implied\&.
1744 .sp
1745 Note that using the kernel version string is an unreliable way to determine which features are supported by a kernel, because of the widespread practice of backporting drivers, features, and fixes from newer upstream kernels into older versions provided by distributions\&. Hence, this check is inherently unportable and should not be used for units which may be used on different distributions\&.
1746 .sp
1747 Added in version 244\&.
1748 .RE
1749 .PP
1750 \fIConditionVersion=\fR
1751 .RS 4
1752 \fIConditionVersion=\fR
1753 may be used to check whether a software version matches a certain expression, or if prefixed with the exclamation mark, does not match\&. The first argument is the software whose version has to be checked\&. Currently
1754 "kernel",
1755 "systemd"
1756 and
1757 "glibc"
1758 are supported\&. If this argument is omitted,
1759 "kernel"
1760 is implied\&. The second argument must be a list of (potentially quoted) expressions\&. Each expression starts with one of
1761 "="
1762 or
1763 "!="
1764 for string comparisons,
1765 "<",
1766 "<=",
1767 "==",
1768 "<>",
1769 ">=",
1770 ">"
1771 for version comparisons, or
1772 "$=",
1773 "!$="
1774 for a shell\-style glob match\&. If no operator is specified,
1775 "$="
1776 is implied\&.
1777 .sp
1778 Added in version 258\&.
1779 .RE
1780 .PP
1781 \fIConditionCredential=\fR
1782 .RS 4
1783 \fIConditionCredential=\fR
1784 may be used to check whether a credential by the specified name was passed into the service manager\&. See
1785 \m[blue]\fBSystem and Service Credentials\fR\m[]\&\s-2\u[4]\d\s+2
1786 for details about credentials\&. If used in services for the system service manager this may be used to conditionalize services based on system credentials passed in\&. If used in services for the per\-user service manager this may be used to conditionalize services based on credentials passed into the
1787 unit@\&.service
1788 service instance belonging to the user\&. The argument must be a valid credential name\&.
1789 .sp
1790 Added in version 252\&.
1791 .RE
1792 .PP
1793 \fIConditionEnvironment=\fR
1794 .RS 4
1795 \fIConditionEnvironment=\fR
1796 may be used to check whether a specific environment variable is set (or if prefixed with the exclamation mark \(em unset) in the service manager\*(Aqs environment block\&. The argument may be a single word, to check if the variable with this name is defined in the environment block, or an assignment ("\fIname\fR=\fIvalue\fR"), to check if the variable with this exact value is defined\&. Note that the environment block of the service manager itself is checked, i\&.e\&. not any variables defined with
1797 \fIEnvironment=\fR
1798 or
1799 \fIEnvironmentFile=\fR, as described above\&. This is particularly useful when the service manager runs inside a containerized environment or as per\-user service manager, in order to check for variables passed in by the enclosing container manager or PAM\&.
1800 .sp
1801 Added in version 246\&.
1802 .RE
1803 .PP
1804 \fIConditionSecurity=\fR
1805 .RS 4
1806 \fIConditionSecurity=\fR
1807 may be used to check whether the given security technology is enabled on the system\&. Currently, the following values are recognized:
1808 .sp
1809 .it 1 an-trap
1810 .nr an-no-space-flag 1
1811 .nr an-break-flag 1
1812 .br
1813 .B Table\ \&3.\ \&Recognized security technologies
1814 .TS
1815 allbox tab(:);
1816 lB lB.
1817 T{
1818 Value
1819 T}:T{
1820 Description
1821 T}
1822 .T&
1823 l l
1824 l l
1825 l l
1826 l l
1827 l l
1828 l l
1829 l l
1830 l l
1831 l l
1832 l l
1833 l l.
1834 T{
1835 selinux
1836 T}:T{
1837 SELinux MAC
1838 T}
1839 T{
1840 apparmor
1841 T}:T{
1842 AppArmor MAC
1843 T}
1844 T{
1845 tomoyo
1846 T}:T{
1847 Tomoyo MAC
1848 T}
1849 T{
1850 smack
1851 T}:T{
1852 SMACK MAC
1853 T}
1854 T{
1855 ima
1856 T}:T{
1857 Integrity Measurement Architecture (IMA)
1858 T}
1859 T{
1860 audit
1861 T}:T{
1862 Linux Audit Framework
1863 T}
1864 T{
1865 uefi\-secureboot
1866 T}:T{
1867 UEFI SecureBoot
1868 T}
1869 T{
1870 tpm2
1871 T}:T{
1872 Trusted Platform Module 2\&.0 (TPM2) (with full UEFI support, including the TCG PC Client
1873 Platform Firmware Profile)
1874 T}
1875 T{
1876 cvm
1877 T}:T{
1878 Confidential virtual machine (SEV/TDX)
1879 T}
1880 T{
1881 measured\-uki
1882 T}:T{
1883 Unified Kernel Image with PCR 11 Measurements, as per \fBsystemd-stub\fR(7)\&. Added in version 255\&.
1884 T}
1885 T{
1886 measured\-os
1887 T}:T{
1888 OS PCR measurements enabled\&. This is typically equivalent to \fImeasured\-uki\fR, however may also be set explicitly via the \fIsystemd\&.tpm2_measured_os=\fR kernel command line switch, see \fBkernel-command-line\fR(7) for details\&. The various system services doing boot and runtime measurements are conditioned on this flag\&. Added in version 261\&.
1889 T}
1890 .TE
1891 .sp 1
1892 The test may be negated by prepending an exclamation mark\&.
1893 .sp
1894 Added in version 244\&.
1895 .RE
1896 .PP
1897 \fIConditionCapability=\fR
1898 .RS 4
1899 Check whether the given capability exists in the capability bounding set of the service manager (i\&.e\&. this does not check whether capability is actually available in the permitted or effective sets, see
1900 \fBcapabilities\fR(7)
1901 for details)\&. Pass a capability name such as
1902 "CAP_MKNOD", possibly prefixed with an exclamation mark to negate the check\&.
1903 .sp
1904 Added in version 244\&.
1905 .RE
1906 .PP
1907 \fIConditionACPower=\fR
1908 .RS 4
1909 Check whether the system has AC power, or is exclusively battery powered at the time of activation of the unit\&. This takes a boolean argument\&. If set to
1910 "true", the condition will hold only if at least one AC connector of the system is connected to a power source, or if no AC connectors are known\&. Conversely, if set to
1911 "false", the condition will hold only if there is at least one AC connector known and all AC connectors are disconnected from a power source\&.
1912 .sp
1913 Added in version 244\&.
1914 .RE
1915 .PP
1916 \fIConditionNeedsUpdate=\fR
1917 .RS 4
1918 Takes one of
1919 /var/
1920 or
1921 /etc/
1922 as argument, possibly prefixed with a
1923 "!"
1924 (to invert the condition)\&. This condition may be used to conditionalize units on whether the specified directory requires an update because
1925 /usr/\*(Aqs modification time is newer than the stamp file
1926 \&.updated
1927 in the specified directory\&. This is useful to implement offline updates of the vendor operating system resources in
1928 /usr/
1929 that require updating of
1930 /etc/
1931 or
1932 /var/
1933 on the next following boot\&. Units making use of this condition should order themselves before
1934 \fBsystemd-update-done.service\fR(8), to make sure they run before the stamp file\*(Aqs modification time gets reset indicating a completed update\&.
1935 .sp
1936 If the
1937 \fIsystemd\&.condition_needs_update=\fR
1938 option is specified on the kernel command line (taking a boolean), it will override the result of this condition check, taking precedence over any file modification time checks\&. If the kernel command line option is used,
1939 systemd\-update\-done\&.service
1940 will not have immediate effect on any following
1941 \fIConditionNeedsUpdate=\fR
1942 checks, until the system is rebooted where the kernel command line option is not specified anymore\&.
1943 .sp
1944 Note that to make this scheme effective, the timestamp of
1945 /usr/
1946 should be explicitly updated after its contents are modified\&. The kernel will automatically update modification timestamp on a directory only when immediate children of a directory are modified; an modification of nested files will not automatically result in mtime of
1947 /usr/
1948 being updated\&.
1949 .sp
1950 Also note that if the update method includes a call to execute appropriate post\-update steps itself, it should not touch the timestamp of
1951 /usr/\&. In a typical distribution packaging scheme, packages will do any required update steps as part of the installation or upgrade, to make package contents immediately usable\&.
1952 \fIConditionNeedsUpdate=\fR
1953 should be used with other update mechanisms where such an immediate update does not happen\&.
1954 .sp
1955 Added in version 244\&.
1956 .RE
1957 .PP
1958 \fIConditionFirstBoot=\fR
1959 .RS 4
1960 Takes a boolean argument\&. This condition may be used to conditionalize units on whether the system is booting up for the first time\&. This roughly means that
1961 /etc/
1962 was unpopulated when the system started booting (for details, see "First Boot Semantics" in
1963 \fBmachine-id\fR(5))\&. First Boot is considered finished (this condition will evaluate as false) after the manager has finished the startup phase\&.
1964 .sp
1965 This condition may be used to populate
1966 /etc/
1967 on the first boot after factory reset, or when a new system instance boots up for the first time\&.
1968 .sp
1969 Note that the service manager itself will perform setup steps during First Boot: it will initialize
1970 \fBmachine-id\fR(5)
1971 and preset all units, enabling or disabling them according to the
1972 \fBsystemd.preset\fR(5)
1973 settings\&. Additional setup may be performed via units with
1974 \fIConditionFirstBoot=yes\fR\&.
1975 .sp
1976 For robustness, units with
1977 \fIConditionFirstBoot=yes\fR
1978 should order themselves before
1979 first\-boot\-complete\&.target
1980 and pull in this passive target with
1981 \fIWants=\fR\&. This ensures that in a case of an aborted first boot, these units will be re\-run during the next system startup\&.
1982 .sp
1983 If the
1984 \fIsystemd\&.condition_first_boot=\fR
1985 option is specified on the kernel command line (taking a boolean), it will override the result of this condition check, taking precedence over
1986 /etc/machine\-id
1987 existence checks\&.
1988 .sp
1989 Added in version 244\&.
1990 .RE
1991 .PP
1992 \fIConditionPathExists=\fR
1993 .RS 4
1994 Check for the existence of a file\&. If the specified absolute path name does not exist, the condition will fail\&. If the absolute path name passed to
1995 \fIConditionPathExists=\fR
1996 is prefixed with an exclamation mark ("!"), the test is negated, and the unit is only started if the path does not exist\&.
1997 .sp
1998 Added in version 244\&.
1999 .RE
2000 .PP
2001 \fIConditionPathExistsGlob=\fR
2002 .RS 4
2003 \fIConditionPathExistsGlob=\fR
2004 is similar to
2005 \fIConditionPathExists=\fR, but checks for the existence of at least one file or directory matching the specified globbing pattern\&.
2006 .sp
2007 Added in version 244\&.
2008 .RE
2009 .PP
2010 \fIConditionPathIsDirectory=\fR
2011 .RS 4
2012 \fIConditionPathIsDirectory=\fR
2013 is similar to
2014 \fIConditionPathExists=\fR
2015 but verifies that a certain path exists and is a directory\&.
2016 .sp
2017 Added in version 244\&.
2018 .RE
2019 .PP
2020 \fIConditionPathIsSymbolicLink=\fR
2021 .RS 4
2022 \fIConditionPathIsSymbolicLink=\fR
2023 is similar to
2024 \fIConditionPathExists=\fR
2025 but verifies that a certain path exists and is a symbolic link\&.
2026 .sp
2027 Added in version 244\&.
2028 .RE
2029 .PP
2030 \fIConditionPathIsMountPoint=\fR
2031 .RS 4
2032 \fIConditionPathIsMountPoint=\fR
2033 is similar to
2034 \fIConditionPathExists=\fR
2035 but verifies that a certain path exists and is a mount point\&.
2036 .sp
2037 Added in version 244\&.
2038 .RE
2039 .PP
2040 \fIConditionPathIsReadWrite=\fR
2041 .RS 4
2042 \fIConditionPathIsReadWrite=\fR
2043 is similar to
2044 \fIConditionPathExists=\fR
2045 but verifies that the underlying file system is readable and writable (i\&.e\&. not mounted read\-only)\&.
2046 .sp
2047 Added in version 244\&.
2048 .RE
2049 .PP
2050 \fIConditionPathIsEncrypted=\fR
2051 .RS 4
2052 \fIConditionPathIsEncrypted=\fR
2053 is similar to
2054 \fIConditionPathExists=\fR
2055 but verifies that the underlying file system\*(Aqs backing block device is encrypted using dm\-crypt/LUKS\&. Note that this check does not cover ext4 per\-directory encryption, and only detects block level encryption\&. Moreover, if the specified path resides on a file system on top of a loopback block device, only encryption above the loopback device is detected\&. It is not detected whether the file system backing the loopback block device is encrypted\&.
2056 .sp
2057 Added in version 246\&.
2058 .RE
2059 .PP
2060 \fIConditionPathIsSocket=\fR
2061 .RS 4
2062 \fIConditionPathIsSocket=\fR
2063 is similar to
2064 \fIConditionPathExists=\fR
2065 but verifies that a certain path exists and is a socket\&.
2066 .sp
2067 Added in version 260\&.
2068 .RE
2069 .PP
2070 \fIConditionDirectoryNotEmpty=\fR
2071 .RS 4
2072 \fIConditionDirectoryNotEmpty=\fR
2073 is similar to
2074 \fIConditionPathExists=\fR
2075 but verifies that a certain path exists and is a non\-empty directory\&.
2076 .sp
2077 Added in version 244\&.
2078 .RE
2079 .PP
2080 \fIConditionFileNotEmpty=\fR
2081 .RS 4
2082 \fIConditionFileNotEmpty=\fR
2083 is similar to
2084 \fIConditionPathExists=\fR
2085 but verifies that a certain path exists and refers to a regular file with a non\-zero size\&.
2086 .sp
2087 Added in version 244\&.
2088 .RE
2089 .PP
2090 \fIConditionFileIsExecutable=\fR
2091 .RS 4
2092 \fIConditionFileIsExecutable=\fR
2093 is similar to
2094 \fIConditionPathExists=\fR
2095 but verifies that a certain path exists, is a regular file, and marked executable\&.
2096 .sp
2097 Added in version 244\&.
2098 .RE
2099 .PP
2100 \fIConditionUser=\fR
2101 .RS 4
2102 \fIConditionUser=\fR
2103 takes a numeric
2104 "UID", a UNIX user name, or the special value
2105 "@system"\&. This condition may be used to check whether the service manager is running as the given user\&. The special value
2106 "@system"
2107 can be used to check if the user id is within the system user range\&. This option is not useful for system services, as the system manager exclusively runs as the root user, and thus the test result is constant\&.
2108 .sp
2109 Added in version 244\&.
2110 .RE
2111 .PP
2112 \fIConditionGroup=\fR
2113 .RS 4
2114 \fIConditionGroup=\fR
2115 is similar to
2116 \fIConditionUser=\fR
2117 but verifies that the service manager\*(Aqs real or effective group, or any of its auxiliary groups, match the specified group or GID\&. This setting does not support the special value
2118 "@system"\&.
2119 .sp
2120 Added in version 244\&.
2121 .RE
2122 .PP
2123 \fIConditionControlGroupController=\fR
2124 .RS 4
2125 Check whether given cgroup controllers (e\&.g\&.
2126 "cpu") are available for use on the system or whether the legacy v1 cgroup or the modern v2 cgroup hierarchy is used\&.
2127 .sp
2128 Multiple controllers may be passed with a space separating them; in this case, the condition will only pass if all listed controllers are available for use\&. Controllers unknown to systemd are ignored\&. Valid controllers are
2129 "cpu",
2130 "io",
2131 "memory", and
2132 "pids"\&. Even if available in the kernel, a particular controller may not be available if it was disabled on the kernel command line with
2133 \fIcgroup_disable=controller\fR\&.
2134 .sp
2135 Alternatively, two special strings
2136 "v1"
2137 and
2138 "v2"
2139 may be specified (without any controller names)\&.
2140 "v2"
2141 will pass if the unified v2 cgroup hierarchy is used, and
2142 "v1"
2143 will pass if the legacy v1 hierarchy or the hybrid hierarchy are used\&. Note that legacy or hybrid hierarchies have been deprecated\&. See
2144 \fBsystemd\fR(1)
2145 for more information\&.
2146 .sp
2147 Added in version 244\&.
2148 .RE
2149 .PP
2150 \fIConditionMemory=\fR
2151 .RS 4
2152 Verify that the specified amount of system memory is available to the current system\&. Takes a memory size in bytes as argument, optionally prefixed with a comparison operator
2153 "<",
2154 "<=",
2155 "="
2156 (or
2157 "=="),
2158 "!="
2159 (or
2160 "<>"),
2161 ">=",
2162 ">"\&. On bare\-metal systems compares the amount of physical memory in the system with the specified size, adhering to the specified comparison operator\&. In containers compares the amount of memory assigned to the container instead\&.
2163 .sp
2164 Added in version 244\&.
2165 .RE
2166 .PP
2167 \fIConditionCPUs=\fR
2168 .RS 4
2169 Verify that the specified number of CPUs is available to the current system\&. Takes a number of CPUs as argument, optionally prefixed with a comparison operator
2170 "<",
2171 "<=",
2172 "="
2173 (or
2174 "=="),
2175 "!="
2176 (or
2177 "<>"),
2178 ">=",
2179 ">"\&. Compares the number of CPUs in the CPU affinity mask configured of the service manager itself with the specified number, adhering to the specified comparison operator\&. On physical systems the number of CPUs in the affinity mask of the service manager usually matches the number of physical CPUs, but in special and virtual environments might differ\&. In particular, in containers the affinity mask usually matches the number of CPUs assigned to the container and not the physically available ones\&.
2180 .sp
2181 Added in version 244\&.
2182 .RE
2183 .PP
2184 \fIConditionCPUFeature=\fR
2185 .RS 4
2186 Verify that a given CPU feature is available via the
2187 "CPUID"
2188 instruction\&. This condition only does something on i386 and x86\-64 processors\&. On other processors it is assumed that the CPU does not support the given feature\&. It checks the leaves
2189 "1",
2190 "7",
2191 "0x80000001", and
2192 "0x80000007"\&. Valid values are:
2193 "fpu",
2194 "vme",
2195 "de",
2196 "pse",
2197 "tsc",
2198 "msr",
2199 "pae",
2200 "mce",
2201 "cx8",
2202 "apic",
2203 "sep",
2204 "mtrr",
2205 "pge",
2206 "mca",
2207 "cmov",
2208 "pat",
2209 "pse36",
2210 "clflush",
2211 "mmx",
2212 "fxsr",
2213 "sse",
2214 "sse2",
2215 "ht",
2216 "pni",
2217 "pclmul",
2218 "monitor",
2219 "ssse3",
2220 "fma3",
2221 "cx16",
2222 "sse4_1",
2223 "sse4_2",
2224 "movbe",
2225 "popcnt",
2226 "aes",
2227 "xsave",
2228 "osxsave",
2229 "avx",
2230 "f16c",
2231 "rdrand",
2232 "bmi1",
2233 "avx2",
2234 "bmi2",
2235 "rdseed",
2236 "adx",
2237 "sha_ni",
2238 "syscall",
2239 "rdtscp",
2240 "lm",
2241 "lahf_lm",
2242 "abm",
2243 "constant_tsc"\&.
2244 .sp
2245 Added in version 248\&.
2246 .RE
2247 .PP
2248 \fIConditionOSRelease=\fR
2249 .RS 4
2250 Verify that a specific
2251 "key=value"
2252 pair is set in the host\*(Aqs
2253 \fBos-release\fR(5)\&.
2254 .sp
2255 Other than exact string matching (with
2256 "="
2257 and
2258 "!="), relative comparisons are supported for versioned parameters (e\&.g\&.
2259 "VERSION_ID"; with
2260 "<",
2261 "<=",
2262 "==",
2263 "<>",
2264 ">=",
2265 ">"), and shell\-style wildcard comparisons ("*",
2266 "?",
2267 "[]") are supported with the
2268 "$="
2269 (match) and
2270 "!$="
2271 (non\-match)\&.
2272 .sp
2273 If the given key is not found in the file, the match is done against an empty value\&.
2274 .sp
2275 Added in version 249\&.
2276 .RE
2277 .PP
2278 \fIConditionMachineTag=\fR
2279 .RS 4
2280 \fIConditionMachineTag=\fR
2281 may be used to match against the tags assigned to the local machine\&. Machine tags are short labels that classify and group machines for management purposes; they are configured in the
2282 \fITAGS=\fR
2283 field of
2284 \fBmachine-info\fR(5)
2285 and may be queried and changed with the
2286 \fBtags\fR
2287 command of
2288 \fBhostnamectl\fR(1)\&. The argument is a single tag pattern, which is compared against each of the configured tags using shell\-style globbing ("*",
2289 "?",
2290 "[]")\&. The condition is satisfied if at least one of the configured tags matches the pattern\&. The test may be negated by prepending an exclamation mark, in which case it is satisfied if none of the configured tags matches\&.
2291 .sp
2292 Added in version 261\&.
2293 .RE
2294 .PP
2295 \fIConditionMemoryPressure=\fR, \fIConditionCPUPressure=\fR, \fIConditionIOPressure=\fR
2296 .RS 4
2297 Verify that the overall system (memory, CPU or IO) pressure is below or equal to a threshold\&. This setting takes a threshold value as argument\&. It can be specified as a simple percentage value, suffixed with
2298 "%", in which case the pressure will be measured as an average over the last five minutes before the attempt to start the unit is performed\&. Alternatively, the average timespan can also be specified using
2299 "/"
2300 as a separator, for example:
2301 "10%/1min"\&. The supported timespans match what the kernel provides, and are limited to
2302 "10sec",
2303 "1min"
2304 and
2305 "5min"\&. The
2306 "full"
2307 PSI will be checked first, and if not found
2308 "some"
2309 will be checked\&. For more details, see the documentation on
2310 \m[blue]\fBPSI (Pressure Stall Information)\fR\m[]\&\s-2\u[5]\d\s+2\&.
2311 .sp
2312 Optionally, the threshold value can be prefixed with the slice unit under which the pressure will be checked, followed by a
2313 ":"\&. If the slice unit is not specified, the overall system pressure will be measured, instead of a particular cgroup\*(Aqs\&.
2314 .sp
2315 Added in version 250\&.
2316 .RE
2317 .PP
2318 \fIConditionKernelModuleLoaded=\fR
2319 .RS 4
2320 Test whether the specified kernel module has been loaded and is already fully initialized\&.
2321 .sp
2322 Added in version 258\&.
2323 .RE
2324 .PP
2325 \fIAssertArchitecture=\fR, \fIAssertVirtualization=\fR, \fIAssertHost=\fR, \fIAssertFraction=\fR, \fIAssertKernelCommandLine=\fR, \fIAssertKernelVersion=\fR, \fIAssertVersion=\fR, \fIAssertCredential=\fR, \fIAssertEnvironment=\fR, \fIAssertSecurity=\fR, \fIAssertCapability=\fR, \fIAssertACPower=\fR, \fIAssertNeedsUpdate=\fR, \fIAssertFirstBoot=\fR, \fIAssertPathExists=\fR, \fIAssertPathExistsGlob=\fR, \fIAssertPathIsDirectory=\fR, \fIAssertPathIsSymbolicLink=\fR, \fIAssertPathIsMountPoint=\fR, \fIAssertPathIsReadWrite=\fR, \fIAssertPathIsEncrypted=\fR, \fIAssertPathIsSocket=\fR, \fIAssertDirectoryNotEmpty=\fR, \fIAssertFileNotEmpty=\fR, \fIAssertFileIsExecutable=\fR, \fIAssertUser=\fR, \fIAssertGroup=\fR, \fIAssertControlGroupController=\fR, \fIAssertMemory=\fR, \fIAssertCPUs=\fR, \fIAssertCPUFeature=\fR, \fIAssertOSRelease=\fR, \fIAssertMachineTag=\fR, \fIAssertMemoryPressure=\fR, \fIAssertCPUPressure=\fR, \fIAssertIOPressure=\fR, \fIAssertKernelModuleLoaded=\fR
2326 .RS 4
2327 Similar to the
2328 \fIConditionArchitecture=\fR,
2329 \fIConditionVirtualization=\fR, \&..., condition settings described above, these settings add assertion checks to the start\-up of the unit\&. However, unlike the conditions settings, any assertion setting that is not met results in failure of the start job (which means this is logged loudly)\&. Note that hitting a configured assertion does not cause the unit to enter the
2330 "failed"
2331 state (or in fact result in any state change of the unit), it affects only the job queued for it\&. Use assertion expressions for units that cannot operate when specific requirements are not met, and when this is something the administrator or user should look into\&.
2332 .sp
2333 Added in version 218\&.
2334 .RE
2335 .SH "MAPPING OF UNIT PROPERTIES TO THEIR INVERSES"
2336 .PP
2337 Unit settings that create a relationship with a second unit usually show up in properties of both units, for example in
2338 \fBsystemctl show\fR
2339 output\&. In some cases the name of the property is the same as the name of the configuration setting, but not always\&. This table lists the properties that are shown on two units which are connected through some dependency, and shows which property on "source" unit corresponds to which property on the "target" unit\&.
2340 .sp
2341 .it 1 an-trap
2342 .nr an-no-space-flag 1
2343 .nr an-break-flag 1
2344 .br
2345 .B Table\ \&4.\ \& "Forward" and "reverse" unit properties
2346 .TS
2347 allbox tab(:);
2348 lB lB lB s.
2349 T{
2350 "Forward" property
2351 T}:T{
2352 "Reverse" property
2353 T}:T{
2354 Where used
2355 T}
2356 .T&
2357 l l l s
2358 l l ^ ^
2359 l l l l
2360 l l l l
2361 l l l l
2362 l l l l
2363 l l l l
2364 l l l l
2365 l l l l
2366 l l l s
2367 l l l s
2368 l l ^ ^
2369 l l l s
2370 l l ^ ^
2371 l l l l.
2372 T{
2373 \fIBefore=\fR
2374 T}:T{
2375 \fIAfter=\fR
2376 T}:T{
2377 [Unit] section
2378 T}
2379 T{
2380 \fIAfter=\fR
2381 T}:T{
2382 \fIBefore=\fR
2383 T}::
2384 T{
2385 \fIRequires=\fR
2386 T}:T{
2387 \fIRequiredBy=\fR
2388 T}:T{
2389 [Unit] section
2390 T}:T{
2391 [Install] section
2392 T}
2393 T{
2394 \fIWants=\fR
2395 T}:T{
2396 \fIWantedBy=\fR
2397 T}:T{
2398 [Unit] section
2399 T}:T{
2400 [Install] section
2401 T}
2402 T{
2403 \fIUpholds=\fR
2404 T}:T{
2405 \fIUpheldBy=\fR
2406 T}:T{
2407 [Unit] section
2408 T}:T{
2409 [Install] section
2410 T}
2411 T{
2412 \fIPartOf=\fR
2413 T}:T{
2414 \fIConsistsOf=\fR
2415 T}:T{
2416 [Unit] section
2417 T}:T{
2418 an automatic property
2419 T}
2420 T{
2421 \fIBindsTo=\fR
2422 T}:T{
2423 \fIBoundBy=\fR
2424 T}:T{
2425 [Unit] section
2426 T}:T{
2427 an automatic property
2428 T}
2429 T{
2430 \fIRequisite=\fR
2431 T}:T{
2432 \fIRequisiteOf=\fR
2433 T}:T{
2434 [Unit] section
2435 T}:T{
2436 an automatic property
2437 T}
2438 T{
2439 \fIConflicts=\fR
2440 T}:T{
2441 \fIConflictedBy=\fR
2442 T}:T{
2443 [Unit] section
2444 T}:T{
2445 an automatic property
2446 T}
2447 T{
2448 \fITriggers=\fR
2449 T}:T{
2450 \fITriggeredBy=\fR
2451 T}:T{
2452 Automatic properties, see notes below
2453 T}
2454 T{
2455 \fIPropagatesReloadTo=\fR
2456 T}:T{
2457 \fIReloadPropagatedFrom=\fR
2458 T}:T{
2459 [Unit] section
2460 T}
2461 T{
2462 \fIReloadPropagatedFrom=\fR
2463 T}:T{
2464 \fIPropagatesReloadTo=\fR
2465 T}::
2466 T{
2467 \fIPropagatesStopTo=\fR
2468 T}:T{
2469 \fIStopPropagatedFrom=\fR
2470 T}:T{
2471 [Unit] section
2472 T}
2473 T{
2474 \fIStopPropagatedFrom=\fR
2475 T}:T{
2476 \fIPropagatesStopTo=\fR
2477 T}::
2478 T{
2479 \fIFollowing=\fR
2480 T}:T{
2481 n/a
2482 T}:T{
2483 An automatic property
2484 T}:T{
2485 \ \&
2486 T}
2487 .TE
2488 .sp 1
2489 .PP
2490 Note:
2491 \fIWantedBy=\fR,
2492 \fIRequiredBy=\fR, and
2493 \fIUpheldBy=\fR
2494 are used in the [Install] section to create symlinks in
2495 \&.wants/,
2496 \&.requires/, and
2497 \&.upholds/
2498 directories\&. They cannot be used directly as a unit configuration setting\&.
2499 .PP
2500 Note:
2501 \fIConsistsOf=\fR,
2502 \fIBoundBy=\fR,
2503 \fIRequisiteOf=\fR,
2504 \fIConflictedBy=\fR
2505 are created implicitly along with their reverses and cannot be specified directly\&.
2506 .PP
2507 Note:
2508 \fITriggers=\fR
2509 is created implicitly between a socket, path unit, or an automount unit, and the unit they activate\&. By default, a unit with the same name is triggered, but this can be overridden using
2510 \fISockets=\fR,
2511 \fIService=\fR, and
2512 \fIUnit=\fR
2513 settings\&. See
2514 \fBsystemd.service\fR(5),
2515 \fBsystemd.socket\fR(5),
2516 \fBsystemd.path\fR(5), and
2517 \fBsystemd.automount\fR(5)
2518 for details\&.
2519 \fITriggeredBy=\fR
2520 is created implicitly on the triggered unit\&.
2521 .PP
2522 Note:
2523 \fIFollowing=\fR
2524 is used to group device aliases and points to the "primary" device unit that systemd is using to track device state, usually corresponding to a sysfs path\&. It does not show up in the "target" unit\&.
2525 .SH "[INSTALL] SECTION OPTIONS"
2526 .PP
2527 Unit files may include an [Install] section, which carries installation information for the unit\&. This section is not interpreted by
2528 \fBsystemd\fR(1)
2529 during runtime; it is used by the
2530 \fBenable\fR
2531 and
2532 \fBdisable\fR
2533 commands of the
2534 \fBsystemctl\fR(1)
2535 tool during installation of a unit\&.
2536 .PP
2537 \fIAlias=\fR
2538 .RS 4
2539 A space\-separated list of additional names this unit shall be installed under\&. The names listed here must have the same suffix (i\&.e\&. type) as the unit filename\&. This option may be specified more than once, in which case all listed names are used\&. At installation time,
2540 \fBsystemctl enable\fR
2541 will create symlinks from these names to the unit filename\&. Note that not all unit types support such alias names, and this setting is not supported for them\&. Specifically, mount, slice, swap, and automount units do not support aliasing\&.
2542 .sp
2543 Added in version 201\&.
2544 .RE
2545 .PP
2546 \fIWantedBy=\fR, \fIRequiredBy=\fR, \fIUpheldBy=\fR
2547 .RS 4
2548 This option may be used more than once, or a space\-separated list of unit names may be given\&. A symbolic link is created in the
2549 \&.wants/,
2550 \&.requires/, or
2551 \&.upholds/
2552 directory of each of the listed units when this unit is installed by
2553 \fBsystemctl enable\fR\&. This has the effect of a dependency of type
2554 \fIWants=\fR,
2555 \fIRequires=\fR, or
2556 \fIUpholds=\fR
2557 being added from the listed unit to the current unit\&. See the description of the mentioned dependency types in the [Unit] section for details\&.
2558 .sp
2559 In case of template units listing non template units, the listing unit must have
2560 \fIDefaultInstance=\fR
2561 set, or
2562 \fBsystemctl enable\fR
2563 must be called with an instance name\&. The instance (default or specified) will be added to the
2564 \&.wants/,
2565 \&.requires/, or
2566 \&.upholds/
2567 list of the listed unit\&. For example,
2568 \fBWantedBy=getty\&.target\fR
2569 in a service
2570 getty@\&.service
2571 will result in
2572 \fBsystemctl enable getty@tty2\&.service\fR
2573 creating a
2574 getty\&.target\&.wants/getty@tty2\&.service
2575 link to
2576 getty@\&.service\&. This also applies to listing specific instances of templated units: this specific instance will gain the dependency\&. A template unit may also list a template unit, in which case a generic dependency will be added where each instance of the listing unit will have a dependency on an instance of the listed template with the same instance value\&. For example,
2577 \fBWantedBy=container@\&.target\fR
2578 in a service
2579 monitor@\&.service
2580 will result in
2581 \fBsystemctl enable monitor@\&.service\fR
2582 creating a
2583 container@\&.target\&.wants/monitor@\&.service
2584 link to
2585 monitor@\&.service, which applies to all instances of
2586 container@\&.target\&.
2587 .sp
2588 Added in version 201\&.
2589 .RE
2590 .PP
2591 \fIAlso=\fR
2592 .RS 4
2593 Additional units to install/deinstall when this unit is installed/deinstalled\&. If the user requests installation/deinstallation of a unit with this option configured,
2594 \fBsystemctl enable\fR
2595 and
2596 \fBsystemctl disable\fR
2597 will automatically install/uninstall units listed in this option as well\&.
2598 .sp
2599 This option may be used more than once, or a space\-separated list of unit names may be given\&.
2600 .sp
2601 Added in version 201\&.
2602 .RE
2603 .PP
2604 \fIDefaultInstance=\fR
2605 .RS 4
2606 In template unit files, this specifies for which instance the unit shall be enabled if the template is enabled without any explicitly set instance\&. This option has no effect in non\-template unit files\&. The specified string must be usable as instance identifier\&.
2607 .sp
2608 Added in version 215\&.
2609 .RE
2610 .PP
2611 The following specifiers are interpreted in the Install section: %a, %b, %B, %g, %G, %H, %i, %j, %l, %m, %n, %N, %o, %p, %u, %U, %v, %w, %W, %%\&. For their meaning see the next section\&.
2612 .SH "SPECIFIERS"
2613 .PP
2614 Many settings resolve specifiers which may be used to write generic unit files referring to runtime or unit parameters that are replaced when the unit files are loaded\&. Specifiers must be known and resolvable for the setting to be valid\&. The following specifiers are understood:
2615 .sp
2616 .it 1 an-trap
2617 .nr an-no-space-flag 1
2618 .nr an-break-flag 1
2619 .br
2620 .B Table\ \&5.\ \&Specifiers available in unit files
2621 .TS
2622 allbox tab(:);
2623 lB lB lB.
2624 T{
2625 Specifier
2626 T}:T{
2627 Meaning
2628 T}:T{
2629 Details
2630 T}
2631 .T&
2632 l l l
2633 l l l
2634 l l l
2635 l l l
2636 l l l
2637 l l l
2638 l l l
2639 l l l
2640 l l l
2641 l l l
2642 l l l
2643 l l l
2644 l l l
2645 l l l
2646 l l l
2647 l l l
2648 l l l
2649 l l l
2650 l l l
2651 l l l
2652 l l l
2653 l l l
2654 l l l
2655 l l l
2656 l l l
2657 l l l
2658 l l l
2659 l l l
2660 l l l
2661 l l l
2662 l l l
2663 l l l
2664 l l l
2665 l l l
2666 l l l
2667 l l l
2668 l l l
2669 l l l
2670 l l l
2671 l l l.
2672 T{
2673 "%a"
2674 T}:T{
2675 Architecture
2676 T}:T{
2677 A short string identifying the architecture of the local system\&. A string such as \fBx86\fR, \fBx86\-64\fR or \fBarm64\fR\&. See the architectures defined for \fIConditionArchitecture=\fR above for a full list\&.
2678 T}
2679 T{
2680 "%A"
2681 T}:T{
2682 Operating system image version
2683 T}:T{
2684 The operating system image version identifier of the running system, as read from the \fIIMAGE_VERSION=\fR field of /etc/os\-release\&. If not set, resolves to an empty string\&. See \fBos-release\fR(5) for more information\&.
2685 T}
2686 T{
2687 "%b"
2688 T}:T{
2689 Boot ID
2690 T}:T{
2691 The boot ID of the running system, formatted as string\&. See \fBrandom\fR(4) for more information\&.
2692 T}
2693 T{
2694 "%B"
2695 T}:T{
2696 Operating system build ID
2697 T}:T{
2698 The operating system build identifier of the running system, as read from the \fIBUILD_ID=\fR field of /etc/os\-release\&. If not set, resolves to an empty string\&. See \fBos-release\fR(5) for more information\&.
2699 T}
2700 T{
2701 "%C"
2702 T}:T{
2703 Cache directory root
2704 T}:T{
2705 This is either /var/cache (for the system manager) or the path "$XDG_CACHE_HOME" resolves to (for user managers)\&.
2706 T}
2707 T{
2708 "%d"
2709 T}:T{
2710 Credentials directory
2711 T}:T{
2712 This is the value of the "$CREDENTIALS_DIRECTORY" environment variable if available\&. See section "Credentials" in \fBsystemd.exec\fR(5) for more information\&.
2713 T}
2714 T{
2715 "%D"
2716 T}:T{
2717 Shared data directory
2718 T}:T{
2719 This is either /usr/share/ (for the system manager) or the path "$XDG_DATA_HOME" resolves to (for user managers)\&.
2720 T}
2721 T{
2722 "%E"
2723 T}:T{
2724 Configuration directory root
2725 T}:T{
2726 This is either /etc/ (for the system manager) or the path "$XDG_CONFIG_HOME" resolves to (for user managers)\&.
2727 T}
2728 T{
2729 "%f"
2730 T}:T{
2731 Unescaped filename
2732 T}:T{
2733 This is either the unescaped instance name (if applicable) with / prepended (if applicable), or the unescaped prefix name prepended with /\&. This implements unescaping according to the rules for escaping absolute file system paths discussed above\&.
2734 T}
2735 T{
2736 "%g"
2737 T}:T{
2738 User group
2739 T}:T{
2740 This is the name of the group running the service manager instance\&. In case of the system manager this resolves to "root"\&.
2741 T}
2742 T{
2743 "%G"
2744 T}:T{
2745 User GID
2746 T}:T{
2747 This is the numeric GID of the user running the service manager instance\&. In case of the system manager this resolves to "0"\&.
2748 T}
2749 T{
2750 "%h"
2751 T}:T{
2752 User home directory
2753 T}:T{
2754 This is the home directory of the \fIuser running the service manager instance\fR\&. In case of the system manager this resolves to "/root"\&.
2755
2756 Note that this setting is \fInot\fR influenced by the \fIUser=\fR setting configurable in the [Service] section of the service unit\&.
2757 T}
2758 T{
2759 "%H"
2760 T}:T{
2761 Host name
2762 T}:T{
2763 The hostname of the running system at the point in time the unit configuration is loaded\&.
2764 T}
2765 T{
2766 "%i"
2767 T}:T{
2768 Instance name
2769 T}:T{
2770 For instantiated units this is the string between the first "@" character and the type suffix\&. Empty for non\-instantiated units\&.
2771 T}
2772 T{
2773 "%I"
2774 T}:T{
2775 Unescaped instance name
2776 T}:T{
2777 Same as "%i", but with escaping undone\&.
2778 T}
2779 T{
2780 "%j"
2781 T}:T{
2782 Final component of the prefix
2783 T}:T{
2784 This is the string between the last "\-" and the end of the prefix name\&. If there is no "\-", this is the same as "%p"\&.
2785 T}
2786 T{
2787 "%J"
2788 T}:T{
2789 Unescaped final component of the prefix
2790 T}:T{
2791 Same as "%j", but with escaping undone\&.
2792 T}
2793 T{
2794 "%l"
2795 T}:T{
2796 Short host name
2797 T}:T{
2798 The hostname of the running system at the point in time the unit configuration is loaded, truncated at the first dot to remove any domain component\&.
2799 T}
2800 T{
2801 "%L"
2802 T}:T{
2803 Log directory root
2804 T}:T{
2805 This is either /var/log (for the system manager) or the path \fI$XDG_STATE_HOME\fR resolves to with /log appended (for user managers)\&.
2806 T}
2807 T{
2808 "%m"
2809 T}:T{
2810 Machine ID
2811 T}:T{
2812 The machine ID of the running system, formatted as string\&. See \fBmachine-id\fR(5) for more information\&.
2813 T}
2814 T{
2815 "%M"
2816 T}:T{
2817 Operating system image identifier
2818 T}:T{
2819 The operating system image identifier of the running system, as read from the \fIIMAGE_ID=\fR field of /etc/os\-release\&. If not set, resolves to an empty string\&. See \fBos-release\fR(5) for more information\&.
2820 T}
2821 T{
2822 "%n"
2823 T}:T{
2824 Full unit name
2825 T}:T{
2826 \ \&
2827 T}
2828 T{
2829 "%N"
2830 T}:T{
2831 Full unit name
2832 T}:T{
2833 Same as "%n", but with the type suffix removed\&.
2834 T}
2835 T{
2836 "%o"
2837 T}:T{
2838 Operating system ID
2839 T}:T{
2840 The operating system identifier of the running system, as read from the \fIID=\fR field of /etc/os\-release\&. See \fBos-release\fR(5) for more information\&.
2841 T}
2842 T{
2843 "%p"
2844 T}:T{
2845 Prefix name
2846 T}:T{
2847 For instantiated units, this refers to the string before the first "@" character of the unit name\&. For non\-instantiated units, same as "%N"\&.
2848 T}
2849 T{
2850 "%P"
2851 T}:T{
2852 Unescaped prefix name
2853 T}:T{
2854 Same as "%p", but with escaping undone\&.
2855 T}
2856 T{
2857 "%q"
2858 T}:T{
2859 Pretty host name
2860 T}:T{
2861 The pretty hostname of the running system at the point in time the unit configuration is loaded, as read from the \fIPRETTY_HOSTNAME=\fR field of /etc/machine\-info\&. If not set, resolves to the short hostname\&. See \fBmachine-info\fR(5) for more information\&.
2862 T}
2863 T{
2864 "%s"
2865 T}:T{
2866 User shell
2867 T}:T{
2868 This is the shell of the user running the service manager instance\&.
2869 T}
2870 T{
2871 "%S"
2872 T}:T{
2873 State directory root
2874 T}:T{
2875 This is either /var/lib (for the system manager) or the path \fI$XDG_STATE_HOME\fR resolves to (for user managers)\&.
2876 T}
2877 T{
2878 "%t"
2879 T}:T{
2880 Runtime directory root
2881 T}:T{
2882 This is either /run/ (for the system manager) or the path "$XDG_RUNTIME_DIR" resolves to (for user managers)\&.
2883 T}
2884 T{
2885 "%T"
2886 T}:T{
2887 Directory for temporary files
2888 T}:T{
2889 This is either /tmp or the path "$TMPDIR", "$TEMP" or "$TMP" are set to\&. (Note that the directory may be specified without a trailing slash\&.)
2890 T}
2891 T{
2892 "%u"
2893 T}:T{
2894 User name
2895 T}:T{
2896 This is the name of the \fIuser running the service manager instance\fR\&. In case of the system manager this resolves to "root"\&.
2897
2898 Note that this setting is \fInot\fR influenced by the \fIUser=\fR setting configurable in the [Service] section of the service unit\&.
2899 T}
2900 T{
2901 "%U"
2902 T}:T{
2903 User UID
2904 T}:T{
2905 This is the numeric UID of the \fIuser running the service manager instance\fR\&. In case of the system manager this resolves to "0"\&.
2906
2907 Note that this setting is \fInot\fR influenced by the \fIUser=\fR setting configurable in the [Service] section of the service unit\&.
2908 T}
2909 T{
2910 "%v"
2911 T}:T{
2912 Kernel release
2913 T}:T{
2914 Identical to \fBuname \-r\fR output\&.
2915 T}
2916 T{
2917 "%V"
2918 T}:T{
2919 Directory for larger and persistent temporary files
2920 T}:T{
2921 This is either /var/tmp or the path "$TMPDIR", "$TEMP" or "$TMP" are set to\&. (Note that the directory may be specified without a trailing slash\&.)
2922 T}
2923 T{
2924 "%w"
2925 T}:T{
2926 Operating system version ID
2927 T}:T{
2928 The operating system version identifier of the running system, as read from the \fIVERSION_ID=\fR field of /etc/os\-release\&. If not set, resolves to an empty string\&. See \fBos-release\fR(5) for more information\&.
2929 T}
2930 T{
2931 "%W"
2932 T}:T{
2933 Operating system variant ID
2934 T}:T{
2935 The operating system variant identifier of the running system, as read from the \fIVARIANT_ID=\fR field of /etc/os\-release\&. If not set, resolves to an empty string\&. See \fBos-release\fR(5) for more information\&.
2936 T}
2937 T{
2938 "%y"
2939 T}:T{
2940 The path to the fragment
2941 T}:T{
2942 This is the path where the main part of the unit file is located\&. For linked unit files, the real path outside of the unit search directories is used\&. For units that do not have a fragment file, this specifier will raise an error\&.
2943 T}
2944 T{
2945 "%Y"
2946 T}:T{
2947 The directory of the fragment
2948 T}:T{
2949 This is the directory part of "%y"\&.
2950 T}
2951 T{
2952 "%%"
2953 T}:T{
2954 Single percent sign
2955 T}:T{
2956 Use "%%" in place of "%" to specify a single percent sign\&.
2957 T}
2958 .TE
2959 .sp 1
2960 .SH "EXAMPLES"
2961 .PP
2962 \fBExample\ \&1.\ \&Allowing units to be enabled\fR
2963 .PP
2964 The following snippet (highlighted) allows a unit (e\&.g\&.
2965 foo\&.service) to be enabled via
2966 \fBsystemctl enable\fR:
2967 .sp
2968 .if n \{\
2969 .RS 4
2970 .\}
2971 .nf
2972 [Unit]
2973 Description=Foo
2974
2975 [Service]
2976 ExecStart=/usr/sbin/foo\-daemon
2977
2978 \fI[Install]\fR
2979 \fIWantedBy=multi\-user\&.target\fR
2980 .fi
2981 .if n \{\
2982 .RE
2983 .\}
2984 .PP
2985 After running
2986 \fBsystemctl enable\fR, a symlink
2987 /etc/systemd/system/multi\-user\&.target\&.wants/foo\&.service
2988 linking to the actual unit will be created\&. It tells systemd to pull in the unit when starting
2989 multi\-user\&.target\&. The inverse
2990 \fBsystemctl disable\fR
2991 will remove that symlink again\&.
2992 .PP
2993 \fBExample\ \&2.\ \&Overriding vendor settings\fR
2994 .PP
2995 There are two methods of overriding vendor settings in unit files: copying the unit file from
2996 /usr/lib/systemd/system
2997 to
2998 /etc/systemd/system
2999 and modifying the chosen settings\&. Alternatively, one can create a directory named
3000 \fIunit\fR\&.d/
3001 within
3002 /etc/systemd/system
3003 and place a drop\-in file
3004 \fIname\fR\&.conf
3005 there that only changes the specific settings one is interested in\&. Note that multiple such drop\-in files are read if present, processed in lexicographic order of their filename\&.
3006 .PP
3007 The advantage of the first method is that one easily overrides the complete unit, the vendor unit is not parsed at all anymore\&. It has the disadvantage that improvements to the unit file by the vendor are not automatically incorporated on updates\&.
3008 .PP
3009 The advantage of the second method is that one only overrides the settings one specifically wants, where updates to the unit by the vendor automatically apply\&. This has the disadvantage that some future updates by the vendor might be incompatible with the local changes\&.
3010 .PP
3011 This also applies for user instances of systemd, but with different locations for the unit files\&. See the section on unit load paths for further details\&.
3012 .PP
3013 Suppose there is a vendor\-supplied unit
3014 /usr/lib/systemd/system/httpd\&.service
3015 with the following contents:
3016 .sp
3017 .if n \{\
3018 .RS 4
3019 .\}
3020 .nf
3021 [Unit]
3022 Description=Some HTTP Server
3023 After=remote\-fs\&.target sqldb\&.service
3024 Requires=sqldb\&.service
3025 AssertPathExists=/srv/webserver
3026
3027 [Service]
3028 Type=notify
3029 ExecStart=/usr/sbin/some\-fancy\-httpd\-server
3030 Nice=5
3031
3032 [Install]
3033 WantedBy=multi\-user\&.target
3034 .fi
3035 .if n \{\
3036 .RE
3037 .\}
3038 .PP
3039 Now one wants to change some settings as an administrator: firstly, in the local setup,
3040 /srv/webserver
3041 might not exist, because the HTTP server is configured to use
3042 /srv/www
3043 instead\&. Secondly, the local configuration makes the HTTP server also depend on a memory cache service,
3044 memcached\&.service, that should be pulled in (\fIRequires=\fR) and also be ordered appropriately (\fIAfter=\fR)\&. Thirdly, in order to harden the service a bit more, the administrator would like to set the
3045 \fIPrivateTmp=\fR
3046 setting (see
3047 \fBsystemd.exec\fR(5)
3048 for details)\&. And lastly, the administrator would like to reset the niceness of the service to its default value of 0\&.
3049 .PP
3050 The first possibility is to copy the unit file to
3051 /etc/systemd/system/httpd\&.service
3052 and change the chosen settings:
3053 .sp
3054 .if n \{\
3055 .RS 4
3056 .\}
3057 .nf
3058 [Unit]
3059 Description=Some HTTP Server
3060 After=remote\-fs\&.target sqldb\&.service \fImemcached\&.service\fR
3061 Requires=sqldb\&.service \fImemcached\&.service\fR
3062 AssertPathExists=\fI/srv/www\fR
3063
3064 [Service]
3065 Type=notify
3066 ExecStart=/usr/sbin/some\-fancy\-httpd\-server
3067 \fINice=0\fR
3068 \fIPrivateTmp=yes\fR
3069
3070 [Install]
3071 WantedBy=multi\-user\&.target
3072 .fi
3073 .if n \{\
3074 .RE
3075 .\}
3076 .PP
3077 Alternatively, the administrator could create a drop\-in file
3078 /etc/systemd/system/httpd\&.service\&.d/local\&.conf
3079 with the following contents:
3080 .sp
3081 .if n \{\
3082 .RS 4
3083 .\}
3084 .nf
3085 [Unit]
3086 After=memcached\&.service
3087 Requires=memcached\&.service
3088 # Reset all assertions and then re\-add the condition we want
3089 AssertPathExists=
3090 AssertPathExists=/srv/www
3091
3092 [Service]
3093 Nice=0
3094 PrivateTmp=yes
3095 .fi
3096 .if n \{\
3097 .RE
3098 .\}
3099 .PP
3100 Note that for drop\-in files, if one wants to remove entries from a setting that is parsed as a list (and is not a dependency), such as
3101 \fIAssertPathExists=\fR
3102 (or e\&.g\&.
3103 \fIExecStart=\fR
3104 in service units), one needs to first clear the list before re\-adding all entries except the one that is to be removed\&. Dependencies (\fIAfter=\fR, etc\&.) cannot be reset to an empty list, so dependencies can only be added in drop\-ins\&. If you want to remove dependencies, you have to override the entire unit\&.
3105 .PP
3106 \fBExample\ \&3.\ \&Top level drop\-ins with template units\fR
3107 .PP
3108 Top level per\-type drop\-ins can be used to change some aspect of all units of a particular type\&. For example, by creating the
3109 /etc/systemd/system/service\&.d/
3110 directory with a drop\-in file, the contents of the drop\-in file can be applied to all service units\&. We can take this further by having the top\-level drop\-in instantiate a secondary helper unit\&. Consider for example the following set of units and drop\-in files where we install an
3111 \fIOnFailure=\fR
3112 dependency for all service units\&.
3113 .PP
3114 /etc/systemd/system/failure\-handler@\&.service:
3115 .sp
3116 .if n \{\
3117 .RS 4
3118 .\}
3119 .nf
3120 [Unit]
3121 Description=My Failure Handler For %i
3122
3123 [Service]
3124 Type=oneshot
3125 # Perform some special action for when %i exits unexpectedly\&.
3126 ExecStart=/usr/sbin/myfailurehandler %i
3127 .fi
3128 .if n \{\
3129 .RE
3130 .\}
3131 .PP
3132 We can then add an instance of
3133 failure\-handler@\&.service
3134 as an
3135 \fIOnFailure=\fR
3136 dependency for all service units\&.
3137 .PP
3138 /etc/systemd/system/service\&.d/10\-all\&.conf:
3139 .sp
3140 .if n \{\
3141 .RS 4
3142 .\}
3143 .nf
3144 [Unit]
3145 OnFailure=failure\-handler@%N\&.service
3146 .fi
3147 .if n \{\
3148 .RE
3149 .\}
3150 .PP
3151 Now, after running
3152 \fBsystemctl daemon\-reload\fR
3153 all services will have acquired an
3154 \fIOnFailure=\fR
3155 dependency on
3156 failure\-handler@%N\&.service\&. The template instance units will also have gained the dependency which results in the creation of a recursive dependency chain\&. systemd will try to detect these recursive dependency chains where a template unit directly and recursively depends on itself and will remove such dependencies automatically if it finds them\&. If systemd does not detect the recursive dependency chain, we can break the chain ourselves by disabling the drop\-in for the template instance units via a symlink to
3157 /dev/null:
3158 .sp
3159 .if n \{\
3160 .RS 4
3161 .\}
3162 .nf
3163 \fBmkdir /etc/systemd/system/failure\-handler@\&.service\&.d/\fR
3164 \fBln \-s /dev/null /etc/systemd/system/failure\-handler@\&.service\&.d/10\-all\&.conf\fR
3165 \fBsystemctl daemon\-reload\fR
3166 .fi
3167 .if n \{\
3168 .RE
3169 .\}
3170 .PP
3171 This ensures that if a
3172 failure\-handler@\&.service
3173 instance fails it will not trigger an instance named
3174 failure\-handler@failure\-handler\&.service\&.
3175 .SH "SEE ALSO"
3176 .PP
3177 \fBsystemd\fR(1), \fBsystemctl\fR(1), \fBsystemd-system.conf\fR(5), \fBsystemd.special\fR(7), \fBsystemd.service\fR(5), \fBsystemd.socket\fR(5), \fBsystemd.device\fR(5), \fBsystemd.mount\fR(5), \fBsystemd.automount\fR(5), \fBsystemd.swap\fR(5), \fBsystemd.target\fR(5), \fBsystemd.path\fR(5), \fBsystemd.timer\fR(5), \fBsystemd.scope\fR(5), \fBsystemd.slice\fR(5), \fBsystemd.time\fR(7), \fBsystemd-analyze\fR(1), \fBcapabilities\fR(7), \fBsystemd.directives\fR(7), \fBuname\fR(1)
3178 .SH "NOTES"
3179 .IP " 1." 4
3180 Interface Portability and Stability Promise
3181 .RS 4
3182 \%https://systemd.io/PORTABILITY_AND_STABILITY/
3183 .RE
3184 .IP " 2." 4
3185 ๐Ÿ’ฃ๐Ÿ’ฅ๐Ÿงจ๐Ÿ’ฅ๐Ÿ’ฅ๐Ÿ’ฃ Please note that those configuration files must be available at all times. If
3186 /usr/local/
3187 is a separate partition, it may not be available during early boot, and must not be used for configuration.
3188 .IP " 3." 4
3189 systemd and Storage Daemons for the Root File System
3190 .RS 4
3191 \%https://systemd.io/ROOT_STORAGE_DAEMONS
3192 .RE
3193 .IP " 4." 4
3194 System and Service Credentials
3195 .RS 4
3196 \%https://systemd.io/CREDENTIALS
3197 .RE
3198 .IP " 5." 4
3199 PSI (Pressure Stall Information)
3200 .RS 4
3201 \%https://docs.kernel.org/accounting/psi.html
3202 .RE