Debian Codegraph @

upstream/debian-unstable/man5/systemd.unit.5

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