Debian Codegraph @

upstream/opensuse-tumbleweed/man5/systemd.unit.5

raw
1 '\" t
2 .TH "SYSTEMD\&.UNIT" "5" "" "systemd 260.1" "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 The unit file format is covered by the
342 \m[blue]\fBInterface Portability and Stability Promise\fR\m[]\&\s-2\u[1]\d\s+2\&.
343 .SH "STRING ESCAPING FOR INCLUSION IN UNIT NAMES"
344 .PP
345 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
346 \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
347 dev\-sda\&.device
348 refers to a device with the device node
349 /dev/sda
350 in the file system\&.
351 .PP
352 The escaping algorithm operates as follows: given a string, any
353 "/"
354 character is replaced by
355 "\-", and all other characters which are not ASCII alphanumerics,
356 ":",
357 "_"
358 or
359 "\&."
360 are replaced by C\-style
361 "\ex2d"
362 escapes\&. In addition,
363 "\&."
364 is replaced with such a C\-style escape when it would appear as the first character in the escaped string\&.
365 .PP
366 When the input qualifies as absolute file system path, this algorithm is extended slightly: the path to the root directory
367 "/"
368 is encoded as single dash
369 "\-"\&. In addition, any leading, trailing or duplicate
370 "/"
371 characters are removed from the string before transformation\&. Example:
372 /foo//bar/baz/
373 becomes
374 "foo\-bar\-baz"\&.
375 .PP
376 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
377 \fBsystemd-escape\fR(1)
378 command may be used to apply and reverse escaping on arbitrary strings\&. Use
379 \fBsystemd\-escape \-\-path\fR
380 to escape path strings, and
381 \fBsystemd\-escape\fR
382 without
383 \fB\-\-path\fR
384 otherwise\&.
385 .SH "AUTOMATIC DEPENDENCIES"
386 .SS "Implicit Dependencies"
387 .PP
388 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\&.
389 .PP
390 For example, service units with
391 \fIType=dbus\fR
392 automatically acquire dependencies of type
393 \fIRequires=\fR
394 and
395 \fIAfter=\fR
396 on
397 dbus\&.socket\&. See
398 \fBsystemd.service\fR(5)
399 for details\&.
400 .SS "Default Dependencies"
401 .PP
402 Default dependencies are similar to implicit dependencies, but can be turned on and off by setting
403 \fIDefaultDependencies=\fR
404 to
405 \fIyes\fR
406 (the default) and
407 \fIno\fR, while implicit dependencies are always in effect\&. See section "Default Dependencies" in respective man pages for the effect of enabling
408 \fIDefaultDependencies=\fR
409 in each unit types\&.
410 .PP
411 For example, target units will complement all configured dependencies of type
412 \fIWants=\fR
413 or
414 \fIRequires=\fR
415 with dependencies of type
416 \fIAfter=\fR\&. See
417 \fBsystemd.target\fR(5)
418 for details\&. Note that this behavior can be opted out by setting
419 \fIDefaultDependencies=no\fR
420 in the specified units, or it can be selectively overridden via an explicit
421 \fIBefore=\fR
422 dependency\&.
423 .SH "UNIT FILE LOAD PATH"
424 .PP
425 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
426 \&\s-2\u[2]\d\s+2\&.
427 .PP
428 When the variable
429 \fI$SYSTEMD_UNIT_PATH\fR
430 is set, the contents of this variable overrides the unit load path\&. If
431 \fI$SYSTEMD_UNIT_PATH\fR
432 ends with an empty component (":"), the usual unit load path will be appended to the contents of the variable\&.
433 .sp
434 .it 1 an-trap
435 .nr an-no-space-flag 1
436 .nr an-break-flag 1
437 .br
438 .B Table\ \&1.\ \& Load path when running in system mode (\-\-system)\&.
439 .TS
440 allbox tab(:);
441 lB lB.
442 T{
443 Path
444 T}:T{
445 Description
446 T}
447 .T&
448 l l
449 l ^
450 l l
451 l l
452 l l
453 l l
454 l l
455 l l
456 l l
457 l l.
458 T{
459 /etc/systemd/system\&.control
460 T}:T{
461 Persistent and transient configuration created using the dbus API
462 T}
463 T{
464 /run/systemd/system\&.control
465 T}:
466 T{
467 /run/systemd/transient
468 T}:T{
469 Dynamic configuration for transient units
470 T}
471 T{
472 /run/systemd/generator\&.early
473 T}:T{
474 Generated units with high priority (see \fIearly\-dir\fR in \fBsystemd.generator\fR(7))
475 T}
476 T{
477 /etc/systemd/system
478 T}:T{
479 System units created by the administrator
480 T}
481 T{
482 /run/systemd/system
483 T}:T{
484 Runtime units
485 T}
486 T{
487 /run/systemd/generator
488 T}:T{
489 Generated units with medium priority (see \fInormal\-dir\fR in \fBsystemd.generator\fR(7))
490 T}
491 T{
492 /usr/local/lib/systemd/system
493 T}:T{
494 System units installed by the administrator
495 T}
496 T{
497 /usr/lib/systemd/system
498 T}:T{
499 System units installed by the distribution package manager
500 T}
501 T{
502 /run/systemd/generator\&.late
503 T}:T{
504 Generated units with low priority (see \fIlate\-dir\fR in \fBsystemd.generator\fR(7))
505 T}
506 .TE
507 .sp 1
508 .sp
509 .it 1 an-trap
510 .nr an-no-space-flag 1
511 .nr an-break-flag 1
512 .br
513 .B Table\ \&2.\ \& Load path when running in user mode (\-\-user)\&.
514 .TS
515 allbox tab(:);
516 lB lB.
517 T{
518 Path
519 T}:T{
520 Description
521 T}
522 .T&
523 l l
524 l ^
525 l l
526 l l
527 l l
528 l l
529 l 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 T{
540 $XDG_CONFIG_HOME/systemd/user\&.control or ~/\&.config/systemd/user\&.control
541 T}:T{
542 Persistent and transient configuration created using the dbus API (\fI$XDG_CONFIG_HOME\fR is used if set, ~/\&.config otherwise)
543 T}
544 T{
545 $XDG_RUNTIME_DIR/systemd/user\&.control
546 T}:
547 T{
548 $XDG_RUNTIME_DIR/systemd/transient
549 T}:T{
550 Dynamic configuration for transient units
551 T}
552 T{
553 $XDG_RUNTIME_DIR/systemd/generator\&.early
554 T}:T{
555 Generated units with high priority (see \fIearly\-dir\fR in \fBsystemd.generator\fR(7))
556 T}
557 T{
558 $XDG_CONFIG_HOME/systemd/user or $HOME/\&.config/systemd/user
559 T}:T{
560 User configuration (\fI$XDG_CONFIG_HOME\fR is used if set, ~/\&.config otherwise)
561 T}
562 T{
563 $XDG_CONFIG_DIRS/systemd/user or /etc/xdg/systemd/user
564 T}:T{
565 Additional configuration directories as specified by the XDG base directory specification (\fI$XDG_CONFIG_DIRS\fR is used if set, /etc/xdg otherwise)
566 T}
567 T{
568 /etc/systemd/user
569 T}:T{
570 User units created by the administrator
571 T}
572 T{
573 $XDG_RUNTIME_DIR/systemd/user
574 T}:T{
575 Runtime units (only used when $XDG_RUNTIME_DIR is set)
576 T}
577 T{
578 /run/systemd/user
579 T}:T{
580 Runtime units
581 T}
582 T{
583 $XDG_RUNTIME_DIR/systemd/generator
584 T}:T{
585 Generated units with medium priority (see \fInormal\-dir\fR in \fBsystemd.generator\fR(7))
586 T}
587 T{
588 $XDG_DATA_HOME/systemd/user or $HOME/\&.local/share/systemd/user
589 T}:T{
590 Units of packages that have been installed in the home directory (\fI$XDG_DATA_HOME\fR is used if set, ~/\&.local/share otherwise)
591 T}
592 T{
593 $XDG_DATA_DIRS/systemd/user or /usr/local/share/systemd/user and /usr/share/systemd/user
594 T}:T{
595 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)
596 T}
597 T{
598 $dir/systemd/user for each \fI$dir\fR in \fI$XDG_DATA_DIRS\fR
599 T}:T{
600 Additional locations for installed user units, one for each entry in \fI$XDG_DATA_DIRS\fR
601 T}
602 T{
603 /usr/local/lib/systemd/user
604 T}:T{
605 User units installed by the administrator
606 T}
607 T{
608 /usr/lib/systemd/user
609 T}:T{
610 User units installed by the distribution package manager
611 T}
612 T{
613 $XDG_RUNTIME_DIR/systemd/generator\&.late
614 T}:T{
615 Generated units with low priority (see \fIlate\-dir\fR in \fBsystemd.generator\fR(7))
616 T}
617 .TE
618 .sp 1
619 .PP
620 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
621 \fBsystemd.environment-generator\fR(7)\&. In particular,
622 \fI$XDG_DATA_HOME\fR
623 and
624 \fI$XDG_DATA_DIRS\fR
625 may be easily set using
626 \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
627 .sp
628 .if n \{\
629 .RS 4
630 .\}
631 .nf
632 systemd\-analyze \-\-user unit\-paths
633 .fi
634 .if n \{\
635 .RE
636 .\}
637 .PP
638 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
639 \fBsystemctl link\fR
640 for this; see
641 \fBsystemctl\fR(1)\&. The file system where the linked unit files are located must be accessible when systemd is started (e\&.g\&. anything underneath
642 /home/
643 or
644 /var/
645 is not allowed, unless those directories are located on the root file system)\&.
646 .PP
647 It is important to distinguish "linked unit files" from "unit file aliases": any symlink where the symlink
648 \fItarget\fR
649 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
650 /etc/systemd/system/alias1\&.service
651 โ†’
652 service1\&.service,
653 /etc/systemd/system/alias2\&.service
654 โ†’
655 /usr/lib/systemd/service1\&.service,
656 /etc/systemd/system/alias3\&.service
657 โ†’
658 /etc/systemd/system/service1\&.service
659 are all valid aliases and
660 service1\&.service
661 will have four names, even if the unit file is located at
662 /run/systemd/system/service1\&.service\&. In contrast, a symlink
663 /etc/systemd/system/link1\&.service
664 โ†’
665 \&.\&./link1_service_file
666 means that
667 link1\&.service
668 is a "linked unit" and the contents of
669 /etc/systemd/link1_service_file
670 provide its configuration\&.
671 .SH "UNIT GARBAGE COLLECTION"
672 .PP
673 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:
674 .sp
675 .RS 4
676 .ie n \{\
677 \h'-04' 1.\h'+01'\c
678 .\}
679 .el \{\
680 .sp -1
681 .IP " 1." 4.2
682 .\}
683 Another loaded unit references it with a dependency such as
684 \fIAfter=\fR,
685 \fIWants=\fR, \&...
686 .RE
687 .sp
688 .RS 4
689 .ie n \{\
690 \h'-04' 2.\h'+01'\c
691 .\}
692 .el \{\
693 .sp -1
694 .IP " 2." 4.2
695 .\}
696 The unit is currently starting, running, reloading or stopping\&.
697 .RE
698 .sp
699 .RS 4
700 .ie n \{\
701 \h'-04' 3.\h'+01'\c
702 .\}
703 .el \{\
704 .sp -1
705 .IP " 3." 4.2
706 .\}
707 The unit is currently in the
708 \fBfailed\fR
709 state\&. (But see below\&.)
710 .RE
711 .sp
712 .RS 4
713 .ie n \{\
714 \h'-04' 4.\h'+01'\c
715 .\}
716 .el \{\
717 .sp -1
718 .IP " 4." 4.2
719 .\}
720 A job for the unit is pending\&.
721 .RE
722 .sp
723 .RS 4
724 .ie n \{\
725 \h'-04' 5.\h'+01'\c
726 .\}
727 .el \{\
728 .sp -1
729 .IP " 5." 4.2
730 .\}
731 The unit is pinned by an active IPC client program\&.
732 .RE
733 .sp
734 .RS 4
735 .ie n \{\
736 \h'-04' 6.\h'+01'\c
737 .\}
738 .el \{\
739 .sp -1
740 .IP " 6." 4.2
741 .\}
742 The unit is a special "perpetual" unit that is always active and loaded\&. Examples for perpetual units are the root mount unit
743 \-\&.mount
744 or the scope unit
745 init\&.scope
746 that the service manager itself lives in\&.
747 .RE
748 .sp
749 .RS 4
750 .ie n \{\
751 \h'-04' 7.\h'+01'\c
752 .\}
753 .el \{\
754 .sp -1
755 .IP " 7." 4.2
756 .\}
757 The unit has running processes associated with it\&.
758 .RE
759 .PP
760 The garbage collection logic may be altered with the
761 \fICollectMode=\fR
762 option, which allows configuration whether automatic unloading of units that are in
763 \fBfailed\fR
764 state is permissible, see below\&.
765 .PP
766 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\&.
767 .PP
768 Use
769 \fBsystemctl daemon\-reload\fR
770 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\&.
771 .SH "[UNIT] SECTION OPTIONS"
772 .PP
773 The unit file may include a [Unit] section, which carries generic information about the unit that is not dependent on the type of unit:
774 .PP
775 \fIDescription=\fR
776 .RS 4
777 A brief, meaningful, human\-readable text identifying the unit\&. This may be used by
778 \fBsystemd\fR
779 (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\&.
780 "Apache HTTP Server"
781 or
782 "Postfix Mail Server"
783 are good examples\&. Bad examples are
784 "high\-performance lightweight HTTP server"
785 (too generic) or
786 "Apache"
787 (meaningless for people who do not know the Apache HTTP server project, duplicates the unit name)\&.
788 \fBsystemd\fR
789 may use this string as a noun in status messages ("Starting \fIDescription\fR\&.\&.\&.",
790 "Started \fIDescription\fR\&.",
791 "Reached target \fIDescription\fR\&.",
792 "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
793 "exiting the container",
794 "updating the database once per day\&.", or
795 "OpenSSH server second instance daemon"\&.
796 .sp
797 Added in version 201\&.
798 .RE
799 .PP
800 \fIDocumentation=\fR
801 .RS 4
802 A space\-separated list of URIs referencing documentation for this unit or its configuration\&. Accepted are only URIs of the types
803 "http://",
804 "https://",
805 "file:",
806 "info:",
807 "man:"\&. For more information about the syntax of these URIs, see
808 \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\&.
809 .sp
810 Added in version 201\&.
811 .RE
812 .PP
813 \fIWants=\fR
814 .RS 4
815 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
816 \&.wants/
817 directory accompanying the unit file\&. For details, see above\&.
818 .sp
819 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\&.
820 .sp
821 Note that requirement dependencies do not influence the order in which services are started or stopped\&. This has to be configured independently with the
822 \fIAfter=\fR
823 or
824 \fIBefore=\fR
825 options\&. If unit
826 foo\&.service
827 pulls in unit
828 bar\&.service
829 as configured with
830 \fIWants=\fR
831 and no ordering is configured with
832 \fIAfter=\fR
833 or
834 \fIBefore=\fR, then both units will be started simultaneously and without any delay between them if
835 foo\&.service
836 is activated\&.
837 .sp
838 Added in version 201\&.
839 .RE
840 .PP
841 \fIRequires=\fR
842 .RS 4
843 Similar to
844 \fIWants=\fR, but declares a stronger requirement dependency\&. Dependencies of this type may also be configured by adding a symlink to a
845 \&.requires/
846 directory accompanying the unit file\&.
847 .sp
848 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
849 \fIAfter=\fR
850 on the failing unit is set, this unit will not be started\&. Besides, with or without specifying
851 \fIAfter=\fR, this unit will be stopped (or restarted) if one of the other units is explicitly stopped (or restarted)\&.
852 .sp
853 Often, it is a better choice to use
854 \fIWants=\fR
855 instead of
856 \fIRequires=\fR
857 in order to achieve a system that is more robust when dealing with failing services\&.
858 .sp
859 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
860 \fIConditionPathExists=\fR,
861 \fIConditionPathIsSymbolicLink=\fR, \&... \(em see below) do not cause the start job of a unit with a
862 \fIRequires=\fR
863 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
864 \fIRequires=\fR
865 dependency\&. Use the
866 \fIBindsTo=\fR
867 dependency type together with
868 \fIAfter=\fR
869 to ensure that a unit may never be in active state without a specific other unit also in active state (see below)\&.
870 .sp
871 Added in version 201\&.
872 .RE
873 .PP
874 \fIRequisite=\fR
875 .RS 4
876 Similar to
877 \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\&.
878 \fIRequisite=\fR
879 does not imply an ordering dependency, even if both units are started in the same transaction\&. Hence this setting should usually be combined with
880 \fIAfter=\fR, to ensure this unit is not started before the other unit\&.
881 .sp
882 When
883 \fIRequisite=b\&.service\fR
884 is used on
885 a\&.service, this dependency will show as
886 \fIRequisiteOf=a\&.service\fR
887 in property listing of
888 b\&.service\&.
889 \fIRequisiteOf=\fR
890 dependency cannot be specified directly\&.
891 .sp
892 Added in version 201\&.
893 .RE
894 .PP
895 \fIBindsTo=\fR
896 .RS 4
897 Configures requirement dependencies, very similar in style to
898 \fIRequires=\fR\&. However, this dependency type is stronger: in addition to the effects of
899 \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\&.
900 .sp
901 When used in conjunction with
902 \fIAfter=\fR
903 on the same unit the behaviour of
904 \fIBindsTo=\fR
905 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
906 \fIConditionPathExists=\fR,
907 \fIConditionPathIsSymbolicLink=\fR, \&... \(em see below) will be stopped, should it be running\&. Hence, in many cases it is best to combine
908 \fIBindsTo=\fR
909 with
910 \fIAfter=\fR\&.
911 .sp
912 When
913 \fIBindsTo=b\&.service\fR
914 is used on
915 a\&.service, this dependency will show as
916 \fIBoundBy=a\&.service\fR
917 in property listing of
918 b\&.service\&.
919 \fIBoundBy=\fR
920 dependency cannot be specified directly\&.
921 .sp
922 Added in version 201\&.
923 .RE
924 .PP
925 \fIPartOf=\fR
926 .RS 4
927 Configures dependencies similar to
928 \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\&.
929 .sp
930 When
931 \fIPartOf=b\&.service\fR
932 is used on
933 a\&.service, this dependency will show as
934 \fIConsistsOf=a\&.service\fR
935 in property listing of
936 b\&.service\&.
937 \fIConsistsOf=\fR
938 dependency cannot be specified directly\&.
939 .sp
940 Added in version 201\&.
941 .RE
942 .PP
943 \fIUpholds=\fR
944 .RS 4
945 Configures dependencies similar to
946 \fIWants=\fR, but as long as this unit is up, all units listed in
947 \fIUpholds=\fR
948 are started whenever found to be inactive or failed, and no job is queued for them\&. While a
949 \fIWants=\fR
950 dependency on another unit has a one\-time effect when this units started, a
951 \fIUpholds=\fR
952 dependency on it has a continuous effect, constantly restarting the unit if necessary\&. This is an alternative to the
953 \fIRestart=\fR
954 setting of service units, to ensure they are kept running whatever happens\&. The restart happens without delay, and usual per\-unit rate\-limit applies\&.
955 .sp
956 When
957 \fIUpholds=b\&.service\fR
958 is used on
959 a\&.service, this dependency will show as
960 \fIUpheldBy=a\&.service\fR
961 in the property listing of
962 b\&.service\&.
963 .sp
964 Added in version 249\&.
965 .RE
966 .PP
967 \fIConflicts=\fR
968 .RS 4
969 A space\-separated list of unit names\&. Configures negative requirement dependencies\&. If a unit has a
970 \fIConflicts=\fR
971 requirement on a set of other units, then starting it will stop all of them and starting any of them will stop it\&.
972 .sp
973 Note that this setting does not imply an ordering dependency, similarly to the
974 \fIWants=\fR
975 and
976 \fIRequires=\fR
977 dependencies described above\&. This means that to ensure that the conflicting unit is stopped before the other unit is started, an
978 \fIAfter=\fR
979 or
980 \fIBefore=\fR
981 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
982 \fIBefore=\fR/\fIAfter=\fR
983 below\&.
984 .sp
985 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\&.
986 .sp
987 Added in version 201\&.
988 .RE
989 .PP
990 \fIBefore=\fR, \fIAfter=\fR
991 .RS 4
992 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\&.
993 .sp
994 Those two settings configure ordering dependencies between units\&. If unit
995 foo\&.service
996 contains the setting
997 \fBBefore=bar\&.service\fR
998 and both units are being started,
999 bar\&.service\*(Aqs start\-up is delayed until
1000 foo\&.service
1001 has finished starting up\&.
1002 \fIAfter=\fR
1003 is the inverse of
1004 \fIBefore=\fR, i\&.e\&. while
1005 \fIBefore=\fR
1006 ensures that the configured unit is started before the listed unit begins starting up,
1007 \fIAfter=\fR
1008 ensures the opposite, that the listed unit is fully started up before the configured unit is started\&.
1009 .sp
1010 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
1011 \fIAfter=\fR
1012 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
1013 \fIAfter=\fR
1014 or
1015 \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
1016 \fIBefore=\fR/\fIAfter=\fR
1017 when all its configured start\-up commands have been invoked and they either failed or reported start\-up success\&. Note that this includes
1018 \fIExecStartPost=\fR
1019 (or
1020 \fIExecStopPost=\fR
1021 for the shutdown case)\&.
1022 .sp
1023 Note that those settings are independent of and orthogonal to the requirement dependencies as configured by
1024 \fIRequires=\fR,
1025 \fIWants=\fR,
1026 \fIRequisite=\fR, or
1027 \fIBindsTo=\fR\&. It is a common pattern to include a unit name in both the
1028 \fIAfter=\fR
1029 and
1030 \fIWants=\fR
1031 options, in which case the unit listed will be started before the unit that is configured with these options\&.
1032 .sp
1033 Note that
1034 \fIBefore=\fR
1035 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\&.
1036 .sp
1037 Added in version 201\&.
1038 .RE
1039 .PP
1040 \fIOnFailure=\fR
1041 .RS 4
1042 A space\-separated list of one or more units that are activated when this unit enters the
1043 "failed"
1044 state\&.
1045 .sp
1046 Added in version 201\&.
1047 .RE
1048 .PP
1049 \fIOnSuccess=\fR
1050 .RS 4
1051 A space\-separated list of one or more units that are activated when this unit enters the
1052 "inactive"
1053 state\&.
1054 .sp
1055 Added in version 249\&.
1056 .RE
1057 .PP
1058 \fIPropagatesReloadTo=\fR, \fIReloadPropagatedFrom=\fR
1059 .RS 4
1060 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\&.
1061 .sp
1062 Added in version 201\&.
1063 .RE
1064 .PP
1065 \fIPropagatesStopTo=\fR, \fIStopPropagatedFrom=\fR
1066 .RS 4
1067 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\&.
1068 .sp
1069 Added in version 249\&.
1070 .RE
1071 .PP
1072 \fIJoinsNamespaceOf=\fR
1073 .RS 4
1074 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,
1075 a\&.service
1076 has
1077 \fIJoinsNamespaceOf=b\&.service\fR), then the inverse dependency (\fIJoinsNamespaceOf=a\&.service\fR
1078 for b\&.service) is implied\&. This only applies to unit types which support the
1079 \fIPrivateNetwork=\fR,
1080 \fINetworkNamespacePath=\fR,
1081 \fIPrivateIPC=\fR,
1082 \fIIPCNamespacePath=\fR, and
1083 \fIPrivateTmp=\fR
1084 directives (see
1085 \fBsystemd.exec\fR(5)
1086 for details)\&. If a unit that has this setting set is started, its processes will see the same
1087 /tmp/,
1088 /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
1089 \fIPrivateNetwork=\fR/\fINetworkNamespacePath=\fR,
1090 \fIPrivateIPC=\fR/\fIIPCNamespacePath=\fR
1091 and/or
1092 \fIPrivateTmp=\fR
1093 is enabled for both the unit that joins the namespace and the unit whose namespace is joined\&.
1094 .sp
1095 Added in version 209\&.
1096 .RE
1097 .PP
1098 \fIRequiresMountsFor=\fR
1099 .RS 4
1100 Takes a space\-separated list of absolute paths\&. Automatically adds dependencies of type
1101 \fIRequires=\fR
1102 and
1103 \fIAfter=\fR
1104 for all mount units required to access the specified path\&.
1105 .sp
1106 Mount points marked with
1107 \fBnoauto\fR
1108 are not mounted automatically through
1109 local\-fs\&.target, but are still honored for the purposes of this option, i\&.e\&. they will be pulled in by this unit\&.
1110 .sp
1111 Added in version 201\&.
1112 .RE
1113 .PP
1114 \fIWantsMountsFor=\fR
1115 .RS 4
1116 Same as
1117 \fIRequiresMountsFor=\fR, but adds dependencies of type
1118 \fIWants=\fR
1119 instead of
1120 \fIRequires=\fR\&.
1121 .sp
1122 Added in version 256\&.
1123 .RE
1124 .PP
1125 \fIOnSuccessJobMode=\fR, \fIOnFailureJobMode=\fR
1126 .RS 4
1127 Takes a value of
1128 "fail",
1129 "replace",
1130 "replace\-irreversibly",
1131 "isolate",
1132 "flush",
1133 "ignore\-dependencies"
1134 or
1135 "ignore\-requirements"\&.
1136 "OnFailureJobMode="
1137 defaults to
1138 "replace",
1139 "OnSuccessJobMode="
1140 defaults to
1141 "fail"\&. Specifies how the units listed in
1142 \fIOnSuccess=\fR/\fIOnFailure=\fR
1143 will be enqueued\&. See
1144 \fBsystemctl\fR(1)\*(Aqs
1145 \fB\-\-job\-mode=\fR
1146 option for details on the possible values\&. If this is set to
1147 "isolate", only a single unit may be listed in
1148 \fIOnSuccess=\fR/\fIOnFailure=\fR\&.
1149 .sp
1150 Added in version 209\&.
1151 .RE
1152 .PP
1153 \fIIgnoreOnIsolate=\fR
1154 .RS 4
1155 Takes a boolean argument\&. If
1156 \fBtrue\fR, this unit will not be stopped when isolating another unit\&. Defaults to
1157 \fBfalse\fR
1158 for service, target, socket, timer, and path units, and
1159 \fBtrue\fR
1160 for slice, scope, device, swap, mount, and automount units\&.
1161 .sp
1162 Added in version 201\&.
1163 .RE
1164 .PP
1165 \fIStopWhenUnneeded=\fR
1166 .RS 4
1167 Takes a boolean argument\&. If
1168 \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
1169 \fBfalse\fR\&.
1170 .sp
1171 Added in version 201\&.
1172 .RE
1173 .PP
1174 \fIRefuseManualStart=\fR, \fIRefuseManualStop=\fR
1175 .RS 4
1176 Takes a boolean argument\&. If
1177 \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
1178 \fBfalse\fR\&.
1179 .sp
1180 Added in version 201\&.
1181 .RE
1182 .PP
1183 \fIAllowIsolate=\fR
1184 .RS 4
1185 Takes a boolean argument\&. If
1186 \fBtrue\fR, this unit may be used with the
1187 \fBsystemctl isolate\fR
1188 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
1189 \fBfalse\fR\&.
1190 .sp
1191 Added in version 201\&.
1192 .RE
1193 .PP
1194 \fIDefaultDependencies=\fR
1195 .RS 4
1196 Takes a boolean argument\&. If
1197 \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
1198 \fBno\fR\&. It is highly recommended to leave this option enabled for the majority of common units\&. If set to
1199 \fBno\fR, this option does not disable all implicit dependencies, just non\-essential ones\&.
1200 .sp
1201 Added in version 201\&.
1202 .RE
1203 .PP
1204 \fISurviveFinalKillSignal=\fR
1205 .RS 4
1206 Takes a boolean argument\&. Defaults to
1207 \fBno\fR\&. If
1208 \fByes\fR, processes belonging to this unit will not be sent the final
1209 "SIGTERM"
1210 and
1211 "SIGKILL"
1212 signals during the final phase of the system shutdown process\&. This functionality replaces the older mechanism that allowed a program to set
1213 "argv[0][0] = \*(Aq@\*(Aq"
1214 as described at
1215 \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\&.
1216 .sp
1217 Added in version 255\&.
1218 .RE
1219 .PP
1220 \fICollectMode=\fR
1221 .RS 4
1222 Tweaks the "garbage collection" algorithm for this unit\&. Takes one of
1223 \fBinactive\fR
1224 or
1225 \fBinactive\-or\-failed\fR\&. If set to
1226 \fBinactive\fR
1227 the unit will be unloaded if it is in the
1228 \fBinactive\fR
1229 state and is not referenced by clients, jobs or other units \(em however it is not unloaded if it is in the
1230 \fBfailed\fR
1231 state\&. In
1232 \fBfailed\fR
1233 mode, failed units are not unloaded until the user invoked
1234 \fBsystemctl reset\-failed\fR
1235 on them to reset the
1236 \fBfailed\fR
1237 state, or an equivalent command\&. This behaviour is altered if this option is set to
1238 \fBinactive\-or\-failed\fR: in this case, the unit is unloaded even if the unit is in a
1239 \fBfailed\fR
1240 state, and thus an explicitly resetting of the
1241 \fBfailed\fR
1242 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
1243 \fBinactive\fR\&.
1244 .sp
1245 Added in version 236\&.
1246 .RE
1247 .PP
1248 \fIFailureAction=\fR, \fISuccessAction=\fR
1249 .RS 4
1250 Configure the action to take when the unit stops and enters a failed state or inactive state\&. Takes one of
1251 \fBnone\fR,
1252 \fBreboot\fR,
1253 \fBreboot\-force\fR,
1254 \fBreboot\-immediate\fR,
1255 \fBpoweroff\fR,
1256 \fBpoweroff\-force\fR,
1257 \fBpoweroff\-immediate\fR,
1258 \fBexit\fR,
1259 \fBexit\-force\fR,
1260 \fBsoft\-reboot\fR,
1261 \fBsoft\-reboot\-force\fR,
1262 \fBkexec\fR,
1263 \fBkexec\-force\fR,
1264 \fBhalt\fR,
1265 \fBhalt\-force\fR
1266 and
1267 \fBhalt\-immediate\fR\&. In system mode, all options are allowed\&. In user mode, only
1268 \fBnone\fR,
1269 \fBexit\fR, and
1270 \fBexit\-force\fR
1271 are allowed\&. Both options default to
1272 \fBnone\fR\&.
1273 .sp
1274 If
1275 \fBnone\fR
1276 is set, no action will be triggered\&.
1277 \fBreboot\fR
1278 causes a reboot following the normal shutdown procedure (i\&.e\&. equivalent to
1279 \fBsystemctl reboot\fR)\&.
1280 \fBreboot\-force\fR
1281 causes a forced reboot which will terminate all processes forcibly but should cause no dirty file systems on reboot (i\&.e\&. equivalent to
1282 \fBsystemctl reboot \-f\fR) and
1283 \fBreboot\-immediate\fR
1284 causes immediate execution of the
1285 \fBreboot\fR(2)
1286 system call, which might result in data loss (i\&.e\&. equivalent to
1287 \fBsystemctl reboot \-ff\fR)\&. Similarly,
1288 \fBpoweroff\fR,
1289 \fBpoweroff\-force\fR,
1290 \fBpoweroff\-immediate\fR,
1291 \fBkexec\fR,
1292 \fBkexec\-force\fR,
1293 \fBhalt\fR,
1294 \fBhalt\-force\fR
1295 and
1296 \fBhalt\-immediate\fR
1297 have the effect of powering down the system, executing kexec, and halting the system respectively with similar semantics\&.
1298 \fBexit\fR
1299 causes the manager to exit following the normal shutdown procedure, and
1300 \fBexit\-force\fR
1301 causes it terminate without shutting down services\&. When
1302 \fBexit\fR
1303 or
1304 \fBexit\-force\fR
1305 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
1306 \fIFailureActionExitStatus=\fR/\fISuccessActionExitStatus=\fR, see below\&.
1307 \fBsoft\-reboot\fR
1308 will trigger a userspace reboot operation\&.
1309 \fBsoft\-reboot\-force\fR
1310 does that too, but does not go through the shutdown transaction beforehand\&.
1311 .sp
1312 Added in version 236\&.
1313 .RE
1314 .PP
1315 \fIFailureActionExitStatus=\fR, \fISuccessActionExitStatus=\fR
1316 .RS 4
1317 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
1318 \fIFailureAction=\fR/\fISuccessAction=\fR
1319 are set to
1320 \fBexit\fR
1321 or
1322 \fBexit\-force\fR
1323 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\&.
1324 .sp
1325 Added in version 240\&.
1326 .RE
1327 .PP
1328 \fIJobTimeoutSec=\fR, \fIJobRunningTimeoutSec=\fR
1329 .RS 4
1330 \fIJobTimeoutSec=\fR
1331 specifies a timeout for the whole job that starts running when the job is queued\&.
1332 \fIJobRunningTimeoutSec=\fR
1333 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
1334 "failed"
1335 mode\&.
1336 .sp
1337 Both settings take a time span with the default unit of seconds, but other units may be specified, see
1338 \fBsystemd.time\fR(7)\&. The default is
1339 "infinity"
1340 (job timeouts disabled), except for device units where
1341 \fIJobRunningTimeoutSec=\fR
1342 defaults to
1343 \fIDefaultDeviceTimeoutSec=\fR\&.
1344 .sp
1345 Note: these timeouts are independent from any unit\-specific timeouts (for example, the timeout set with
1346 \fITimeoutStartSec=\fR
1347 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\&.
1348 .sp
1349 Added in version 201\&.
1350 .RE
1351 .PP
1352 \fIJobTimeoutAction=\fR, \fIJobTimeoutRebootArgument=\fR
1353 .RS 4
1354 \fIJobTimeoutAction=\fR
1355 optionally configures an additional action to take when the timeout is hit, see description of
1356 \fIJobTimeoutSec=\fR
1357 and
1358 \fIJobRunningTimeoutSec=\fR
1359 above\&. It takes the same values as
1360 \fIFailureAction=\fR/\fISuccessAction=\fR\&. Defaults to
1361 \fBnone\fR\&.
1362 .sp
1363 \fIJobTimeoutRebootArgument=\fR
1364 configures an optional reboot string to pass to the
1365 \fBreboot\fR(2)
1366 system call\&.
1367 .sp
1368 Added in version 240\&.
1369 .RE
1370 .PP
1371 \fIStartLimitIntervalSec=\fR\fI\fIinterval\fR\fR, \fIStartLimitBurst=\fR\fI\fIburst\fR\fR
1372 .RS 4
1373 Configure unit start rate limiting\&. Units which are started more than
1374 \fIburst\fR
1375 times within an
1376 \fIinterval\fR
1377 time span are not permitted to start any more\&. Use
1378 \fIStartLimitIntervalSec=\fR
1379 to configure the checking interval and
1380 \fIStartLimitBurst=\fR
1381 to configure how many starts per interval are allowed\&.
1382 .sp
1383 \fIinterval\fR
1384 is a time span with the default unit of seconds, but other units may be specified, see
1385 \fBsystemd.time\fR(7)\&. The special value
1386 "infinity"
1387 can be used to limit the total number of start attempts, even if they happen at large time intervals\&. Defaults to
1388 \fIDefaultStartLimitIntervalSec=\fR
1389 in manager configuration file, and may be set to 0 to disable any kind of rate limiting\&.
1390 \fIburst\fR
1391 is a number and defaults to
1392 \fIDefaultStartLimitBurst=\fR
1393 in manager configuration file\&.
1394 .sp
1395 These configuration options are particularly useful in conjunction with the service setting
1396 \fIRestart=\fR
1397 (see
1398 \fBsystemd.service\fR(5)); however, they apply to all kinds of starts (including manual), not just those triggered by the
1399 \fIRestart=\fR
1400 logic\&.
1401 .sp
1402 Note that units which are configured for
1403 \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
1404 \fIinterval\fR
1405 has passed\&. From that point on, the restart logic is activated again\&.
1406 \fBsystemctl reset\-failed\fR
1407 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\&.
1408 .sp
1409 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\&.
1410 .sp
1411 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\&.
1412 .sp
1413 Added in version 229\&.
1414 .RE
1415 .PP
1416 \fIStartLimitAction=\fR
1417 .RS 4
1418 Configure an additional action to take if the rate limit configured with
1419 \fIStartLimitIntervalSec=\fR
1420 and
1421 \fIStartLimitBurst=\fR
1422 is hit\&. Takes the same values as the
1423 \fIFailureAction=\fR/\fISuccessAction=\fR
1424 settings\&. If
1425 \fBnone\fR
1426 is set, hitting the rate limit will trigger no action except that the start will not be permitted\&. Defaults to
1427 \fBnone\fR\&.
1428 .sp
1429 Added in version 229\&.
1430 .RE
1431 .PP
1432 \fIRebootArgument=\fR
1433 .RS 4
1434 Configure the optional argument for the
1435 \fBreboot\fR(2)
1436 system call if
1437 \fIStartLimitAction=\fR
1438 or
1439 \fIFailureAction=\fR
1440 is a reboot action\&. This works just like the optional argument to
1441 \fBsystemctl reboot\fR
1442 command\&.
1443 .sp
1444 Added in version 229\&.
1445 .RE
1446 .PP
1447 \fISourcePath=\fR
1448 .RS 4
1449 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\&.
1450 .sp
1451 Added in version 201\&.
1452 .RE
1453 .SS "Conditions and Asserts"
1454 .PP
1455 Unit files may also include a number of
1456 \fICondition\&...=\fR
1457 and
1458 \fIAssert\&...=\fR
1459 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
1460 "failed"
1461 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\&.
1462 .PP
1463 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
1464 \fItriggering\fR
1465 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\&.
1466 .PP
1467 The
1468 \fIAssertArchitecture=\fR,
1469 \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\&.
1470 .PP
1471 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\&.
1472 .PP
1473 The
1474 \fBcondition\fR
1475 verb of
1476 \fBsystemd-analyze\fR(1)
1477 can be used to test condition and assert expressions\&.
1478 .PP
1479 Except for
1480 \fIConditionPathIsSymbolicLink=\fR, all path checks follow symlinks\&.
1481 .PP
1482 \fIConditionArchitecture=\fR
1483 .RS 4
1484 Check whether the system is running on a specific architecture\&. Takes one of
1485 "x86",
1486 "x86\-64",
1487 "ppc",
1488 "ppc\-le",
1489 "ppc64",
1490 "ppc64\-le",
1491 "ia64",
1492 "parisc",
1493 "parisc64",
1494 "s390",
1495 "s390x",
1496 "sparc",
1497 "sparc64",
1498 "mips",
1499 "mips\-le",
1500 "mips64",
1501 "mips64\-le",
1502 "alpha",
1503 "arm",
1504 "arm\-be",
1505 "arm64",
1506 "arm64\-be",
1507 "sh",
1508 "sh64",
1509 "m68k",
1510 "tilegx",
1511 "cris",
1512 "arc",
1513 "arc\-be", or
1514 "native"\&.
1515 .sp
1516 Use
1517 \fBsystemd-analyze\fR(1)
1518 for the complete list of known architectures\&.
1519 .sp
1520 The architecture is determined from the information returned by
1521 \fBuname\fR(2)
1522 and is thus subject to
1523 \fBpersonality\fR(2)\&. Note that a
1524 \fIPersonality=\fR
1525 setting in the same unit file has no effect on this condition\&. A special architecture name
1526 "native"
1527 is mapped to the architecture the system manager itself is compiled for\&. The test may be negated by prepending an exclamation mark\&.
1528 .sp
1529 Added in version 201\&.
1530 .RE
1531 .PP
1532 \fIConditionFirmware=\fR
1533 .RS 4
1534 Check whether the system\*(Aqs firmware is of a certain type\&. The following values are possible:
1535 .sp
1536 .RS 4
1537 .ie n \{\
1538 \h'-04'\(bu\h'+03'\c
1539 .\}
1540 .el \{\
1541 .sp -1
1542 .IP \(bu 2.3
1543 .\}
1544 "uefi"
1545 matches systems with EFI\&.
1546 .RE
1547 .sp
1548 .RS 4
1549 .ie n \{\
1550 \h'-04'\(bu\h'+03'\c
1551 .\}
1552 .el \{\
1553 .sp -1
1554 .IP \(bu 2.3
1555 .\}
1556 "device\-tree"
1557 matches systems with a device tree\&.
1558 .RE
1559 .sp
1560 .RS 4
1561 .ie n \{\
1562 \h'-04'\(bu\h'+03'\c
1563 .\}
1564 .el \{\
1565 .sp -1
1566 .IP \(bu 2.3
1567 .\}
1568 "device\-tree\-compatible(\fIvalue\fR)"
1569 matches systems with a device tree that are compatible with
1570 "value"\&.
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 "smbios\-field(\fIfield\fR \fIoperator\fR \fIvalue\fR)"
1582 matches systems with a SMBIOS field containing a certain value\&.
1583 \fIfield\fR
1584 is the name of the SMBIOS field exposed as
1585 "sysfs"
1586 attribute file below
1587 /sys/class/dmi/id/\&.
1588 \fIoperator\fR
1589 is one of
1590 "<",
1591 "<=",
1592 ">=",
1593 ">",
1594 "==",
1595 "<>"
1596 for version comparisons,
1597 "="
1598 and
1599 "!="
1600 for literal string comparisons, or
1601 "$=",
1602 "!$="
1603 for shell\-style glob comparisons\&.
1604 \fIvalue\fR
1605 is the expected value of the SMBIOS field value (possibly containing shell style globs in case
1606 "$="/"!$="
1607 is used)\&.
1608 .RE
1609 .sp
1610 Added in version 249\&.
1611 .RE
1612 .PP
1613 \fIConditionVirtualization=\fR
1614 .RS 4
1615 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
1616 "vm"
1617 and
1618 "container"
1619 to test against a generic type of virtualization solution, or one of
1620 "qemu",
1621 "kvm",
1622 "amazon",
1623 "zvm",
1624 "vmware",
1625 "microsoft",
1626 "oracle",
1627 "powervm",
1628 "xen",
1629 "bochs",
1630 "uml",
1631 "bhyve",
1632 "qnx",
1633 "apple",
1634 "sre",
1635 "openvz",
1636 "lxc",
1637 "lxc\-libvirt",
1638 "systemd\-nspawn",
1639 "docker",
1640 "podman",
1641 "rkt",
1642 "wsl",
1643 "proot",
1644 "pouch",
1645 "acrn"
1646 to test against a specific implementation, or
1647 "private\-users"
1648 to check whether we are running in a user namespace\&. See
1649 \fBsystemd-detect-virt\fR(1)
1650 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\&.
1651 .sp
1652 Added in version 244\&.
1653 .RE
1654 .PP
1655 \fIConditionHost=\fR
1656 .RS 4
1657 \fIConditionHost=\fR
1658 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
1659 \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
1660 \fBmachine-id\fR(5)
1661 for details about the machine ID\&. The test may be negated by prepending an exclamation mark\&.
1662 .sp
1663 Added in version 244\&.
1664 .RE
1665 .PP
1666 \fIConditionKernelCommandLine=\fR
1667 .RS 4
1668 \fIConditionKernelCommandLine=\fR
1669 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
1670 "=")\&. 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
1671 /proc/cmdline, except when the service manager is invoked as payload of a container manager, in which case the command line of
1672 PID 1
1673 is used instead (i\&.e\&.
1674 /proc/1/cmdline)\&.
1675 .sp
1676 Added in version 244\&.
1677 .RE
1678 .PP
1679 \fIConditionKernelVersion=\fR
1680 .RS 4
1681 \fIConditionKernelVersion=\fR
1682 may be used to check whether the kernel version (as reported by
1683 \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
1684 "="
1685 or
1686 "!="
1687 for string comparisons,
1688 "<",
1689 "<=",
1690 "==",
1691 "<>",
1692 ">=",
1693 ">"
1694 for version comparisons, or
1695 "$=",
1696 "!$="
1697 for a shell\-style glob match\&. If no operator is specified,
1698 "$="
1699 is implied\&.
1700 .sp
1701 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\&.
1702 .sp
1703 Added in version 244\&.
1704 .RE
1705 .PP
1706 \fIConditionVersion=\fR
1707 .RS 4
1708 \fIConditionVersion=\fR
1709 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
1710 "kernel",
1711 "systemd"
1712 and
1713 "glibc"
1714 are supported\&. If this argument is omitted,
1715 "kernel"
1716 is implied\&. The second argument must be a list of (potentially quoted) expressions\&. Each expression starts with one of
1717 "="
1718 or
1719 "!="
1720 for string comparisons,
1721 "<",
1722 "<=",
1723 "==",
1724 "<>",
1725 ">=",
1726 ">"
1727 for version comparisons, or
1728 "$=",
1729 "!$="
1730 for a shell\-style glob match\&. If no operator is specified,
1731 "$="
1732 is implied\&.
1733 .sp
1734 Added in version 258\&.
1735 .RE
1736 .PP
1737 \fIConditionCredential=\fR
1738 .RS 4
1739 \fIConditionCredential=\fR
1740 may be used to check whether a credential by the specified name was passed into the service manager\&. See
1741 \m[blue]\fBSystem and Service Credentials\fR\m[]\&\s-2\u[4]\d\s+2
1742 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
1743 unit@\&.service
1744 service instance belonging to the user\&. The argument must be a valid credential name\&.
1745 .sp
1746 Added in version 252\&.
1747 .RE
1748 .PP
1749 \fIConditionEnvironment=\fR
1750 .RS 4
1751 \fIConditionEnvironment=\fR
1752 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
1753 \fIEnvironment=\fR
1754 or
1755 \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\&.
1756 .sp
1757 Added in version 246\&.
1758 .RE
1759 .PP
1760 \fIConditionSecurity=\fR
1761 .RS 4
1762 \fIConditionSecurity=\fR
1763 may be used to check whether the given security technology is enabled on the system\&. Currently, the following values are recognized:
1764 .sp
1765 .it 1 an-trap
1766 .nr an-no-space-flag 1
1767 .nr an-break-flag 1
1768 .br
1769 .B Table\ \&3.\ \&Recognized security technologies
1770 .TS
1771 allbox tab(:);
1772 lB lB.
1773 T{
1774 Value
1775 T}:T{
1776 Description
1777 T}
1778 .T&
1779 l l
1780 l l
1781 l l
1782 l l
1783 l l
1784 l l
1785 l l
1786 l l
1787 l l
1788 l l.
1789 T{
1790 selinux
1791 T}:T{
1792 SELinux MAC
1793 T}
1794 T{
1795 apparmor
1796 T}:T{
1797 AppArmor MAC
1798 T}
1799 T{
1800 tomoyo
1801 T}:T{
1802 Tomoyo MAC
1803 T}
1804 T{
1805 smack
1806 T}:T{
1807 SMACK MAC
1808 T}
1809 T{
1810 ima
1811 T}:T{
1812 Integrity Measurement Architecture (IMA)
1813 T}
1814 T{
1815 audit
1816 T}:T{
1817 Linux Audit Framework
1818 T}
1819 T{
1820 uefi\-secureboot
1821 T}:T{
1822 UEFI SecureBoot
1823 T}
1824 T{
1825 tpm2
1826 T}:T{
1827 Trusted Platform Module 2\&.0 (TPM2) (with full UEFI support, including the TCG PC Client
1828 Platform Firmware Profile)
1829 T}
1830 T{
1831 cvm
1832 T}:T{
1833 Confidential virtual machine (SEV/TDX)
1834 T}
1835 T{
1836 measured\-uki
1837 T}:T{
1838 Unified Kernel Image with PCR 11 Measurements, as per \fBsystemd-stub\fR(7)\&. Added in version 255\&.
1839 T}
1840 .TE
1841 .sp 1
1842 The test may be negated by prepending an exclamation mark\&.
1843 .sp
1844 Added in version 244\&.
1845 .RE
1846 .PP
1847 \fIConditionCapability=\fR
1848 .RS 4
1849 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
1850 \fBcapabilities\fR(7)
1851 for details)\&. Pass a capability name such as
1852 "CAP_MKNOD", possibly prefixed with an exclamation mark to negate the check\&.
1853 .sp
1854 Added in version 244\&.
1855 .RE
1856 .PP
1857 \fIConditionACPower=\fR
1858 .RS 4
1859 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
1860 "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
1861 "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\&.
1862 .sp
1863 Added in version 244\&.
1864 .RE
1865 .PP
1866 \fIConditionNeedsUpdate=\fR
1867 .RS 4
1868 Takes one of
1869 /var/
1870 or
1871 /etc/
1872 as argument, possibly prefixed with a
1873 "!"
1874 (to invert the condition)\&. This condition may be used to conditionalize units on whether the specified directory requires an update because
1875 /usr/\*(Aqs modification time is newer than the stamp file
1876 \&.updated
1877 in the specified directory\&. This is useful to implement offline updates of the vendor operating system resources in
1878 /usr/
1879 that require updating of
1880 /etc/
1881 or
1882 /var/
1883 on the next following boot\&. Units making use of this condition should order themselves before
1884 \fBsystemd-update-done.service\fR(8), to make sure they run before the stamp file\*(Aqs modification time gets reset indicating a completed update\&.
1885 .sp
1886 If the
1887 \fIsystemd\&.condition_needs_update=\fR
1888 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,
1889 systemd\-update\-done\&.service
1890 will not have immediate effect on any following
1891 \fIConditionNeedsUpdate=\fR
1892 checks, until the system is rebooted where the kernel command line option is not specified anymore\&.
1893 .sp
1894 Note that to make this scheme effective, the timestamp of
1895 /usr/
1896 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
1897 /usr/
1898 being updated\&.
1899 .sp
1900 Also note that if the update method includes a call to execute appropriate post\-update steps itself, it should not touch the timestamp of
1901 /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\&.
1902 \fIConditionNeedsUpdate=\fR
1903 should be used with other update mechanisms where such an immediate update does not happen\&.
1904 .sp
1905 Added in version 244\&.
1906 .RE
1907 .PP
1908 \fIConditionFirstBoot=\fR
1909 .RS 4
1910 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
1911 /etc/
1912 was unpopulated when the system started booting (for details, see "First Boot Semantics" in
1913 \fBmachine-id\fR(5))\&. First Boot is considered finished (this condition will evaluate as false) after the manager has finished the startup phase\&.
1914 .sp
1915 This condition may be used to populate
1916 /etc/
1917 on the first boot after factory reset, or when a new system instance boots up for the first time\&.
1918 .sp
1919 Note that the service manager itself will perform setup steps during First Boot: it will initialize
1920 \fBmachine-id\fR(5)
1921 and preset all units, enabling or disabling them according to the
1922 \fBsystemd.preset\fR(5)
1923 settings\&. Additional setup may be performed via units with
1924 \fIConditionFirstBoot=yes\fR\&.
1925 .sp
1926 For robustness, units with
1927 \fIConditionFirstBoot=yes\fR
1928 should order themselves before
1929 first\-boot\-complete\&.target
1930 and pull in this passive target with
1931 \fIWants=\fR\&. This ensures that in a case of an aborted first boot, these units will be re\-run during the next system startup\&.
1932 .sp
1933 If the
1934 \fIsystemd\&.condition_first_boot=\fR
1935 option is specified on the kernel command line (taking a boolean), it will override the result of this condition check, taking precedence over
1936 /etc/machine\-id
1937 existence checks\&.
1938 .sp
1939 Added in version 244\&.
1940 .RE
1941 .PP
1942 \fIConditionPathExists=\fR
1943 .RS 4
1944 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
1945 \fIConditionPathExists=\fR
1946 is prefixed with an exclamation mark ("!"), the test is negated, and the unit is only started if the path does not exist\&.
1947 .sp
1948 Added in version 244\&.
1949 .RE
1950 .PP
1951 \fIConditionPathExistsGlob=\fR
1952 .RS 4
1953 \fIConditionPathExistsGlob=\fR
1954 is similar to
1955 \fIConditionPathExists=\fR, but checks for the existence of at least one file or directory matching the specified globbing pattern\&.
1956 .sp
1957 Added in version 244\&.
1958 .RE
1959 .PP
1960 \fIConditionPathIsDirectory=\fR
1961 .RS 4
1962 \fIConditionPathIsDirectory=\fR
1963 is similar to
1964 \fIConditionPathExists=\fR
1965 but verifies that a certain path exists and is a directory\&.
1966 .sp
1967 Added in version 244\&.
1968 .RE
1969 .PP
1970 \fIConditionPathIsSymbolicLink=\fR
1971 .RS 4
1972 \fIConditionPathIsSymbolicLink=\fR
1973 is similar to
1974 \fIConditionPathExists=\fR
1975 but verifies that a certain path exists and is a symbolic link\&.
1976 .sp
1977 Added in version 244\&.
1978 .RE
1979 .PP
1980 \fIConditionPathIsMountPoint=\fR
1981 .RS 4
1982 \fIConditionPathIsMountPoint=\fR
1983 is similar to
1984 \fIConditionPathExists=\fR
1985 but verifies that a certain path exists and is a mount point\&.
1986 .sp
1987 Added in version 244\&.
1988 .RE
1989 .PP
1990 \fIConditionPathIsReadWrite=\fR
1991 .RS 4
1992 \fIConditionPathIsReadWrite=\fR
1993 is similar to
1994 \fIConditionPathExists=\fR
1995 but verifies that the underlying file system is readable and writable (i\&.e\&. not mounted read\-only)\&.
1996 .sp
1997 Added in version 244\&.
1998 .RE
1999 .PP
2000 \fIConditionPathIsEncrypted=\fR
2001 .RS 4
2002 \fIConditionPathIsEncrypted=\fR
2003 is similar to
2004 \fIConditionPathExists=\fR
2005 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\&.
2006 .sp
2007 Added in version 246\&.
2008 .RE
2009 .PP
2010 \fIConditionPathIsSocket=\fR
2011 .RS 4
2012 \fIConditionPathIsSocket=\fR
2013 is similar to
2014 \fIConditionPathExists=\fR
2015 but verifies that a certain path exists and is a socket\&.
2016 .sp
2017 Added in version 260\&.
2018 .RE
2019 .PP
2020 \fIConditionDirectoryNotEmpty=\fR
2021 .RS 4
2022 \fIConditionDirectoryNotEmpty=\fR
2023 is similar to
2024 \fIConditionPathExists=\fR
2025 but verifies that a certain path exists and is a non\-empty directory\&.
2026 .sp
2027 Added in version 244\&.
2028 .RE
2029 .PP
2030 \fIConditionFileNotEmpty=\fR
2031 .RS 4
2032 \fIConditionFileNotEmpty=\fR
2033 is similar to
2034 \fIConditionPathExists=\fR
2035 but verifies that a certain path exists and refers to a regular file with a non\-zero size\&.
2036 .sp
2037 Added in version 244\&.
2038 .RE
2039 .PP
2040 \fIConditionFileIsExecutable=\fR
2041 .RS 4
2042 \fIConditionFileIsExecutable=\fR
2043 is similar to
2044 \fIConditionPathExists=\fR
2045 but verifies that a certain path exists, is a regular file, and marked executable\&.
2046 .sp
2047 Added in version 244\&.
2048 .RE
2049 .PP
2050 \fIConditionUser=\fR
2051 .RS 4
2052 \fIConditionUser=\fR
2053 takes a numeric
2054 "UID", a UNIX user name, or the special value
2055 "@system"\&. This condition may be used to check whether the service manager is running as the given user\&. The special value
2056 "@system"
2057 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\&.
2058 .sp
2059 Added in version 244\&.
2060 .RE
2061 .PP
2062 \fIConditionGroup=\fR
2063 .RS 4
2064 \fIConditionGroup=\fR
2065 is similar to
2066 \fIConditionUser=\fR
2067 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
2068 "@system"\&.
2069 .sp
2070 Added in version 244\&.
2071 .RE
2072 .PP
2073 \fIConditionControlGroupController=\fR
2074 .RS 4
2075 Check whether given cgroup controllers (e\&.g\&.
2076 "cpu") are available for use on the system or whether the legacy v1 cgroup or the modern v2 cgroup hierarchy is used\&.
2077 .sp
2078 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
2079 "cpu",
2080 "io",
2081 "memory", and
2082 "pids"\&. Even if available in the kernel, a particular controller may not be available if it was disabled on the kernel command line with
2083 \fIcgroup_disable=controller\fR\&.
2084 .sp
2085 Alternatively, two special strings
2086 "v1"
2087 and
2088 "v2"
2089 may be specified (without any controller names)\&.
2090 "v2"
2091 will pass if the unified v2 cgroup hierarchy is used, and
2092 "v1"
2093 will pass if the legacy v1 hierarchy or the hybrid hierarchy are used\&. Note that legacy or hybrid hierarchies have been deprecated\&. See
2094 \fBsystemd\fR(1)
2095 for more information\&.
2096 .sp
2097 Added in version 244\&.
2098 .RE
2099 .PP
2100 \fIConditionMemory=\fR
2101 .RS 4
2102 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
2103 "<",
2104 "<=",
2105 "="
2106 (or
2107 "=="),
2108 "!="
2109 (or
2110 "<>"),
2111 ">=",
2112 ">"\&. 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\&.
2113 .sp
2114 Added in version 244\&.
2115 .RE
2116 .PP
2117 \fIConditionCPUs=\fR
2118 .RS 4
2119 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
2120 "<",
2121 "<=",
2122 "="
2123 (or
2124 "=="),
2125 "!="
2126 (or
2127 "<>"),
2128 ">=",
2129 ">"\&. 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\&.
2130 .sp
2131 Added in version 244\&.
2132 .RE
2133 .PP
2134 \fIConditionCPUFeature=\fR
2135 .RS 4
2136 Verify that a given CPU feature is available via the
2137 "CPUID"
2138 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
2139 "1",
2140 "7",
2141 "0x80000001", and
2142 "0x80000007"\&. Valid values are:
2143 "fpu",
2144 "vme",
2145 "de",
2146 "pse",
2147 "tsc",
2148 "msr",
2149 "pae",
2150 "mce",
2151 "cx8",
2152 "apic",
2153 "sep",
2154 "mtrr",
2155 "pge",
2156 "mca",
2157 "cmov",
2158 "pat",
2159 "pse36",
2160 "clflush",
2161 "mmx",
2162 "fxsr",
2163 "sse",
2164 "sse2",
2165 "ht",
2166 "pni",
2167 "pclmul",
2168 "monitor",
2169 "ssse3",
2170 "fma3",
2171 "cx16",
2172 "sse4_1",
2173 "sse4_2",
2174 "movbe",
2175 "popcnt",
2176 "aes",
2177 "xsave",
2178 "osxsave",
2179 "avx",
2180 "f16c",
2181 "rdrand",
2182 "bmi1",
2183 "avx2",
2184 "bmi2",
2185 "rdseed",
2186 "adx",
2187 "sha_ni",
2188 "syscall",
2189 "rdtscp",
2190 "lm",
2191 "lahf_lm",
2192 "abm",
2193 "constant_tsc"\&.
2194 .sp
2195 Added in version 248\&.
2196 .RE
2197 .PP
2198 \fIConditionOSRelease=\fR
2199 .RS 4
2200 Verify that a specific
2201 "key=value"
2202 pair is set in the host\*(Aqs
2203 \fBos-release\fR(5)\&.
2204 .sp
2205 Other than exact string matching (with
2206 "="
2207 and
2208 "!="), relative comparisons are supported for versioned parameters (e\&.g\&.
2209 "VERSION_ID"; with
2210 "<",
2211 "<=",
2212 "==",
2213 "<>",
2214 ">=",
2215 ">"), and shell\-style wildcard comparisons ("*",
2216 "?",
2217 "[]") are supported with the
2218 "$="
2219 (match) and
2220 "!$="
2221 (non\-match)\&.
2222 .sp
2223 If the given key is not found in the file, the match is done against an empty value\&.
2224 .sp
2225 Added in version 249\&.
2226 .RE
2227 .PP
2228 \fIConditionMemoryPressure=\fR, \fIConditionCPUPressure=\fR, \fIConditionIOPressure=\fR
2229 .RS 4
2230 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
2231 "%", 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
2232 "/"
2233 as a separator, for example:
2234 "10%/1min"\&. The supported timespans match what the kernel provides, and are limited to
2235 "10sec",
2236 "1min"
2237 and
2238 "5min"\&. The
2239 "full"
2240 PSI will be checked first, and if not found
2241 "some"
2242 will be checked\&. For more details, see the documentation on
2243 \m[blue]\fBPSI (Pressure Stall Information)\fR\m[]\&\s-2\u[5]\d\s+2\&.
2244 .sp
2245 Optionally, the threshold value can be prefixed with the slice unit under which the pressure will be checked, followed by a
2246 ":"\&. If the slice unit is not specified, the overall system pressure will be measured, instead of a particular cgroup\*(Aqs\&.
2247 .sp
2248 Added in version 250\&.
2249 .RE
2250 .PP
2251 \fIConditionKernelModuleLoaded=\fR
2252 .RS 4
2253 Test whether the specified kernel module has been loaded and is already fully initialized\&.
2254 .sp
2255 Added in version 258\&.
2256 .RE
2257 .PP
2258 \fIAssertArchitecture=\fR, \fIAssertVirtualization=\fR, \fIAssertHost=\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, \fIAssertMemoryPressure=\fR, \fIAssertCPUPressure=\fR, \fIAssertIOPressure=\fR, \fIAssertKernelModuleLoaded=\fR
2259 .RS 4
2260 Similar to the
2261 \fIConditionArchitecture=\fR,
2262 \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
2263 "failed"
2264 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\&.
2265 .sp
2266 Added in version 218\&.
2267 .RE
2268 .SH "MAPPING OF UNIT PROPERTIES TO THEIR INVERSES"
2269 .PP
2270 Unit settings that create a relationship with a second unit usually show up in properties of both units, for example in
2271 \fBsystemctl show\fR
2272 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\&.
2273 .sp
2274 .it 1 an-trap
2275 .nr an-no-space-flag 1
2276 .nr an-break-flag 1
2277 .br
2278 .B Table\ \&4.\ \& "Forward" and "reverse" unit properties
2279 .TS
2280 allbox tab(:);
2281 lB lB lB s.
2282 T{
2283 "Forward" property
2284 T}:T{
2285 "Reverse" property
2286 T}:T{
2287 Where used
2288 T}
2289 .T&
2290 l l l s
2291 l l ^ ^
2292 l l l l
2293 l l l l
2294 l l l l
2295 l l l l
2296 l l l l
2297 l l l l
2298 l l l l
2299 l l l s
2300 l l l s
2301 l l ^ ^
2302 l l l s
2303 l l ^ ^
2304 l l l l.
2305 T{
2306 \fIBefore=\fR
2307 T}:T{
2308 \fIAfter=\fR
2309 T}:T{
2310 [Unit] section
2311 T}
2312 T{
2313 \fIAfter=\fR
2314 T}:T{
2315 \fIBefore=\fR
2316 T}::
2317 T{
2318 \fIRequires=\fR
2319 T}:T{
2320 \fIRequiredBy=\fR
2321 T}:T{
2322 [Unit] section
2323 T}:T{
2324 [Install] section
2325 T}
2326 T{
2327 \fIWants=\fR
2328 T}:T{
2329 \fIWantedBy=\fR
2330 T}:T{
2331 [Unit] section
2332 T}:T{
2333 [Install] section
2334 T}
2335 T{
2336 \fIUpholds=\fR
2337 T}:T{
2338 \fIUpheldBy=\fR
2339 T}:T{
2340 [Unit] section
2341 T}:T{
2342 [Install] section
2343 T}
2344 T{
2345 \fIPartOf=\fR
2346 T}:T{
2347 \fIConsistsOf=\fR
2348 T}:T{
2349 [Unit] section
2350 T}:T{
2351 an automatic property
2352 T}
2353 T{
2354 \fIBindsTo=\fR
2355 T}:T{
2356 \fIBoundBy=\fR
2357 T}:T{
2358 [Unit] section
2359 T}:T{
2360 an automatic property
2361 T}
2362 T{
2363 \fIRequisite=\fR
2364 T}:T{
2365 \fIRequisiteOf=\fR
2366 T}:T{
2367 [Unit] section
2368 T}:T{
2369 an automatic property
2370 T}
2371 T{
2372 \fIConflicts=\fR
2373 T}:T{
2374 \fIConflictedBy=\fR
2375 T}:T{
2376 [Unit] section
2377 T}:T{
2378 an automatic property
2379 T}
2380 T{
2381 \fITriggers=\fR
2382 T}:T{
2383 \fITriggeredBy=\fR
2384 T}:T{
2385 Automatic properties, see notes below
2386 T}
2387 T{
2388 \fIPropagatesReloadTo=\fR
2389 T}:T{
2390 \fIReloadPropagatedFrom=\fR
2391 T}:T{
2392 [Unit] section
2393 T}
2394 T{
2395 \fIReloadPropagatedFrom=\fR
2396 T}:T{
2397 \fIPropagatesReloadTo=\fR
2398 T}::
2399 T{
2400 \fIPropagatesStopTo=\fR
2401 T}:T{
2402 \fIStopPropagatedFrom=\fR
2403 T}:T{
2404 [Unit] section
2405 T}
2406 T{
2407 \fIStopPropagatedFrom=\fR
2408 T}:T{
2409 \fIPropagatesStopTo=\fR
2410 T}::
2411 T{
2412 \fIFollowing=\fR
2413 T}:T{
2414 n/a
2415 T}:T{
2416 An automatic property
2417 T}:T{
2418 \ \&
2419 T}
2420 .TE
2421 .sp 1
2422 .PP
2423 Note:
2424 \fIWantedBy=\fR,
2425 \fIRequiredBy=\fR, and
2426 \fIUpheldBy=\fR
2427 are used in the [Install] section to create symlinks in
2428 \&.wants/,
2429 \&.requires/, and
2430 \&.upholds/
2431 directories\&. They cannot be used directly as a unit configuration setting\&.
2432 .PP
2433 Note:
2434 \fIConsistsOf=\fR,
2435 \fIBoundBy=\fR,
2436 \fIRequisiteOf=\fR,
2437 \fIConflictedBy=\fR
2438 are created implicitly along with their reverses and cannot be specified directly\&.
2439 .PP
2440 Note:
2441 \fITriggers=\fR
2442 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
2443 \fISockets=\fR,
2444 \fIService=\fR, and
2445 \fIUnit=\fR
2446 settings\&. See
2447 \fBsystemd.service\fR(5),
2448 \fBsystemd.socket\fR(5),
2449 \fBsystemd.path\fR(5), and
2450 \fBsystemd.automount\fR(5)
2451 for details\&.
2452 \fITriggeredBy=\fR
2453 is created implicitly on the triggered unit\&.
2454 .PP
2455 Note:
2456 \fIFollowing=\fR
2457 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\&.
2458 .SH "[INSTALL] SECTION OPTIONS"
2459 .PP
2460 Unit files may include an [Install] section, which carries installation information for the unit\&. This section is not interpreted by
2461 \fBsystemd\fR(1)
2462 during runtime; it is used by the
2463 \fBenable\fR
2464 and
2465 \fBdisable\fR
2466 commands of the
2467 \fBsystemctl\fR(1)
2468 tool during installation of a unit\&.
2469 .PP
2470 \fIAlias=\fR
2471 .RS 4
2472 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,
2473 \fBsystemctl enable\fR
2474 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\&.
2475 .sp
2476 Added in version 201\&.
2477 .RE
2478 .PP
2479 \fIWantedBy=\fR, \fIRequiredBy=\fR, \fIUpheldBy=\fR
2480 .RS 4
2481 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
2482 \&.wants/,
2483 \&.requires/, or
2484 \&.upholds/
2485 directory of each of the listed units when this unit is installed by
2486 \fBsystemctl enable\fR\&. This has the effect of a dependency of type
2487 \fIWants=\fR,
2488 \fIRequires=\fR, or
2489 \fIUpholds=\fR
2490 being added from the listed unit to the current unit\&. See the description of the mentioned dependency types in the [Unit] section for details\&.
2491 .sp
2492 In case of template units listing non template units, the listing unit must have
2493 \fIDefaultInstance=\fR
2494 set, or
2495 \fBsystemctl enable\fR
2496 must be called with an instance name\&. The instance (default or specified) will be added to the
2497 \&.wants/,
2498 \&.requires/, or
2499 \&.upholds/
2500 list of the listed unit\&. For example,
2501 \fBWantedBy=getty\&.target\fR
2502 in a service
2503 getty@\&.service
2504 will result in
2505 \fBsystemctl enable getty@tty2\&.service\fR
2506 creating a
2507 getty\&.target\&.wants/getty@tty2\&.service
2508 link to
2509 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,
2510 \fBWantedBy=container@\&.target\fR
2511 in a service
2512 monitor@\&.service
2513 will result in
2514 \fBsystemctl enable monitor@\&.service\fR
2515 creating a
2516 container@\&.target\&.wants/monitor@\&.service
2517 link to
2518 monitor@\&.service, which applies to all instances of
2519 container@\&.target\&.
2520 .sp
2521 Added in version 201\&.
2522 .RE
2523 .PP
2524 \fIAlso=\fR
2525 .RS 4
2526 Additional units to install/deinstall when this unit is installed/deinstalled\&. If the user requests installation/deinstallation of a unit with this option configured,
2527 \fBsystemctl enable\fR
2528 and
2529 \fBsystemctl disable\fR
2530 will automatically install/uninstall units listed in this option as well\&.
2531 .sp
2532 This option may be used more than once, or a space\-separated list of unit names may be given\&.
2533 .sp
2534 Added in version 201\&.
2535 .RE
2536 .PP
2537 \fIDefaultInstance=\fR
2538 .RS 4
2539 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\&.
2540 .sp
2541 Added in version 215\&.
2542 .RE
2543 .PP
2544 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\&.
2545 .SH "SPECIFIERS"
2546 .PP
2547 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:
2548 .sp
2549 .it 1 an-trap
2550 .nr an-no-space-flag 1
2551 .nr an-break-flag 1
2552 .br
2553 .B Table\ \&5.\ \&Specifiers available in unit files
2554 .TS
2555 allbox tab(:);
2556 lB lB lB.
2557 T{
2558 Specifier
2559 T}:T{
2560 Meaning
2561 T}:T{
2562 Details
2563 T}
2564 .T&
2565 l l l
2566 l l l
2567 l l l
2568 l l l
2569 l l l
2570 l l l
2571 l l l
2572 l l l
2573 l l l
2574 l l l
2575 l l l
2576 l l l
2577 l l l
2578 l l l
2579 l l l
2580 l l l
2581 l l l
2582 l l l
2583 l l l
2584 l l l
2585 l l l
2586 l l l
2587 l l l
2588 l l l
2589 l l l
2590 l l l
2591 l l l
2592 l l l
2593 l l l
2594 l l l
2595 l l l
2596 l l l
2597 l l l
2598 l l l
2599 l l l
2600 l l l
2601 l l l
2602 l l l
2603 l l l
2604 l l l.
2605 T{
2606 "%a"
2607 T}:T{
2608 Architecture
2609 T}:T{
2610 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\&.
2611 T}
2612 T{
2613 "%A"
2614 T}:T{
2615 Operating system image version
2616 T}:T{
2617 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\&.
2618 T}
2619 T{
2620 "%b"
2621 T}:T{
2622 Boot ID
2623 T}:T{
2624 The boot ID of the running system, formatted as string\&. See \fBrandom\fR(4) for more information\&.
2625 T}
2626 T{
2627 "%B"
2628 T}:T{
2629 Operating system build ID
2630 T}:T{
2631 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\&.
2632 T}
2633 T{
2634 "%C"
2635 T}:T{
2636 Cache directory root
2637 T}:T{
2638 This is either /var/cache (for the system manager) or the path "$XDG_CACHE_HOME" resolves to (for user managers)\&.
2639 T}
2640 T{
2641 "%d"
2642 T}:T{
2643 Credentials directory
2644 T}:T{
2645 This is the value of the "$CREDENTIALS_DIRECTORY" environment variable if available\&. See section "Credentials" in \fBsystemd.exec\fR(5) for more information\&.
2646 T}
2647 T{
2648 "%D"
2649 T}:T{
2650 Shared data directory
2651 T}:T{
2652 This is either /usr/share/ (for the system manager) or the path "$XDG_DATA_HOME" resolves to (for user managers)\&.
2653 T}
2654 T{
2655 "%E"
2656 T}:T{
2657 Configuration directory root
2658 T}:T{
2659 This is either /etc/ (for the system manager) or the path "$XDG_CONFIG_HOME" resolves to (for user managers)\&.
2660 T}
2661 T{
2662 "%f"
2663 T}:T{
2664 Unescaped filename
2665 T}:T{
2666 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\&.
2667 T}
2668 T{
2669 "%g"
2670 T}:T{
2671 User group
2672 T}:T{
2673 This is the name of the group running the service manager instance\&. In case of the system manager this resolves to "root"\&.
2674 T}
2675 T{
2676 "%G"
2677 T}:T{
2678 User GID
2679 T}:T{
2680 This is the numeric GID of the user running the service manager instance\&. In case of the system manager this resolves to "0"\&.
2681 T}
2682 T{
2683 "%h"
2684 T}:T{
2685 User home directory
2686 T}:T{
2687 This is the home directory of the \fIuser running the service manager instance\fR\&. In case of the system manager this resolves to "/root"\&.
2688
2689 Note that this setting is \fInot\fR influenced by the \fIUser=\fR setting configurable in the [Service] section of the service unit\&.
2690 T}
2691 T{
2692 "%H"
2693 T}:T{
2694 Host name
2695 T}:T{
2696 The hostname of the running system at the point in time the unit configuration is loaded\&.
2697 T}
2698 T{
2699 "%i"
2700 T}:T{
2701 Instance name
2702 T}:T{
2703 For instantiated units this is the string between the first "@" character and the type suffix\&. Empty for non\-instantiated units\&.
2704 T}
2705 T{
2706 "%I"
2707 T}:T{
2708 Unescaped instance name
2709 T}:T{
2710 Same as "%i", but with escaping undone\&.
2711 T}
2712 T{
2713 "%j"
2714 T}:T{
2715 Final component of the prefix
2716 T}:T{
2717 This is the string between the last "\-" and the end of the prefix name\&. If there is no "\-", this is the same as "%p"\&.
2718 T}
2719 T{
2720 "%J"
2721 T}:T{
2722 Unescaped final component of the prefix
2723 T}:T{
2724 Same as "%j", but with escaping undone\&.
2725 T}
2726 T{
2727 "%l"
2728 T}:T{
2729 Short host name
2730 T}:T{
2731 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\&.
2732 T}
2733 T{
2734 "%L"
2735 T}:T{
2736 Log directory root
2737 T}:T{
2738 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)\&.
2739 T}
2740 T{
2741 "%m"
2742 T}:T{
2743 Machine ID
2744 T}:T{
2745 The machine ID of the running system, formatted as string\&. See \fBmachine-id\fR(5) for more information\&.
2746 T}
2747 T{
2748 "%M"
2749 T}:T{
2750 Operating system image identifier
2751 T}:T{
2752 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\&.
2753 T}
2754 T{
2755 "%n"
2756 T}:T{
2757 Full unit name
2758 T}:T{
2759 \ \&
2760 T}
2761 T{
2762 "%N"
2763 T}:T{
2764 Full unit name
2765 T}:T{
2766 Same as "%n", but with the type suffix removed\&.
2767 T}
2768 T{
2769 "%o"
2770 T}:T{
2771 Operating system ID
2772 T}:T{
2773 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\&.
2774 T}
2775 T{
2776 "%p"
2777 T}:T{
2778 Prefix name
2779 T}:T{
2780 For instantiated units, this refers to the string before the first "@" character of the unit name\&. For non\-instantiated units, same as "%N"\&.
2781 T}
2782 T{
2783 "%P"
2784 T}:T{
2785 Unescaped prefix name
2786 T}:T{
2787 Same as "%p", but with escaping undone\&.
2788 T}
2789 T{
2790 "%q"
2791 T}:T{
2792 Pretty host name
2793 T}:T{
2794 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\&.
2795 T}
2796 T{
2797 "%s"
2798 T}:T{
2799 User shell
2800 T}:T{
2801 This is the shell of the user running the service manager instance\&.
2802 T}
2803 T{
2804 "%S"
2805 T}:T{
2806 State directory root
2807 T}:T{
2808 This is either /var/lib (for the system manager) or the path \fI$XDG_STATE_HOME\fR resolves to (for user managers)\&.
2809 T}
2810 T{
2811 "%t"
2812 T}:T{
2813 Runtime directory root
2814 T}:T{
2815 This is either /run/ (for the system manager) or the path "$XDG_RUNTIME_DIR" resolves to (for user managers)\&.
2816 T}
2817 T{
2818 "%T"
2819 T}:T{
2820 Directory for temporary files
2821 T}:T{
2822 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\&.)
2823 T}
2824 T{
2825 "%u"
2826 T}:T{
2827 User name
2828 T}:T{
2829 This is the name of the \fIuser running the service manager instance\fR\&. In case of the system manager this resolves to "root"\&.
2830
2831 Note that this setting is \fInot\fR influenced by the \fIUser=\fR setting configurable in the [Service] section of the service unit\&.
2832 T}
2833 T{
2834 "%U"
2835 T}:T{
2836 User UID
2837 T}:T{
2838 This is the numeric UID of the \fIuser running the service manager instance\fR\&. In case of the system manager this resolves to "0"\&.
2839
2840 Note that this setting is \fInot\fR influenced by the \fIUser=\fR setting configurable in the [Service] section of the service unit\&.
2841 T}
2842 T{
2843 "%v"
2844 T}:T{
2845 Kernel release
2846 T}:T{
2847 Identical to \fBuname \-r\fR output\&.
2848 T}
2849 T{
2850 "%V"
2851 T}:T{
2852 Directory for larger and persistent temporary files
2853 T}:T{
2854 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\&.)
2855 T}
2856 T{
2857 "%w"
2858 T}:T{
2859 Operating system version ID
2860 T}:T{
2861 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\&.
2862 T}
2863 T{
2864 "%W"
2865 T}:T{
2866 Operating system variant ID
2867 T}:T{
2868 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\&.
2869 T}
2870 T{
2871 "%y"
2872 T}:T{
2873 The path to the fragment
2874 T}:T{
2875 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\&.
2876 T}
2877 T{
2878 "%Y"
2879 T}:T{
2880 The directory of the fragment
2881 T}:T{
2882 This is the directory part of "%y"\&.
2883 T}
2884 T{
2885 "%%"
2886 T}:T{
2887 Single percent sign
2888 T}:T{
2889 Use "%%" in place of "%" to specify a single percent sign\&.
2890 T}
2891 .TE
2892 .sp 1
2893 .SH "EXAMPLES"
2894 .PP
2895 \fBExample\ \&1.\ \&Allowing units to be enabled\fR
2896 .PP
2897 The following snippet (highlighted) allows a unit (e\&.g\&.
2898 foo\&.service) to be enabled via
2899 \fBsystemctl enable\fR:
2900 .sp
2901 .if n \{\
2902 .RS 4
2903 .\}
2904 .nf
2905 [Unit]
2906 Description=Foo
2907
2908 [Service]
2909 ExecStart=/usr/sbin/foo\-daemon
2910
2911 \fI[Install]\fR
2912 \fIWantedBy=multi\-user\&.target\fR
2913 .fi
2914 .if n \{\
2915 .RE
2916 .\}
2917 .PP
2918 After running
2919 \fBsystemctl enable\fR, a symlink
2920 /etc/systemd/system/multi\-user\&.target\&.wants/foo\&.service
2921 linking to the actual unit will be created\&. It tells systemd to pull in the unit when starting
2922 multi\-user\&.target\&. The inverse
2923 \fBsystemctl disable\fR
2924 will remove that symlink again\&.
2925 .PP
2926 \fBExample\ \&2.\ \&Overriding vendor settings\fR
2927 .PP
2928 There are two methods of overriding vendor settings in unit files: copying the unit file from
2929 /usr/lib/systemd/system
2930 to
2931 /etc/systemd/system
2932 and modifying the chosen settings\&. Alternatively, one can create a directory named
2933 \fIunit\fR\&.d/
2934 within
2935 /etc/systemd/system
2936 and place a drop\-in file
2937 \fIname\fR\&.conf
2938 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\&.
2939 .PP
2940 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\&.
2941 .PP
2942 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\&.
2943 .PP
2944 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\&.
2945 .PP
2946 Suppose there is a vendor\-supplied unit
2947 /usr/lib/systemd/system/httpd\&.service
2948 with the following contents:
2949 .sp
2950 .if n \{\
2951 .RS 4
2952 .\}
2953 .nf
2954 [Unit]
2955 Description=Some HTTP Server
2956 After=remote\-fs\&.target sqldb\&.service
2957 Requires=sqldb\&.service
2958 AssertPathExists=/srv/webserver
2959
2960 [Service]
2961 Type=notify
2962 ExecStart=/usr/sbin/some\-fancy\-httpd\-server
2963 Nice=5
2964
2965 [Install]
2966 WantedBy=multi\-user\&.target
2967 .fi
2968 .if n \{\
2969 .RE
2970 .\}
2971 .PP
2972 Now one wants to change some settings as an administrator: firstly, in the local setup,
2973 /srv/webserver
2974 might not exist, because the HTTP server is configured to use
2975 /srv/www
2976 instead\&. Secondly, the local configuration makes the HTTP server also depend on a memory cache service,
2977 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
2978 \fIPrivateTmp=\fR
2979 setting (see
2980 \fBsystemd.exec\fR(5)
2981 for details)\&. And lastly, the administrator would like to reset the niceness of the service to its default value of 0\&.
2982 .PP
2983 The first possibility is to copy the unit file to
2984 /etc/systemd/system/httpd\&.service
2985 and change the chosen settings:
2986 .sp
2987 .if n \{\
2988 .RS 4
2989 .\}
2990 .nf
2991 [Unit]
2992 Description=Some HTTP Server
2993 After=remote\-fs\&.target sqldb\&.service \fImemcached\&.service\fR
2994 Requires=sqldb\&.service \fImemcached\&.service\fR
2995 AssertPathExists=\fI/srv/www\fR
2996
2997 [Service]
2998 Type=notify
2999 ExecStart=/usr/sbin/some\-fancy\-httpd\-server
3000 \fINice=0\fR
3001 \fIPrivateTmp=yes\fR
3002
3003 [Install]
3004 WantedBy=multi\-user\&.target
3005 .fi
3006 .if n \{\
3007 .RE
3008 .\}
3009 .PP
3010 Alternatively, the administrator could create a drop\-in file
3011 /etc/systemd/system/httpd\&.service\&.d/local\&.conf
3012 with the following contents:
3013 .sp
3014 .if n \{\
3015 .RS 4
3016 .\}
3017 .nf
3018 [Unit]
3019 After=memcached\&.service
3020 Requires=memcached\&.service
3021 # Reset all assertions and then re\-add the condition we want
3022 AssertPathExists=
3023 AssertPathExists=/srv/www
3024
3025 [Service]
3026 Nice=0
3027 PrivateTmp=yes
3028 .fi
3029 .if n \{\
3030 .RE
3031 .\}
3032 .PP
3033 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
3034 \fIAssertPathExists=\fR
3035 (or e\&.g\&.
3036 \fIExecStart=\fR
3037 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\&.
3038 .PP
3039 \fBExample\ \&3.\ \&Top level drop\-ins with template units\fR
3040 .PP
3041 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
3042 /etc/systemd/system/service\&.d/
3043 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
3044 \fIOnFailure=\fR
3045 dependency for all service units\&.
3046 .PP
3047 /etc/systemd/system/failure\-handler@\&.service:
3048 .sp
3049 .if n \{\
3050 .RS 4
3051 .\}
3052 .nf
3053 [Unit]
3054 Description=My Failure Handler For %i
3055
3056 [Service]
3057 Type=oneshot
3058 # Perform some special action for when %i exits unexpectedly\&.
3059 ExecStart=/usr/sbin/myfailurehandler %i
3060 .fi
3061 .if n \{\
3062 .RE
3063 .\}
3064 .PP
3065 We can then add an instance of
3066 failure\-handler@\&.service
3067 as an
3068 \fIOnFailure=\fR
3069 dependency for all service units\&.
3070 .PP
3071 /etc/systemd/system/service\&.d/10\-all\&.conf:
3072 .sp
3073 .if n \{\
3074 .RS 4
3075 .\}
3076 .nf
3077 [Unit]
3078 OnFailure=failure\-handler@%N\&.service
3079 .fi
3080 .if n \{\
3081 .RE
3082 .\}
3083 .PP
3084 Now, after running
3085 \fBsystemctl daemon\-reload\fR
3086 all services will have acquired an
3087 \fIOnFailure=\fR
3088 dependency on
3089 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
3090 /dev/null:
3091 .sp
3092 .if n \{\
3093 .RS 4
3094 .\}
3095 .nf
3096 \fBmkdir /etc/systemd/system/failure\-handler@\&.service\&.d/\fR
3097 \fBln \-s /dev/null /etc/systemd/system/failure\-handler@\&.service\&.d/10\-all\&.conf\fR
3098 \fBsystemctl daemon\-reload\fR
3099 .fi
3100 .if n \{\
3101 .RE
3102 .\}
3103 .PP
3104 This ensures that if a
3105 failure\-handler@\&.service
3106 instance fails it will not trigger an instance named
3107 failure\-handler@failure\-handler\&.service\&.
3108 .SH "SEE ALSO"
3109 .PP
3110 \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)
3111 .SH "NOTES"
3112 .IP " 1." 4
3113 Interface Portability and Stability Promise
3114 .RS 4
3115 \%https://systemd.io/PORTABILITY_AND_STABILITY/
3116 .RE
3117 .IP " 2." 4
3118 ๐Ÿ’ฃ๐Ÿ’ฅ๐Ÿงจ๐Ÿ’ฅ๐Ÿ’ฅ๐Ÿ’ฃ Please note that those configuration files must be available at all times. If
3119 /usr/local/
3120 is a separate partition, it may not be available during early boot, and must not be used for configuration.
3121 .IP " 3." 4
3122 systemd and Storage Daemons for the Root File System
3123 .RS 4
3124 \%https://systemd.io/ROOT_STORAGE_DAEMONS
3125 .RE
3126 .IP " 4." 4
3127 System and Service Credentials
3128 .RS 4
3129 \%https://systemd.io/CREDENTIALS
3130 .RE
3131 .IP " 5." 4
3132 PSI (Pressure Stall Information)
3133 .RS 4
3134 \%https://docs.kernel.org/accounting/psi.html
3135 .RE