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