Debian Codegraph @

man/systemd.special.xml

raw
1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
4 <!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
5
6 <refentry id="systemd.special" xmlns:xi="http://www.w3.org/2001/XInclude">
7
8 <refentryinfo>
9 <title>systemd.special</title>
10 <productname>systemd</productname>
11 </refentryinfo>
12
13 <refmeta>
14 <refentrytitle>systemd.special</refentrytitle>
15 <manvolnum>7</manvolnum>
16 </refmeta>
17
18 <refnamediv>
19 <refname>systemd.special</refname>
20 <refpurpose>Special systemd units</refpurpose>
21 </refnamediv>
22
23 <refsynopsisdiv><para>
24 <!-- sort alphabetically, targets first --><filename>basic.target</filename>,
25 <filename>bluetooth.target</filename>,
26 <filename>cryptsetup-pre.target</filename>,
27 <filename>cryptsetup.target</filename>,
28 <filename>veritysetup-pre.target</filename>,
29 <filename>veritysetup.target</filename>,
30 <filename>ctrl-alt-del.target</filename>,
31 <filename>[email protected]</filename>,
32 <filename>boot-complete.target</filename>,
33 <filename>default.target</filename>,
34 <filename>emergency.target</filename>,
35 <filename>exit.target</filename>,
36 <filename>factory-reset.target</filename>,
37 <filename>factory-reset-now.target</filename>,
38 <filename>final.target</filename>,
39 <filename>first-boot-complete.target</filename>,
40 <filename>getty.target</filename>,
41 <filename>getty-pre.target</filename>,
42 <filename>graphical.target</filename>,
43 <filename>halt.target</filename>,
44 <filename>hibernate.target</filename>,
45 <filename>hybrid-sleep.target</filename>,
46 <filename>suspend-then-hibernate.target</filename>,
47 <filename>initrd.target</filename>,
48 <filename>initrd-fs.target</filename>,
49 <filename>initrd-root-device.target</filename>,
50 <filename>initrd-root-fs.target</filename>,
51 <filename>initrd-usr-fs.target</filename>,
52 <filename>integritysetup-pre.target</filename>,
53 <filename>integritysetup.target</filename>,
54 <filename>kbrequest.target</filename>,
55 <filename>kexec.target</filename>,
56 <filename>local-fs-pre.target</filename>,
57 <filename>local-fs.target</filename>,
58 <filename>machines.target</filename>,
59 <filename>multi-user.target</filename>,
60 <filename>network-online.target</filename>,
61 <filename>network-pre.target</filename>,
62 <filename>network.target</filename>,
63 <filename>nss-lookup.target</filename>,
64 <filename>nss-user-lookup.target</filename>,
65 <filename>paths.target</filename>,
66 <filename>poweroff.target</filename>,
67 <filename>printer.target</filename>,
68 <filename>reboot.target</filename>,
69 <filename>remote-cryptsetup.target</filename>,
70 <filename>remote-integritysetup.target</filename>,
71 <filename>remote-veritysetup.target</filename>,
72 <filename>remote-fs-pre.target</filename>,
73 <filename>remote-fs.target</filename>,
74 <filename>rescue.target</filename>,
75 <filename>rpcbind.target</filename>,
76 <filename>shutdown.target</filename>,
77 <filename>sigpwr.target</filename>,
78 <filename>sleep.target</filename>,
79 <filename>slices.target</filename>,
80 <filename>smartcard.target</filename>,
81 <filename>sockets.target</filename>,
82 <filename>soft-reboot.target</filename>,
83 <filename>sound.target</filename>,
84 <filename>ssh-access.target</filename>,
85 <filename>storage-target-mode.target</filename>,
86 <filename>suspend.target</filename>,
87 <filename>swap.target</filename>,
88 <filename>sysinit.target</filename>,
89 <filename>system-update.target</filename>,
90 <filename>system-update-pre.target</filename>,
91 <filename>time-set.target</filename>,
92 <filename>time-sync.target</filename>,
93 <filename>timers.target</filename>,
94 <filename>tpm2.target</filename>,
95 <filename>umount.target</filename>,
96 <filename>usb-gadget.target</filename>,
97 <!-- slices --><filename>-.slice</filename>,
98 <filename>capsule.slice</filename>,
99 <filename>machine.slice</filename>,
100 <filename>system.slice</filename>,
101 <filename>user.slice</filename>,
102 <!-- the rest --><filename>-.mount</filename>,
103 <filename>dbus.service</filename>,
104 <filename>dbus.socket</filename>,
105 <filename>display-manager.service</filename>,
106 <filename>init.scope</filename>,
107 <filename>syslog.socket</filename>,
108 <filename>system-update-cleanup.service</filename>
109 </para></refsynopsisdiv>
110
111 <refsect1>
112 <title>Description</title>
113
114 <para>A few units are treated specially by systemd. Many of them have
115 special internal semantics and cannot be renamed, while others simply
116 have a standard meaning and should be present on all systems.</para>
117 </refsect1>
118
119 <refsect1>
120 <title>Units managed by the system service manager</title>
121
122 <refsect2>
123 <title>Special System Units</title>
124
125 <variablelist>
126 <varlistentry>
127 <term><filename>-.mount</filename></term>
128 <listitem>
129 <para>The root mount point, i.e. the mount unit for the <filename>/</filename>
130 path. This unit is unconditionally active, during the entire time the system is up, as
131 this mount point is where the basic userspace is running from.</para>
132
133 <xi:include href="version-info.xml" xpointer="v235"/>
134 </listitem>
135 </varlistentry>
136
137 <varlistentry>
138 <term><filename>basic.target</filename></term>
139 <listitem>
140 <para>A special target unit covering basic boot-up.</para>
141
142 <para>systemd automatically adds dependency of the type
143 <varname>After=</varname> for this target unit to all
144 services (except for those with
145 <varname>DefaultDependencies=no</varname>).</para>
146
147 <para>Usually, this should pull-in all local mount points plus
148 <filename>/var/</filename>, <filename>/tmp/</filename> and
149 <filename>/var/tmp/</filename>, swap devices, sockets, timers,
150 path units and other basic initialization necessary for general
151 purpose daemons. The mentioned mount points are special cased
152 to allow them to be remote.
153 </para>
154
155 <para>This target usually does not pull in any non-target units
156 directly, but rather does so indirectly via other early boot targets.
157 It is instead meant as a synchronization point for late boot
158 services. Refer to
159 <citerefentry><refentrytitle>bootup</refentrytitle><manvolnum>7</manvolnum></citerefentry>
160 for details on the targets involved.
161 </para>
162 </listitem>
163 </varlistentry>
164 <varlistentry>
165 <term><filename>boot-complete.target</filename></term>
166 <listitem>
167 <para>This target is intended as generic synchronization point for services that shall determine or act on
168 whether the boot process completed successfully. Order units that are required to succeed for a boot process
169 to be considered successful before this unit, and add a <varname>Requires=</varname> dependency from the
170 target unit to them. Order units that shall only run when the boot process is considered successful after the
171 target unit and pull in the target from it, also with <varname>Requires=</varname>. Note that by default this
172 target unit is not part of the initial boot transaction, but is supposed to be pulled in only if required by
173 units that want to run only on successful boots.</para>
174
175 <para>See
176 <citerefentry><refentrytitle>systemd-boot-check-no-failures.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
177 for a service that implements a generic system health check and orders itself before
178 <filename>boot-complete.target</filename>.</para>
179
180 <para>See
181 <citerefentry><refentrytitle>systemd-bless-boot.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
182 for a service that propagates boot success information to the boot loader, and orders itself after
183 <filename>boot-complete.target</filename>.</para>
184
185 <xi:include href="version-info.xml" xpointer="v240"/>
186 </listitem>
187 </varlistentry>
188 <varlistentry>
189 <term><filename>ctrl-alt-del.target</filename></term>
190 <listitem>
191 <para>systemd starts this target whenever Control+Alt+Del is
192 pressed on the console. Usually, this should be aliased
193 (symlinked) to <filename>reboot.target</filename>.</para>
194 </listitem>
195 </varlistentry>
196 <varlistentry>
197 <term><filename>cryptsetup.target</filename></term>
198 <listitem>
199 <para>A target that pulls in setup services for all
200 encrypted block devices.</para>
201 </listitem>
202 </varlistentry>
203 <varlistentry>
204 <term><filename>veritysetup.target</filename></term>
205 <listitem>
206 <para>A target that pulls in setup services for all
207 verity integrity protected block devices.</para>
208
209 <xi:include href="version-info.xml" xpointer="v248"/>
210 </listitem>
211 </varlistentry>
212 <varlistentry>
213 <term><filename>dbus.service</filename></term>
214 <listitem>
215 <para>A special unit for the D-Bus bus daemon. As soon as
216 this service is fully started up systemd will connect to it
217 and register its service.</para>
218 </listitem>
219 </varlistentry>
220 <varlistentry>
221 <term><filename>dbus.socket</filename></term>
222 <listitem>
223 <para>A special unit for the D-Bus system bus socket. All
224 units with <varname>Type=dbus</varname> automatically gain a
225 dependency on this unit.</para>
226 </listitem>
227 </varlistentry>
228 <varlistentry>
229 <term><filename>default.target</filename></term>
230 <listitem>
231 <para>The default unit systemd starts at bootup. Usually, this should be aliased (symlinked) to
232 <filename>multi-user.target</filename> or <filename>graphical.target</filename>. See
233 <citerefentry><refentrytitle>bootup</refentrytitle><manvolnum>7</manvolnum></citerefentry> for
234 more discussion.</para>
235
236 <para>The default unit systemd starts at bootup can be overridden with the
237 <varname>systemd.unit=</varname> kernel command line option, or more conveniently, with the short
238 names like <varname>single</varname>, <varname>rescue</varname>, <varname>1</varname>,
239 <varname>3</varname>, <varname>5</varname>, …; see
240 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>.</para>
241
242 <para>For typical unit files please set <literal>WantedBy=</literal> to a regular target (like
243 <filename>multi-user.target</filename> or <filename>graphical.target</filename>),
244 instead of <filename>default.target</filename>, since such a service will also be run on special
245 boots like on system update, emergency boot…</para>
246 </listitem>
247 </varlistentry>
248 <varlistentry>
249 <term><filename>display-manager.service</filename></term>
250 <listitem>
251 <para>The display manager service. Usually, this should be
252 aliased (symlinked) to <filename>gdm.service</filename> or a
253 similar display manager service.</para>
254 </listitem>
255 </varlistentry>
256 <varlistentry>
257 <term><filename>emergency.target</filename></term>
258 <listitem>
259 <para>A special target unit that starts an emergency shell on the main console. This
260 target does not pull in other services or mounts. It is the most minimal version of
261 starting the system in order to acquire an interactive shell; the only processes running
262 are usually just the system manager (PID 1) and the shell process. This unit may be used
263 by specifying <varname>emergency</varname> on the kernel command line; it is
264 also used when a file system check on a required file system fails and boot-up cannot
265 continue. Compare with <filename>rescue.target</filename>, which serves a similar
266 purpose, but also starts the most basic services and mounts all file systems.</para>
267
268 <para>In many ways booting into <filename>emergency.target</filename> is similar to the
269 effect of booting with <literal>init=/bin/sh</literal> on the kernel command line,
270 except that emergency mode provides you with the full system and service manager, and
271 allows starting individual units in order to continue the boot process in steps.</para>
272
273 <para>Note that depending on how <filename>emergency.target</filename> is reached, the root file
274 system might be mounted read-only or read-write (no remounting is done specially for this
275 target). For example, the system may boot with root mounted read-only when <varname>ro</varname>
276 is used on the kernel command line and remain this way for <filename>emergency.target</filename>,
277 or the system may transition to <filename>emergency.target</filename> after the system has been
278 partially booted and disks have already been remounted read-write.</para>
279 </listitem>
280 </varlistentry>
281 <varlistentry>
282 <term><filename>exit.target</filename></term>
283 <listitem>
284 <para>A special service unit for shutting down the system or
285 user service manager. It is equivalent to
286 <filename>poweroff.target</filename> on non-container
287 systems, and also works in containers.</para>
288
289 <para>systemd will start this unit when it receives the
290 <constant>SIGTERM</constant> or <constant>SIGINT</constant>
291 signal when running as user service daemon.</para>
292
293 <para>Normally, this (indirectly) pulls in
294 <filename>shutdown.target</filename>, which in turn should be
295 conflicted by all units that want to be scheduled for
296 shutdown when the service manager starts to exit.</para>
297
298 <xi:include href="version-info.xml" xpointer="v186"/>
299 </listitem>
300 </varlistentry>
301 <varlistentry>
302 <term><filename>factory-reset.target</filename></term>
303 <listitem>
304 <para>A special target to request a factory reset operation. This will typically persistently
305 store a request flag for the next boot and then reboot in order to reset the system to factory
306 state.</para>
307
308 <para>See <ulink url="https://systemd.io/FACTORY_RESET">Factory Reset</ulink> for more
309 information.</para>
310
311 <xi:include href="version-info.xml" xpointer="v250"/>
312 </listitem>
313 </varlistentry>
314 <varlistentry>
315 <term><filename>factory-reset-now.target</filename></term>
316 <listitem>
317 <para>A special target that is started on boots that shall execute a factory reset. It may be
318 used to pull in additional services that shall be invoked during a factory reset operation. It
319 also acts as ordering barrier: once the target is reached the factory reset state is marked as
320 "completed".</para>
321
322 <para>See <ulink url="https://systemd.io/FACTORY_RESET">Factory Reset</ulink> for more
323 information.</para>
324
325 <xi:include href="version-info.xml" xpointer="v258"/>
326 </listitem>
327 </varlistentry>
328 <varlistentry>
329 <term><filename>final.target</filename></term>
330 <listitem>
331 <para>A special target unit that is used during the shutdown
332 logic and may be used to pull in late services after all
333 normal services are already terminated and all mounts
334 unmounted.
335 </para>
336 </listitem>
337 </varlistentry>
338 <varlistentry>
339 <term><filename>getty.target</filename></term>
340 <listitem>
341 <para>A special target unit that pulls in statically
342 configured local TTY <filename>getty</filename> instances.
343 </para>
344 </listitem>
345 </varlistentry>
346 <varlistentry>
347 <term><filename>graphical.target</filename></term>
348 <listitem>
349 <para>A special target unit for setting up a graphical login
350 screen. This pulls in
351 <filename>multi-user.target</filename>.</para>
352
353 <para>Units that are needed for graphical logins shall add
354 <varname>Wants=</varname> dependencies for their unit to
355 this unit (or <filename>multi-user.target</filename>) during
356 installation. This is best configured via
357 <varname>WantedBy=graphical.target</varname> in the unit's
358 [Install] section.</para>
359 </listitem>
360 </varlistentry>
361 <varlistentry>
362 <term><filename>hibernate.target</filename></term>
363 <listitem>
364 <para>A special target unit for hibernating the system. This
365 pulls in <filename>sleep.target</filename>.</para>
366 </listitem>
367 </varlistentry>
368 <varlistentry>
369 <term><filename>hybrid-sleep.target</filename></term>
370 <listitem>
371 <para>A special target unit for hibernating and suspending
372 the system at the same time. This pulls in
373 <filename>sleep.target</filename>.</para>
374
375 <xi:include href="version-info.xml" xpointer="v196"/>
376 </listitem>
377 </varlistentry>
378 <varlistentry>
379 <term><filename>suspend-then-hibernate.target</filename></term>
380 <listitem>
381 <para>A special target unit for suspending the system for a period
382 of time, waking it and putting it into hibernate. This pulls in
383 <filename>sleep.target</filename>.</para>
384
385 <xi:include href="version-info.xml" xpointer="v239"/>
386 </listitem>
387 </varlistentry>
388
389 <varlistentry>
390 <term><filename>halt.target</filename></term>
391 <listitem>
392 <para>A special target unit for shutting down and halting
393 the system. Note that this target is distinct from
394 <filename>poweroff.target</filename> in that it generally
395 really just halts the system rather than powering it
396 down.</para>
397
398 <para>Applications wanting to halt the system should not start this unit
399 directly, but should instead execute <command>systemctl halt</command>
400 (possibly with the <option>--no-block</option> option) or call
401 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>'s
402 <command>org.freedesktop.systemd1.Manager.Halt</command> D-Bus method
403 directly.</para>
404 </listitem>
405 </varlistentry>
406 <varlistentry>
407 <term><filename>imports.target</filename></term>
408 <listitem>
409 <para>A target unit that pulls in all disk image download jobs to execute on system boot. This is
410 used by
411 <citerefentry><refentrytitle>systemd-import-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
412
413 <xi:include href="version-info.xml" xpointer="v258"/>
414 </listitem>
415 </varlistentry>
416 <varlistentry>
417 <term><filename>init.scope</filename></term>
418 <listitem>
419 <para>This scope unit is where the system and service manager (PID 1) itself resides. It
420 is active as long as the system is running.</para>
421
422 <xi:include href="version-info.xml" xpointer="v235"/>
423 </listitem>
424 </varlistentry>
425 <varlistentry>
426 <term><filename>initrd.target</filename></term>
427 <listitem>
428 <para>This is the default target in the initrd, similar to <filename>default.target</filename> in
429 the main system. It is used to mount the real root and transition to it. See
430 <citerefentry><refentrytitle>bootup</refentrytitle><manvolnum>7</manvolnum></citerefentry> for
431 more discussion.</para>
432
433 <xi:include href="version-info.xml" xpointer="v245"/>
434 </listitem>
435 </varlistentry>
436 <varlistentry>
437 <term><filename>initrd-fs.target</filename></term>
438 <listitem>
439 <para><citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>
440 automatically adds dependencies of type <varname>Before=</varname> to
441 <filename>sysroot-usr.mount</filename> and all mount points found in
442 <filename>/etc/fstab</filename> that have the <option>x-initrd.mount</option> mount option set
443 and do not have the <option>noauto</option> mount option set. It is also indirectly ordered after
444 <filename>sysroot.mount</filename>. Thus, once this target is reached the
445 <filename>/sysroot/</filename> hierarchy is fully set up, in preparation for the transition to
446 the host OS.</para>
447
448 <xi:include href="version-info.xml" xpointer="v199"/>
449 </listitem>
450 </varlistentry>
451 <varlistentry>
452 <term><filename>initrd-root-device.target</filename></term>
453 <listitem>
454 <para>A special initrd target unit that is reached when the root filesystem device is available, but before
455 it has been mounted.
456 <citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>
457 and
458 <citerefentry><refentrytitle>systemd-gpt-auto-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>
459 automatically set up the appropriate dependencies to make this happen.
460 </para>
461
462 <xi:include href="version-info.xml" xpointer="v230"/>
463 </listitem>
464 </varlistentry>
465 <varlistentry>
466 <term><filename>initrd-root-fs.target</filename></term>
467 <listitem>
468 <para><citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>
469 automatically adds dependencies of type <varname>Before=</varname> to the
470 <filename>sysroot.mount</filename> unit, which is generated from the kernel command line's
471 <varname>root=</varname> setting (or equivalent).</para>
472
473 <xi:include href="version-info.xml" xpointer="v199"/>
474 </listitem>
475 </varlistentry>
476 <varlistentry>
477 <term><filename>initrd-usr-fs.target</filename></term>
478 <listitem>
479 <para><citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>
480 automatically adds dependencies of type <varname>Before=</varname> to the
481 <filename>sysusr-usr.mount</filename> unit, which is generated from the kernel command line's
482 <varname>usr=</varname> switch. Services may order themselves after this target unit in order to
483 run once the <filename>/sysusr/</filename> hierarchy becomes available, on systems that come up
484 initially without a root file system, but with an initialized <filename>/usr/</filename> and need
485 to access that before setting up the root file system to ultimately switch to. On systems where
486 <varname>usr=</varname> is not used this target is ordered after
487 <filename>sysroot.mount</filename> and thus mostly equivalent to
488 <filename>initrd-root-fs.target</filename>. In effect on any system once this target is reached
489 the file system backing <filename>/usr/</filename> is mounted, though possibly at two different
490 locations, either below the <filename>/sysusr/</filename> or the <filename>/sysroot/</filename>
491 hierarchies.</para>
492
493 <xi:include href="version-info.xml" xpointer="v249"/>
494 </listitem>
495 </varlistentry>
496 <varlistentry>
497 <term><filename>kbrequest.target</filename></term>
498 <listitem>
499 <para>systemd starts this target whenever Alt+ArrowUp is
500 pressed on the console. Note that any user with physical access
501 to the machine will be able to do this, without authentication,
502 so this should be used carefully.</para>
503 </listitem>
504 </varlistentry>
505 <varlistentry>
506 <term><filename>kexec.target</filename></term>
507 <listitem>
508 <para>A special target unit for shutting down and rebooting the system via kexec.</para>
509
510 <para>Applications wanting to reboot the system should not start this unit directly, but should
511 instead execute <command>systemctl kexec</command> (possibly with the
512 <option>--no-block</option> option) or call
513 <citerefentry><refentrytitle>systemd-logind</refentrytitle><manvolnum>8</manvolnum></citerefentry>'s
514 <function>org.freedesktop.login1.Manager.RebootWithFlags()</function> D-Bus method
515 directly.</para>
516
517 <para>See
518 <citerefentry><refentrytitle>systemd-kexec.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
519 for further details of the operation this target pulls in.</para>
520 </listitem>
521 </varlistentry>
522 <varlistentry>
523 <term><filename>local-fs.target</filename></term>
524 <listitem>
525 <para><citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>
526 automatically adds dependencies of type
527 <varname>Before=</varname> to all mount units that refer to
528 local mount points for this target unit. In addition, it
529 adds dependencies of type <varname>Wants=</varname> to this
530 target unit for those mounts listed in
531 <filename>/etc/fstab</filename> that have the
532 <option>auto</option> mount option set.</para>
533 </listitem>
534 </varlistentry>
535 <varlistentry>
536 <term><filename>machines.target</filename></term>
537 <listitem>
538 <para>A standard target unit for starting all the containers
539 and other virtual machines. See <filename>[email protected]</filename>
540 for an example.</para>
541
542 <xi:include href="version-info.xml" xpointer="v233"/>
543 </listitem>
544 </varlistentry>
545 <varlistentry>
546 <term><filename>multi-user.target</filename></term>
547 <listitem>
548 <para>A special target unit for setting up a multi-user
549 system (non-graphical). This is pulled in by
550 <filename>graphical.target</filename>.</para>
551
552 <para>Units that are needed for a multi-user system shall
553 add <varname>Wants=</varname> dependencies for their unit to
554 this unit during installation. This is best configured via
555 <varname>WantedBy=multi-user.target</varname> in the unit's
556 [Install] section.</para>
557 </listitem>
558 </varlistentry>
559 <varlistentry>
560 <term><filename>network-online.target</filename></term>
561 <listitem>
562 <para>Units that strictly require a configured network
563 connection should pull in
564 <filename>network-online.target</filename> (via a
565 <varname>Wants=</varname> type dependency) and order
566 themselves after it. This target unit is intended to pull in
567 a service that delays further execution until the network is
568 sufficiently set up. What precisely this requires is left to
569 the implementation of the network managing service.</para>
570
571 <para>Note the distinction between this unit and <filename>network.target</filename>. This unit
572 is an active unit (i.e. pulled in by the consumer rather than the provider of this functionality)
573 and pulls in a service which possibly adds substantial delays to further execution. In contrast,
574 <filename>network.target</filename> is a passive unit (i.e. pulled in by the provider of the
575 functionality, rather than the consumer) that usually does not delay execution much. Usually,
576 <filename>network.target</filename> is part of the boot of most systems, while
577 <filename>network-online.target</filename> is not, except when at least one unit requires
578 it. Also see <ulink url="https://systemd.io/NETWORK_ONLINE">Running Services After the Network Is
579 Up</ulink> for more information.</para>
580
581 <para>All mount units for remote network file systems automatically pull in this unit, and order
582 themselves after it. Note that networking daemons that simply <emphasis>provide</emphasis>
583 functionality to other hosts (as opposed to <emphasis>consume</emphasis> functionality of other
584 hosts) generally do not need to pull this in.</para>
585
586 <para>Note that this unit is only useful during the original system start-up
587 logic. After the system has completed booting up, it will not track the online state of
588 the system anymore. Due to this it cannot be used as a network connection monitor
589 concept, it is purely a one-time system start-up concept.</para>
590
591 <xi:include href="version-info.xml" xpointer="v200"/>
592 </listitem>
593 </varlistentry>
594 <varlistentry>
595 <term><filename>paths.target</filename></term>
596 <listitem>
597 <para>A special target unit that sets up all path units (see
598 <citerefentry><refentrytitle>systemd.path</refentrytitle><manvolnum>5</manvolnum></citerefentry>
599 for details) that shall be active after boot.</para>
600
601 <para>It is recommended that path units installed by
602 applications get pulled in via <varname>Wants=</varname>
603 dependencies from this unit. This is best configured via a
604 <varname>WantedBy=paths.target</varname> in the path unit's
605 [Install] section.</para>
606
607 <xi:include href="version-info.xml" xpointer="v199"/>
608 </listitem>
609 </varlistentry>
610 <varlistentry>
611 <term><filename>poweroff.target</filename></term>
612 <listitem>
613 <para>A special target unit for shutting down and powering
614 off the system.</para>
615
616 <para>Applications wanting to power off the system should not start this unit
617 directly, but should instead execute <command>systemctl poweroff</command>
618 (possibly with the <option>--no-block</option> option) or call
619 <citerefentry><refentrytitle>systemd-logind</refentrytitle><manvolnum>8</manvolnum></citerefentry>'s
620 <command>org.freedesktop.login1.Manager.PowerOff</command> D-Bus method
621 directly.</para>
622 </listitem>
623 </varlistentry>
624 <varlistentry>
625 <term><filename>reboot.target</filename></term>
626 <listitem>
627 <para>A special target unit for shutting down and rebooting the system.</para>
628
629 <para>Applications wanting to reboot the system should not start this unit directly, but should
630 instead execute <command>systemctl reboot</command> (possibly with the
631 <option>--no-block</option> option) or call
632 <citerefentry><refentrytitle>systemd-logind</refentrytitle><manvolnum>8</manvolnum></citerefentry>'s
633 <function>org.freedesktop.login1.Manager.Reboot()</function> D-Bus method directly.</para>
634
635 <para>See
636 <citerefentry><refentrytitle>systemd-reboot.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
637 for further details of the operation this target pulls in.</para>
638 </listitem>
639 </varlistentry>
640 <varlistentry>
641 <term><filename>remote-cryptsetup.target</filename></term>
642 <listitem>
643 <para>Similar to <filename>cryptsetup.target</filename>, but for encrypted
644 devices which are accessed over the network. It is used for
645 <citerefentry><refentrytitle>crypttab</refentrytitle><manvolnum>5</manvolnum></citerefentry>
646 entries marked with <option>_netdev</option>.</para>
647
648 <xi:include href="version-info.xml" xpointer="v235"/>
649 </listitem>
650 </varlistentry>
651 <varlistentry>
652 <term><filename>remote-integritysetup.target</filename></term>
653 <listitem>
654 <para>Similar to <filename>integritysetup.target</filename>, but for integrity protected devices
655 which are accessed over the network. It is used for
656 <citerefentry><refentrytitle>integritytab</refentrytitle><manvolnum>5</manvolnum></citerefentry>
657 entries marked with <option>_netdev</option>.</para>
658
659 <xi:include href="version-info.xml" xpointer="v258"/>
660 </listitem>
661 </varlistentry>
662 <varlistentry>
663 <term><filename>remote-veritysetup.target</filename></term>
664 <listitem>
665 <para>Similar to <filename>veritysetup.target</filename>, but for verity
666 protected devices which are accessed over the network. It is used for
667 <citerefentry><refentrytitle>veritytab</refentrytitle><manvolnum>5</manvolnum></citerefentry>
668 entries marked with <option>_netdev</option>.</para>
669
670 <xi:include href="version-info.xml" xpointer="v248"/>
671 </listitem>
672 </varlistentry>
673 <varlistentry>
674 <term><filename>remote-fs.target</filename></term>
675 <listitem>
676 <para>Similar to <filename>local-fs.target</filename>, but
677 for remote mount points.</para>
678 </listitem>
679 </varlistentry>
680 <varlistentry>
681 <term><filename>rescue.target</filename></term>
682 <listitem>
683 <para>A special target unit that pulls in the base system (including system mounts) and
684 spawns a rescue shell. Isolate to this target in order to administer the system in
685 single-user mode with all file systems mounted but with no services running, except for
686 the most basic. Compare with <filename>emergency.target</filename>, which is much more
687 reduced and does not provide the file systems or most basic services. Compare with
688 <filename>multi-user.target</filename>, this target could be seen as
689 <filename>single-user.target</filename>.</para>
690
691 <para>Use the <literal>systemd.unit=rescue.target</literal> kernel command line option
692 to boot into this mode. A short alias for this kernel command line option is
693 <literal>1</literal>, for compatibility with SysV.</para>
694 </listitem>
695 </varlistentry>
696 <varlistentry>
697 <term><filename>shutdown.target</filename></term>
698 <listitem>
699 <para>A special target unit that terminates the services on
700 system shutdown.</para>
701
702 <para>Services that shall be terminated on system shutdown
703 shall add <varname>Conflicts=</varname> and
704 <varname>Before=</varname> dependencies to this unit for
705 their service unit, which is implicitly done when
706 <varname>DefaultDependencies=yes</varname> is set (the
707 default).</para>
708 </listitem>
709 </varlistentry>
710 <varlistentry>
711 <term><filename>sigpwr.target</filename></term>
712 <listitem>
713 <para>A special target that is started when systemd receives
714 the SIGPWR process signal, which is normally sent by the
715 kernel or UPS daemons when power fails.</para>
716 </listitem>
717 </varlistentry>
718 <varlistentry>
719 <term><filename>sleep.target</filename></term>
720 <listitem>
721 <para>A special target unit that is pulled in by <filename>suspend.target</filename>,
722 <filename>hibernate.target</filename>, <filename>suspend-then-hibernate.target</filename>, and
723 <filename>hybrid-sleep.target</filename> and may be used to hook units into the sleep state
724 logic.</para>
725
726 <para>In order to hook external programs <emphasis>before</emphasis> the actual system sleep
727 operation, place their command line in a service unit file's <varname>ExecStart=</varname> line
728 (use <varname>Type=oneshot</varname>), and ensure the unit is pulled in by
729 <filename>sleep.target</filename> and ordered before it. In order to hook program code
730 <emphasis>after</emphasis> the actual system sleep operation (i.e. to be run after the system
731 woke up again), place the command in <varname>ExecStop=</varname> instead, and make sure to
732 enable <varname>StopWhenUnneeded=</varname> and <varname>RemainAfterExit=</varname>. Both
733 approaches can be combined into one unit file in order to run programs both before and after the
734 sleep operation.</para>
735
736 <example>
737 <title>Combined Example</title>
738
739 <programlisting>[Unit]
740 DefaultDependencies=no
741 StopWhenUnneeded=yes
742 Before=sleep.target
743
744 [Service]
745 Type=oneshot
746 RemainAfterExit=yes
747 ExecStart=/usr/bin/some-before-command
748 ExecStop=/usr/bin/some-after-command
749
750 [Install]
751 WantedBy=sleep.target</programlisting>
752 </example>
753 </listitem>
754 </varlistentry>
755 <varlistentry>
756 <term><filename>slices.target</filename></term>
757 <listitem>
758 <para>A special target unit that sets up all slice units (see
759 <citerefentry><refentrytitle>systemd.slice</refentrytitle><manvolnum>5</manvolnum></citerefentry>
760 for details) that shall always be active after boot. By default, the generic
761 <filename>system.slice</filename> slice unit as well as the root slice unit
762 <filename>-.slice</filename> are pulled in and ordered before this unit (see
763 below).</para>
764
765 <para>Adding slice units to <filename>slices.target</filename> is generally not
766 necessary. Instead, when some unit that uses <varname>Slice=</varname> is started, the
767 specified slice will be started automatically. Adding
768 <varname>WantedBy=slices.target</varname> lines to the [Install]
769 section should only be done for units that need to be always active. In that case care
770 needs to be taken to avoid creating a loop through the automatic dependencies on
771 "parent" slices.</para>
772
773 <xi:include href="version-info.xml" xpointer="v229"/>
774 </listitem>
775 </varlistentry>
776 <varlistentry>
777 <term><filename>sockets.target</filename></term>
778 <listitem>
779 <para>A special target unit that sets up all socket
780 units (see
781 <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>
782 for details) that shall be active after boot.</para>
783
784 <para>Services that can be socket-activated shall add
785 <varname>Wants=</varname> dependencies to this unit for
786 their socket unit during installation. This is best
787 configured via a <varname>WantedBy=sockets.target</varname>
788 in the socket unit's [Install]
789 section.</para>
790 </listitem>
791 </varlistentry>
792 <varlistentry>
793 <term><filename>soft-reboot.target</filename></term>
794 <listitem>
795 <para>A special target unit for shutting down and rebooting the userspace of the system (leaving
796 the kernel running).</para>
797
798 <para>Applications wanting to reboot the system should not start this unit directly, but should
799 instead execute <command>systemctl soft-reboot</command> (possibly with the
800 <option>--no-block</option> option) or call
801 <citerefentry><refentrytitle>systemd-logind</refentrytitle><manvolnum>8</manvolnum></citerefentry>'s
802 <function>org.freedesktop.login1.Manager.RebootWithFlags()</function> D-Bus method
803 directly.</para>
804
805 <para>See
806 <citerefentry><refentrytitle>systemd-soft-reboot.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
807 for further details of the operation this target pulls in.</para>
808
809 <xi:include href="version-info.xml" xpointer="v254"/>
810 </listitem>
811 </varlistentry>
812 <varlistentry>
813 <term><filename>storage-target-mode.target</filename></term>
814 <listitem>
815 <para>A special target unit that can be booted into that selects the "Storage Target Mode" for
816 the OS. In this mode all local storage disks are exposed to external systems as block
817 devices. This invokes
818 <citerefentry><refentrytitle>systemd-storagetm.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
819 which exposes all local disks as NVMe-TCP devices for access over the network. It might as well
820 invoke other services too that make local disks available via other mechanisms.</para>
821 <xi:include href="version-info.xml" xpointer="v255"/>
822 </listitem>
823 </varlistentry>
824 <varlistentry>
825 <term><filename>suspend.target</filename></term>
826 <listitem>
827 <para>A special target unit for suspending the system. This
828 pulls in <filename>sleep.target</filename>.</para>
829 </listitem>
830 </varlistentry>
831 <varlistentry>
832 <term><filename>swap.target</filename></term>
833 <listitem>
834 <para>Similar to <filename>local-fs.target</filename>, but
835 for swap partitions and swap files.</para>
836 </listitem>
837 </varlistentry>
838 <varlistentry>
839 <term><filename>sysinit.target</filename></term>
840 <listitem>
841 <para>systemd automatically adds dependencies of the types
842 <varname>Requires=</varname> and <varname>After=</varname>
843 for this target unit to all services (except for those with
844 <varname>DefaultDependencies=no</varname>).</para>
845
846 <para>This target pulls in the services required for system
847 initialization. System services pulled in by this target should
848 declare <varname>DefaultDependencies=no</varname> and specify
849 all their dependencies manually, including access to anything
850 more than a read only root filesystem. For details on the
851 dependencies of this target, refer to
852 <citerefentry><refentrytitle>bootup</refentrytitle><manvolnum>7</manvolnum></citerefentry>.
853 </para>
854 </listitem>
855 </varlistentry>
856 <varlistentry>
857 <term><filename>syslog.socket</filename></term>
858 <listitem>
859 <para>The socket unit syslog implementations should listen
860 on. All userspace log messages will be made available on
861 this socket. For more information about syslog integration,
862 please consult the <ulink
863 url="https://systemd.io/SYSLOG">Syslog
864 Interface</ulink> document.</para>
865 </listitem>
866 </varlistentry>
867 <varlistentry>
868 <term><filename>system-update.target</filename></term>
869 <term><filename>system-update-pre.target</filename></term>
870 <term><filename>system-update-cleanup.service</filename></term>
871 <listitem>
872 <para>A special target unit that is used for offline system updates.
873 <citerefentry><refentrytitle>systemd-system-update-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>
874 will redirect the boot process to this target if <filename>/system-update</filename> or
875 <filename>/etc/system-update</filename> exists. For more information see
876 <citerefentry><refentrytitle>systemd.offline-updates</refentrytitle><manvolnum>7</manvolnum></citerefentry>.
877 </para>
878
879 <para>Updates should happen before the <filename>system-update.target</filename> is
880 reached, and the services which implement them should cause the machine to reboot. The
881 main units executing the update should order themselves after
882 <filename>system-update-pre.target</filename> but not pull it in. Services which want to
883 run during system updates only, but before the actual system update is executed should
884 order themselves before this unit and pull it in. As a safety measure, if this does not
885 happen, and <filename>/system-update</filename> or
886 <filename>/etc/system-update</filename> still exists after
887 <filename>system-update.target</filename> is reached,
888 <filename>system-update-cleanup.service</filename> will remove the symlinks and reboot
889 the machine.</para>
890
891 <xi:include href="version-info.xml" xpointer="v186"/>
892 </listitem>
893 </varlistentry>
894 <varlistentry>
895 <term><filename>timers.target</filename></term>
896 <listitem>
897 <para>A special target unit that sets up all timer units
898 (see
899 <citerefentry><refentrytitle>systemd.timer</refentrytitle><manvolnum>5</manvolnum></citerefentry>
900 for details) that shall be active after boot.</para>
901
902 <para>It is recommended that timer units installed by
903 applications get pulled in via <varname>Wants=</varname>
904 dependencies from this unit. This is best configured via
905 <varname>WantedBy=timers.target</varname> in the timer
906 unit's [Install] section.</para>
907
908 <xi:include href="version-info.xml" xpointer="v199"/>
909 </listitem>
910 </varlistentry>
911 <varlistentry>
912 <term><filename>umount.target</filename></term>
913 <listitem>
914 <para>A special target unit that unmounts all mount and
915 automount points on system shutdown.</para>
916
917 <para>Mounts that shall be unmounted on system shutdown
918 shall add Conflicts dependencies to this unit for their
919 mount unit, which is implicitly done when
920 <varname>DefaultDependencies=yes</varname> is set (the
921 default).</para>
922 </listitem>
923 </varlistentry>
924
925 </variablelist>
926 </refsect2>
927
928 <refsect2>
929 <title>Special System Units for Devices</title>
930
931 <para>Some target units are automatically pulled in as devices of
932 certain kinds show up in the system. These may be used to
933 automatically activate various services based on the specific type
934 of the available hardware.</para>
935
936 <variablelist>
937 <varlistentry>
938 <term><filename>bluetooth.target</filename></term>
939 <listitem>
940 <para>This target is started automatically as soon as a
941 Bluetooth controller is plugged in or becomes available at
942 boot.</para>
943
944 <para>This may be used to pull in Bluetooth management
945 daemons dynamically when Bluetooth hardware is found.</para>
946 </listitem>
947 </varlistentry>
948 <varlistentry>
949 <term><filename>printer.target</filename></term>
950 <listitem>
951 <para>This target is started automatically as soon as a
952 printer is plugged in or becomes available at boot.</para>
953
954 <para>This may be used to pull in printer management daemons
955 dynamically when printer hardware is found.</para>
956 </listitem>
957 </varlistentry>
958 <varlistentry>
959 <term><filename>smartcard.target</filename></term>
960 <listitem>
961 <para>This target is started automatically as soon as a
962 smartcard controller is plugged in or becomes available at
963 boot.</para>
964
965 <para>This may be used to pull in smartcard management
966 daemons dynamically when smartcard hardware is found.</para>
967 </listitem>
968 </varlistentry>
969 <varlistentry>
970 <term><filename>sound.target</filename></term>
971 <listitem>
972 <para>This target is started automatically as soon as a
973 sound card is plugged in or becomes available at
974 boot.</para>
975
976 <para>This may be used to pull in audio management daemons
977 dynamically when audio hardware is found.</para>
978 </listitem>
979 </varlistentry>
980 <varlistentry>
981 <term><filename>usb-gadget.target</filename></term>
982 <listitem>
983 <para>This target is started automatically as soon as a
984 USB Device Controller becomes available at boot.</para>
985
986 <para>This may be used to pull in usb gadget
987 dynamically when UDC hardware is found.</para>
988
989 <xi:include href="version-info.xml" xpointer="v242"/>
990 </listitem>
991 </varlistentry>
992 <varlistentry>
993 <term><filename>tpm2.target</filename></term>
994 <listitem>
995 <para>This target is started automatically if a TPM2 device is discovered, either by the OS or by
996 the firmware. It acts as synchronization point for services that require TPM2 device access. The
997 target unit is enqueued by
998 <citerefentry><refentrytitle>systemd-tpm2-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>
999 if it detects that the firmware has discovered a TPM2 device but the OS kernel has not activated
1000 a driver for it yet. It is also pulled in whenever
1001 <citerefentry><refentrytitle>systemd-udevd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
1002 discovers a TPM2 device. The target unit is ordered after the <filename>/dev/tpmrm0</filename>
1003 device node, so that it only becomes active once the TPM2 device is actually accessible. Early
1004 boot programs that intend to access the TPM2 device should hence order themselves after this
1005 target unit, but not pull it in.</para>
1006
1007 <xi:include href="version-info.xml" xpointer="v256"/>
1008 </listitem>
1009 </varlistentry>
1010 </variablelist>
1011 </refsect2>
1012
1013 <refsect2>
1014 <title>Special Passive System Units </title>
1015
1016 <para>A number of special system targets are defined that can be
1017 used to properly order boot-up of optional services. These targets
1018 are generally not part of the initial boot transaction, unless
1019 they are explicitly pulled in by one of the implementing services.
1020 Note specifically that these <emphasis>passive</emphasis> target
1021 units are generally not pulled in by the consumer of a service,
1022 but by the provider of the service. This means: a consuming
1023 service should order itself after these targets (as appropriate),
1024 but not pull it in. A providing service should order itself before
1025 these targets (as appropriate) and pull it in (via a
1026 <varname>Wants=</varname> type dependency).</para>
1027
1028 <para>Note that these passive units cannot be started manually,
1029 i.e. <literal>systemctl start time-sync.target</literal> will fail
1030 with an error. They can only be pulled in by dependency. This is
1031 enforced since they exist for ordering purposes only and thus are
1032 not useful as only unit within a transaction.</para>
1033
1034 <variablelist>
1035 <varlistentry>
1036 <term><filename>[email protected]</filename></term>
1037 <listitem><para>This template unit is used to order mount units and other consumers of block
1038 devices after services that synthesize these block devices. In particular, this is intended to be
1039 used with storage services (such as
1040 <citerefentry><refentrytitle>[email protected]</refentrytitle><manvolnum>5</manvolnum></citerefentry>/
1041 <citerefentry><refentrytitle>[email protected]</refentrytitle><manvolnum>8</manvolnum></citerefentry>)
1042 that allocate and manage a virtual block device. Storage services are ordered before an instance of
1043 <filename>[email protected]</filename>, and the consumer units after it. The ordering is
1044 particularly relevant during shutdown, as it ensures that the mount is deactivated first and the
1045 service backing the mount later. The <filename>[email protected]</filename> instance should be
1046 pulled in via a <option>Wants=</option> dependency of the storage daemon and thus generally not be
1047 part of any transaction unless a storage daemon is used. The instance name for instances of this
1048 template unit must be a properly escaped block device node path, e.g.
1049 <filename index="false">[email protected]</filename> for the storage device
1050 <filename index="false">/dev/mapper/foobar</filename>.</para>
1051
1052 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
1053 </varlistentry>
1054 <varlistentry>
1055 <term><filename>cryptsetup-pre.target</filename></term>
1056 <listitem>
1057 <para>This passive target unit may be pulled in by services
1058 that want to run before any encrypted block device is set
1059 up. All encrypted block devices are set up after this target
1060 has been reached. Since the shutdown order is implicitly the
1061 reverse start-up order between units, this target is
1062 particularly useful to ensure that a service is shut down
1063 only after all encrypted block devices are fully
1064 stopped.</para>
1065
1066 <xi:include href="version-info.xml" xpointer="v215"/>
1067 </listitem>
1068 </varlistentry>
1069 <varlistentry>
1070 <term><filename>veritysetup-pre.target</filename></term>
1071 <listitem>
1072 <para>This passive target unit may be pulled in by services
1073 that want to run before any verity integrity protected block
1074 device is set up. All verity integrity protected block
1075 devices are set up after this target has been reached. Since
1076 the shutdown order is implicitly the reverse start-up order
1077 between units, this target is particularly useful to ensure
1078 that a service is shut down only after all verity integrity
1079 protected block devices are fully stopped.</para>
1080
1081 <xi:include href="version-info.xml" xpointer="v248"/>
1082 </listitem>
1083 </varlistentry>
1084 <varlistentry>
1085 <term><filename>first-boot-complete.target</filename></term>
1086 <listitem>
1087 <para>This passive target is intended as a synchronization point for units that need to run once
1088 during the first boot. Only after all units ordered before this target have finished, will the
1089 <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry>
1090 be committed to disk, marking the first boot as completed. If the boot is aborted at any time
1091 before that, the next boot will re-run any units with <varname>ConditionFirstBoot=yes</varname>.
1092 </para>
1093
1094 <xi:include href="version-info.xml" xpointer="v247"/>
1095 </listitem>
1096 </varlistentry>
1097 <varlistentry>
1098 <term><filename>getty-pre.target</filename></term>
1099 <listitem>
1100 <para>A special passive target unit. Users of this target
1101 are expected to pull it in the boot transaction via
1102 a dependency (e.g. <varname>Wants=</varname>). Order your
1103 unit before this unit if you want to make use of the console
1104 just before <filename>getty</filename> is started.
1105 </para>
1106
1107 <xi:include href="version-info.xml" xpointer="v235"/>
1108 </listitem>
1109 </varlistentry>
1110 <varlistentry>
1111 <term><filename>imports-pre.target</filename></term>
1112 <listitem>
1113 <para>A passive unit that is ordered before all disk image download jobs to execute on system
1114 boot. This is used by
1115 <citerefentry><refentrytitle>systemd-import-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
1116
1117 <xi:include href="version-info.xml" xpointer="v258"/>
1118 </listitem>
1119 </varlistentry>
1120 <varlistentry>
1121 <term><filename>local-fs-pre.target</filename></term>
1122 <listitem>
1123 <para>This target unit is
1124 automatically ordered before
1125 all local mount points marked
1126 with <option>auto</option>
1127 (see above). It can be used to
1128 execute certain units before
1129 all local mounts.</para>
1130 </listitem>
1131 </varlistentry>
1132 <varlistentry>
1133 <term><filename>network.target</filename></term>
1134 <listitem>
1135 <para>This unit is supposed to indicate when network functionality is available, but it is only
1136 very weakly defined what that is supposed to mean. However, the following should apply at
1137 minimum:</para>
1138
1139 <itemizedlist>
1140 <listitem><para>At start-up, any configured synthetic network devices (i.e. not physical ones
1141 that require hardware to show up and be probed, but virtual ones like bridge devices and
1142 similar which are created programmatically) that do not depend on any underlying hardware
1143 should be allocated by the time this target is reached. It is not necessary for these
1144 interfaces to also have completed IP level configuration by the time
1145 <filename>network.target</filename> is reached.</para></listitem>
1146
1147 <listitem><para>At shutdown, a unit that is ordered after <filename>network.target</filename>
1148 will be stopped before the network — to whatever level it might be set up by then — is shut
1149 down. It is hence useful when writing service files that require network access on shutdown,
1150 which should order themselves after this target, but not pull it in. Also see <ulink
1151 url="https://systemd.io/NETWORK_ONLINE">Running Services After the Network Is Up</ulink> for
1152 more information.</para></listitem>
1153 </itemizedlist>
1154
1155 <para>It must emphasized that at start-up there's no guarantee that hardware-based devices have
1156 shown up by the time this target is reached, or even acquired complete IP configuration. For that
1157 purpose use <filename>network-online.target</filename> as described above.</para>
1158 </listitem>
1159 </varlistentry>
1160 <varlistentry>
1161 <term><filename>network-pre.target</filename></term>
1162 <listitem>
1163 <para>This passive target unit may be pulled in by services that want to run before any network
1164 is set up, for example for the purpose of setting up a firewall. All network management software
1165 orders itself after this target, but does not pull it in. Also see <ulink
1166 url="https://systemd.io/NETWORK_ONLINE">Running Services After the Network Is Up</ulink> for more
1167 information.</para>
1168
1169 <xi:include href="version-info.xml" xpointer="v214"/>
1170 </listitem>
1171 </varlistentry>
1172 <varlistentry>
1173 <term><filename>nss-lookup.target</filename></term>
1174 <listitem>
1175 <para>A target that should be used as synchronization point for all host/network name
1176 service lookups. Note that this is independent of UNIX user/group name lookups for which
1177 <filename>nss-user-lookup.target</filename> should be used. All services for which the
1178 availability of full host/network name resolution is essential should be ordered after
1179 this target, but not pull it in.</para>
1180 </listitem>
1181 </varlistentry>
1182 <varlistentry>
1183 <term><filename>nss-user-lookup.target</filename></term>
1184 <listitem>
1185 <para>A target that should be used as synchronization point for all regular UNIX
1186 user/group name service lookups. Note that this is independent of host/network name
1187 lookups for which <filename>nss-lookup.target</filename> should be used. All services
1188 for which the availability of the full user/group database is essential should be
1189 ordered after this target, but not pull it in. All services which provide parts of the
1190 user/group database should be ordered before this target, and pull it in. Note that this
1191 unit is only relevant for regular users and groups — system users and groups are
1192 required to be resolvable during earliest boot already, and hence do not need any
1193 special ordering against this target.</para>
1194 </listitem>
1195 </varlistentry>
1196 <varlistentry>
1197 <term><filename>remote-fs-pre.target</filename></term>
1198 <listitem>
1199 <para>This target unit is automatically ordered before all
1200 mount point units (see above) and cryptsetup/veritysetup devices
1201 marked with the <option>_netdev</option>. It can be used to run
1202 certain units before remote encrypted devices and mounts are established.
1203 Note that this unit is generally not part of the initial
1204 transaction, unless the unit that wants to be ordered before
1205 all remote mounts pulls it in via a
1206 <varname>Wants=</varname> type dependency. If the unit wants
1207 to be pulled in by the first remote mount showing up, it
1208 should use <filename>network-online.target</filename> (see
1209 above).</para>
1210 </listitem>
1211 </varlistentry>
1212 <varlistentry>
1213 <term><filename>rpcbind.target</filename></term>
1214 <listitem>
1215 <para>The portmapper/rpcbind pulls in this target and orders
1216 itself before it, to indicate its availability.</para>
1217 </listitem>
1218 </varlistentry>
1219 <varlistentry>
1220 <term><filename>ssh-access.target</filename></term>
1221 <listitem>
1222 <para>Service and socket units that provide remote SSH secure shell access to the local system
1223 should pull in this unit and order themselves before this unit. It's supposed to act as a
1224 milestone indicating if and when SSH access into the system is available. It should only become
1225 active when an SSH port is bound for remote clients (i.e. if SSH is used as a local privilege
1226 escalation mechanism, it should <emphasis>not</emphasis> involve this target unit), regardless of
1227 the protocol choices, i.e. regardless of whether IPv4, IPv6 or <constant>AF_VSOCK</constant> is
1228 used.</para>
1229 <xi:include href="version-info.xml" xpointer="v256"/>
1230 </listitem>
1231 </varlistentry>
1232 <varlistentry>
1233 <term><filename>time-set.target</filename></term>
1234 <listitem>
1235 <para>Services responsible for setting the system clock (<constant>CLOCK_REALTIME</constant>)
1236 from a local source (such as a maintained timestamp file or imprecise real-time clock) should
1237 pull in this target and order themselves before it. Services where approximate, roughly monotonic
1238 time is desired should be ordered after this unit, but not pull it in.</para>
1239
1240 <para>This target does not provide the accuracy guarantees of
1241 <filename>time-sync.target</filename> (see below), however does not depend on remote clock
1242 sources to be reachable, i.e. the target is typically not delayed by network problems and
1243 similar. Use of this target is recommended for services where approximate clock accuracy and
1244 rough monotonicity is desired but activation shall not be delayed for possibly unreliable network
1245 communication.</para>
1246
1247 <para>The service manager automatically adds dependencies of type <varname>After=</varname> for
1248 this target unit to all timer units with at least one <varname>OnCalendar=</varname>
1249 directive.</para>
1250
1251 <para>The
1252 <citerefentry><refentrytitle>systemd-timesyncd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
1253 service is a simple daemon that pulls in this target and orders itself before it. Besides
1254 implementing the SNTP network protocol it maintains a timestamp file on disk whose modification
1255 time is regularly updated. At service start-up the local system clock is set from that modification time,
1256 ensuring it increases roughly monotonically.</para>
1257
1258 <para>Note that ordering a unit after <filename>time-set.target</filename> only has effect if
1259 there's actually a service ordered before it that delays it until the clock is adjusted for rough
1260 monotonicity. Otherwise, this target might get reached before the clock is adjusted to be roughly
1261 monotonic. Enable
1262 <citerefentry><refentrytitle>systemd-timesyncd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
1263 or an alternative NTP implementation to delay the target.</para>
1264
1265 <xi:include href="version-info.xml" xpointer="v242"/>
1266 </listitem>
1267 </varlistentry>
1268 <varlistentry>
1269 <term><filename>time-sync.target</filename></term>
1270 <listitem>
1271 <para>Services indicating completed synchronization of the system clock
1272 (<constant>CLOCK_REALTIME</constant>) to a remote source should pull in this target and order
1273 themselves before it. Services where accurate time is essential should be ordered after this
1274 unit, but not pull it in.</para>
1275
1276 <para>The service manager automatically adds dependencies of type <varname>After=</varname> for
1277 this target unit to all timer units with at least one <varname>OnCalendar=</varname> directive.</para>
1278
1279 <para>This target provides stricter clock accuracy guarantees than
1280 <filename>time-set.target</filename> (see above), but likely requires
1281 network communication and thus introduces unpredictable delays.
1282 Services that require clock accuracy and where network
1283 communication delays are acceptable should use this target. Services that require a less accurate
1284 clock, and only approximate and roughly monotonic clock behaviour should use
1285 <filename>time-set.target</filename> instead.</para>
1286
1287 <para>Note that ordering a unit after <filename>time-sync.target</filename> only has effect if
1288 there's actually a service ordered before it that delays it until clock synchronization is
1289 reached. Otherwise, this target might get reached before the clock is synchronized to any remote
1290 accurate reference clock. When using
1291 <citerefentry><refentrytitle>systemd-timesyncd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
1292 enable
1293 <citerefentry><refentrytitle>systemd-time-wait-sync.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
1294 to delay the target; or use an equivalent service for other NTP implementations.</para>
1295
1296 <table>
1297 <title>Comparison</title>
1298 <tgroup cols='2' align='left' colsep='1' rowsep='1'>
1299 <colspec colname="time-set" />
1300 <colspec colname="time-sync" />
1301 <thead>
1302 <row>
1303 <entry><filename>time-set.target</filename></entry>
1304 <entry><filename>time-sync.target</filename></entry>
1305 </row>
1306 </thead>
1307 <tbody>
1308 <row>
1309 <entry>"quick" to reach</entry>
1310 <entry>"slow" to reach</entry>
1311 </row>
1312 <row>
1313 <entry>typically uses local clock sources, boot process not affected by availability of external resources</entry>
1314 <entry>typically uses remote clock sources, inserts dependencies on remote resources into boot process</entry>
1315 </row>
1316 <row>
1317 <entry>reliable, because local</entry>
1318 <entry>unreliable, because typically network involved</entry>
1319 </row>
1320 <row>
1321 <entry>typically guarantees an approximate and roughly monotonic clock only</entry>
1322 <entry>typically guarantees an accurate clock</entry>
1323 </row>
1324 <row>
1325 <entry>implemented by <filename>systemd-timesyncd.service</filename></entry>
1326 <entry>implemented by <filename>systemd-time-wait-sync.service</filename></entry>
1327 </row>
1328 </tbody>
1329 </tgroup>
1330 </table>
1331
1332 </listitem>
1333 </varlistentry>
1334 </variablelist>
1335 </refsect2>
1336
1337 <refsect2>
1338 <title>Special Slice Units</title>
1339
1340 <para>There are four <literal>.slice</literal> units which form the basis of the hierarchy for
1341 assignment of resources for services, users, and virtual machines or containers. See
1342 <citerefentry><refentrytitle>systemd.slice</refentrytitle><manvolnum>5</manvolnum></citerefentry>
1343 for details about slice units.</para>
1344
1345 <variablelist>
1346 <varlistentry>
1347 <term><filename>-.slice</filename></term>
1348 <listitem>
1349 <para>The root slice is the root of the slice hierarchy. It usually does not contain units
1350 directly, but may be used to set defaults for the whole tree.</para>
1351
1352 <xi:include href="version-info.xml" xpointer="v206"/>
1353 </listitem>
1354 </varlistentry>
1355
1356 <varlistentry>
1357 <term><filename>machine.slice</filename></term>
1358 <listitem>
1359 <para>By default, all virtual machines and containers registered with
1360 <command>systemd-machined</command> are found in this slice. This is pulled in by
1361 <filename>systemd-machined.service</filename>.</para>
1362
1363 <xi:include href="version-info.xml" xpointer="v206"/>
1364 </listitem>
1365 </varlistentry>
1366
1367 <varlistentry>
1368 <term><filename>capsule.slice</filename></term>
1369 <listitem>
1370 <para>By default, all capsules encapsulated in <filename>[email protected]</filename> are found in
1371 this slice.</para>
1372
1373 <xi:include href="version-info.xml" xpointer="v255"/>
1374 </listitem>
1375 </varlistentry>
1376
1377 <varlistentry>
1378 <term><filename>system.slice</filename></term>
1379 <listitem>
1380 <para>By default, all system services started by <command>systemd</command> are found in this
1381 slice.</para>
1382
1383 <xi:include href="version-info.xml" xpointer="v206"/>
1384 </listitem>
1385 </varlistentry>
1386
1387 <varlistentry>
1388 <term><filename>user.slice</filename></term>
1389 <listitem>
1390 <para>By default, all user processes and services started on
1391 behalf of the user, including the per-user systemd instance
1392 are found in this slice. This is pulled in by
1393 <filename>systemd-logind.service</filename>.</para>
1394
1395 <xi:include href="version-info.xml" xpointer="v206"/>
1396 </listitem>
1397 </varlistentry>
1398
1399 </variablelist>
1400 </refsect2>
1401 </refsect1>
1402
1403 <refsect1>
1404 <title>Units managed by the user service manager</title>
1405
1406 <refsect2>
1407 <title>Special User Units</title>
1408
1409 <para>When systemd runs as a user instance, the following special
1410 units are available:</para>
1411
1412 <variablelist>
1413 <varlistentry>
1414 <term><filename>default.target</filename></term>
1415 <listitem>
1416 <para>This is the main target of the user service manager, started by default when the service
1417 manager is invoked. Various services that compose the normal user session should be pulled into
1418 this target. In this regard, <filename>default.target</filename> is similar to
1419 <filename>multi-user.target</filename> in the system instance, but it is a real unit, not an
1420 alias.</para>
1421
1422 <xi:include href="version-info.xml" xpointer="v242"/>
1423 </listitem>
1424 </varlistentry>
1425 </variablelist>
1426
1427 <variablelist>
1428 <varlistentry>
1429 <term><filename>[email protected]</filename></term>
1430 <listitem>
1431 <para>This is the main target of capsule service managers, started by default, instantiated with
1432 the capsule name. This may be used to define different sets of units that are started for
1433 different capsules via generic unit definitions. For details about capsules see
1434 <citerefentry><refentrytitle>[email protected]</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
1435
1436 <xi:include href="version-info.xml" xpointer="v255"/>
1437 </listitem>
1438 </varlistentry>
1439 </variablelist>
1440
1441 <para>In addition, the following units are available which have definitions similar to their
1442 system counterparts:
1443 <filename>exit.target</filename>,
1444 <filename>shutdown.target</filename>,
1445 <filename>sockets.target</filename>,
1446 <filename>timers.target</filename>,
1447 <filename>paths.target</filename>,
1448 <filename>bluetooth.target</filename>,
1449 <filename>printer.target</filename>,
1450 <filename>smartcard.target</filename>,
1451 <filename>sound.target</filename>.</para>
1452 </refsect2>
1453
1454 <refsect2>
1455 <title>Special Passive User Units</title>
1456
1457 <variablelist>
1458 <varlistentry>
1459 <term><filename>graphical-session.target</filename></term>
1460 <listitem>
1461 <para>This target is active whenever any graphical session is running. It is used to
1462 stop user services which only apply to a graphical (X, Wayland, etc.) session when the
1463 session is terminated. Such services should have
1464 <literal>PartOf=graphical-session.target</literal> in their [Unit]
1465 section. A target for a particular session (e. g.
1466 <filename>gnome-session.target</filename>) starts and stops
1467 <literal>graphical-session.target</literal> with
1468 <literal>BindsTo=graphical-session.target</literal>.</para>
1469
1470 <para>Which services are started by a session target is determined by the
1471 <literal>Wants=</literal> and <literal>Requires=</literal> dependencies. For services
1472 that can be enabled independently, symlinks in <literal>.wants/</literal> and
1473 <literal>.requires/</literal> should be used, see
1474 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
1475 Those symlinks should either be shipped in packages, or should be added dynamically
1476 after installation, for example using <literal>systemctl add-wants</literal>, see
1477 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
1478 </para>
1479
1480 <example>
1481 <title>Nautilus as part of a GNOME session</title>
1482
1483 <para><literal>gnome-session.target</literal> pulls in Nautilus as top-level service:</para>
1484
1485 <programlisting>[Unit]
1486 Description=User systemd services for GNOME graphical session
1487 Wants=nautilus.service
1488 BindsTo=graphical-session.target</programlisting>
1489
1490 <para><literal>nautilus.service</literal> gets stopped when the session stops:</para>
1491
1492 <programlisting>[Unit]
1493 Description=Render the desktop icons with Nautilus
1494 PartOf=graphical-session.target
1495
1496 [Service]
1497 …</programlisting>
1498 </example>
1499
1500 <xi:include href="version-info.xml" xpointer="v234"/>
1501 </listitem>
1502 </varlistentry>
1503
1504 <varlistentry>
1505 <term><filename>graphical-session-pre.target</filename></term>
1506 <listitem>
1507 <para>This target contains services which set up the environment or global configuration
1508 of a graphical session, such as SSH/GPG agents (which need to export an environment
1509 variable into all desktop processes) or migration of obsolete d-conf keys after an OS
1510 upgrade (which needs to happen before starting any process that might use them). This
1511 target must be started before starting a graphical session like
1512 <filename>gnome-session.target</filename>.</para>
1513
1514 <xi:include href="version-info.xml" xpointer="v234"/>
1515 </listitem>
1516 </varlistentry>
1517
1518 <varlistentry>
1519 <term><filename>xdg-desktop-autostart.target</filename></term>
1520 <listitem>
1521 <para>The XDG specification defines a way to autostart applications using XDG desktop files.
1522 systemd ships
1523 <citerefentry><refentrytitle>systemd-xdg-autostart-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>
1524 for the XDG desktop files in autostart directories. Desktop Environments can opt-in to use this
1525 service by adding a <varname>Wants=</varname> dependency on
1526 <filename>xdg-desktop-autostart.target</filename>.</para>
1527
1528 <xi:include href="version-info.xml" xpointer="v246"/>
1529 </listitem>
1530 </varlistentry>
1531 </variablelist>
1532 </refsect2>
1533
1534 <refsect2>
1535 <title>Special User Slice Units</title>
1536
1537 <para>There are four <literal>.slice</literal> units which form the basis of the user hierarchy for
1538 assignment of resources for user applications and services. See
1539 <citerefentry><refentrytitle>systemd.slice</refentrytitle><manvolnum>5</manvolnum></citerefentry>
1540 for details about slice units and the documentation about
1541 <ulink url="https://systemd.io/DESKTOP_ENVIRONMENTS">Desktop Environments</ulink>
1542 for further information.</para>
1543
1544 <variablelist>
1545 <varlistentry>
1546 <term><filename>-.slice</filename></term>
1547 <listitem>
1548 <para>The root slice is the root of the user's slice hierarchy.
1549 It usually does not contain units directly, but may be used to set defaults for the whole tree.</para>
1550
1551 <xi:include href="version-info.xml" xpointer="v247"/>
1552 </listitem>
1553 </varlistentry>
1554
1555 <varlistentry>
1556 <term><filename>app.slice</filename></term>
1557 <listitem>
1558 <para>By default, all user services and applications managed by
1559 <command>systemd</command> are found in this slice.
1560 All interactively launched applications like web browsers and text editors
1561 as well as non-critical services should be placed into this slice.</para>
1562
1563 <xi:include href="version-info.xml" xpointer="v247"/>
1564 </listitem>
1565 </varlistentry>
1566
1567 <varlistentry>
1568 <term><filename>session.slice</filename></term>
1569 <listitem>
1570 <para>All essential services and applications required for the
1571 session should use this slice.
1572 These are services that either cannot be restarted easily
1573 or where latency issues may affect the interactivity of the system and applications.
1574 This includes the display server, screen readers and other services such as DBus or XDG portals.
1575 Such services should be configured to be part of this slice by
1576 adding <varname>Slice=session.slice</varname> to their unit files.</para>
1577
1578 <xi:include href="version-info.xml" xpointer="v247"/>
1579 </listitem>
1580 </varlistentry>
1581
1582 <varlistentry>
1583 <term><filename>background.slice</filename></term>
1584 <listitem>
1585 <para>All services running low-priority background tasks should use this slice.
1586 This permits resources to be preferentially assigned to the other slices.
1587 Examples include non-interactive tasks like file indexing or backup operations
1588 where latency is not important.</para>
1589
1590 <xi:include href="version-info.xml" xpointer="v247"/>
1591 </listitem>
1592 </varlistentry>
1593 </variablelist>
1594 </refsect2>
1595 </refsect1>
1596
1597 <refsect1>
1598 <title>See Also</title>
1599 <para><simplelist type="inline">
1600 <member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
1601 <member><citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry></member>
1602 <member><citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry></member>
1603 <member><citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry></member>
1604 <member><citerefentry><refentrytitle>systemd.target</refentrytitle><manvolnum>5</manvolnum></citerefentry></member>
1605 <member><citerefentry><refentrytitle>systemd.slice</refentrytitle><manvolnum>5</manvolnum></citerefentry></member>
1606 <member><citerefentry><refentrytitle>bootup</refentrytitle><manvolnum>7</manvolnum></citerefentry></member>
1607 <member><citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
1608 <member><citerefentry><refentrytitle>[email protected]</refentrytitle><manvolnum>5</manvolnum></citerefentry></member>
1609 </simplelist></para>
1610 </refsect1>
1611
1612 </refentry>