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