]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd.special.xml
man: standarize on one-line license header
[thirdparty/systemd.git] / man / systemd.special.xml
CommitLineData
9f235308
LP
1<?xml version='1.0'?> <!--*-nxml-*-->
2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
12b42c76 3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
0307f791 4<!-- SPDX-License-Identifier: LGPL-2.1+ -->
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
ZJS
27 <filename>cryptsetup.target</filename>,
28 <filename>ctrl-alt-del.target</filename>,
82ea3825 29 <filename>boot-complete.target</filename>,
798d3a52 30 <filename>default.target</filename>,
798d3a52
ZJS
31 <filename>emergency.target</filename>,
32 <filename>exit.target</filename>,
33 <filename>final.target</filename>,
34 <filename>getty.target</filename>,
17590254 35 <filename>getty-pre.target</filename>,
798d3a52
ZJS
36 <filename>graphical.target</filename>,
37 <filename>halt.target</filename>,
38 <filename>hibernate.target</filename>,
39 <filename>hybrid-sleep.target</filename>,
e68c79db 40 <filename>suspend-then-hibernate.target</filename>,
798d3a52 41 <filename>initrd-fs.target</filename>,
2ba7627e
ZJS
42 <filename>initrd-root-device.target</filename>,
43 <filename>initrd-root-fs.target</filename>,
798d3a52
ZJS
44 <filename>kbrequest.target</filename>,
45 <filename>kexec.target</filename>,
798d3a52 46 <filename>local-fs-pre.target</filename>,
2ba7627e
ZJS
47 <filename>local-fs.target</filename>,
48 <filename>machines.target</filename>
798d3a52 49 <filename>multi-user.target</filename>,
798d3a52
ZJS
50 <filename>network-online.target</filename>,
51 <filename>network-pre.target</filename>,
2ba7627e 52 <filename>network.target</filename>,
798d3a52
ZJS
53 <filename>nss-lookup.target</filename>,
54 <filename>nss-user-lookup.target</filename>,
55 <filename>paths.target</filename>,
56 <filename>poweroff.target</filename>,
57 <filename>printer.target</filename>,
58 <filename>reboot.target</filename>,
889128b8 59 <filename>remote-cryptsetup.target</filename>,
798d3a52 60 <filename>remote-fs-pre.target</filename>,
2ba7627e 61 <filename>remote-fs.target</filename>,
798d3a52 62 <filename>rescue.target</filename>,
798d3a52
ZJS
63 <filename>rpcbind.target</filename>,
64 <filename>runlevel2.target</filename>,
65 <filename>runlevel3.target</filename>,
66 <filename>runlevel4.target</filename>,
67 <filename>runlevel5.target</filename>,
68 <filename>shutdown.target</filename>,
69 <filename>sigpwr.target</filename>,
70 <filename>sleep.target</filename>,
fccd4b67 71 <filename>slices.target</filename>,
798d3a52
ZJS
72 <filename>smartcard.target</filename>,
73 <filename>sockets.target</filename>,
74 <filename>sound.target</filename>,
75 <filename>suspend.target</filename>,
76 <filename>swap.target</filename>,
77 <filename>sysinit.target</filename>,
798d3a52 78 <filename>system-update.target</filename>,
c7668c1c 79 <filename>system-update-pre.target</filename>,
798d3a52
ZJS
80 <filename>time-sync.target</filename>,
81 <filename>timers.target</filename>,
82 <filename>umount.target</filename>,
2c633a82 83 <filename>usb-gadget.target</filename>,
1180181a 84 <!-- slices --><filename>-.slice</filename>,
798d3a52
ZJS
85 <filename>system.slice</filename>,
86 <filename>user.slice</filename>,
2ba7627e 87 <filename>machine.slice</filename>,
1c382774
LP
88 <!-- the rest --><filename>-.mount</filename>,
89 <filename>dbus.service</filename>,
2ba7627e
ZJS
90 <filename>dbus.socket</filename>,
91 <filename>display-manager.service</filename>,
1c382774 92 <filename>init.scope</filename>,
01a65d41 93 <filename>syslog.socket</filename>,
2ba7627e
ZJS
94 <filename>system-update-cleanup.service</filename>
95 </para></refsynopsisdiv>
798d3a52
ZJS
96
97 <refsect1>
98 <title>Description</title>
99
2ba7627e
ZJS
100 <para>A few units are treated specially by systemd. Many of them have
101 special internal semantics and cannot be renamed, while others simply
102 have a standard meaning and should be present on all systems.</para>
798d3a52
ZJS
103 </refsect1>
104
105 <refsect1>
96719f15
ZJS
106 <title>Units managed by the system's service manager</title>
107
108 <refsect2>
109 <title>Special System Units</title>
110
111 <variablelist>
112 <varlistentry>
113 <term><filename>-.mount</filename></term>
114 <listitem>
115 <para>The root mount point, i.e. the mount unit for the <filename>/</filename>
116 path. This unit is unconditionally active, during the entire time the system is up, as
117 this mount point is where the basic userspace is running from.</para>
118 </listitem>
119 </varlistentry>
120
121 <varlistentry>
122 <term><filename>basic.target</filename></term>
123 <listitem>
124 <para>A special target unit covering basic boot-up.</para>
125
126 <para>systemd automatically adds dependency of the type
127 <varname>After=</varname> for this target unit to all
128 services (except for those with
129 <varname>DefaultDependencies=no</varname>).</para>
130
131 <para>Usually, this should pull-in all local mount points plus
132 <filename>/var</filename>, <filename>/tmp</filename> and
133 <filename>/var/tmp</filename>, swap devices, sockets, timers,
134 path units and other basic initialization necessary for general
135 purpose daemons. The mentioned mount points are special cased
136 to allow them to be remote.
137 </para>
138
139 <para>This target usually does not pull in any non-target units
140 directly, but rather does so indirectly via other early boot targets.
141 It is instead meant as a synchronization point for late boot
142 services. Refer to
143 <citerefentry><refentrytitle>bootup</refentrytitle><manvolnum>7</manvolnum></citerefentry>
144 for details on the targets involved.
145 </para>
82ea3825
LP
146 </listitem>
147 </varlistentry>
148 <varlistentry>
149 <term><filename>boot-complete.target</filename></term>
150 <listitem>
151 <para>This target is intended as generic synchronization point for services that shall determine or act on
152 whether the boot process completed successfully. Order units that are required to succeed for a boot process
153 to be considered successful before this unit, and add a <varname>Requires=</varname> dependency from the
154 target unit to them. Order units that shall only run when the boot process is considered successful after the
155 target unit and pull in the target from it, also with <varname>Requires=</varname>. Note that by default this
156 target unit is not part of the initial boot transaction, but is supposed to be pulled in only if required by
157 units that want to run only on successful boots.</para>
158
159 <para>See
160 <citerefentry><refentrytitle>systemd-boot-check-no-failures.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
161 for a service that implements a generic system health check and orders itself before
162 <filename>boot-complete.target</filename>.</para>
163
164 <para>See
165 <citerefentry><refentrytitle>systemd-bless-boot.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
166 for a service that propagates boot success information to the boot loader, and orders itself after
167 <filename>boot-complete.target</filename>.</para>
96719f15
ZJS
168 </listitem>
169 </varlistentry>
170 <varlistentry>
171 <term><filename>ctrl-alt-del.target</filename></term>
172 <listitem>
173 <para>systemd starts this target whenever Control+Alt+Del is
174 pressed on the console. Usually, this should be aliased
175 (symlinked) to <filename>reboot.target</filename>.</para>
176 </listitem>
177 </varlistentry>
178 <varlistentry>
179 <term><filename>cryptsetup.target</filename></term>
180 <listitem>
181 <para>A target that pulls in setup services for all
182 encrypted block devices.</para>
183 </listitem>
184 </varlistentry>
185 <varlistentry>
186 <term><filename>dbus.service</filename></term>
187 <listitem>
188 <para>A special unit for the D-Bus bus daemon. As soon as
189 this service is fully started up systemd will connect to it
190 and register its service.</para>
191 </listitem>
192 </varlistentry>
193 <varlistentry>
194 <term><filename>dbus.socket</filename></term>
195 <listitem>
196 <para>A special unit for the D-Bus system bus socket. All
197 units with <varname>Type=dbus</varname> automatically gain a
198 dependency on this unit.</para>
199 </listitem>
200 </varlistentry>
201 <varlistentry>
202 <term><filename>default.target</filename></term>
203 <listitem>
204 <para>The default unit systemd starts at bootup. Usually,
205 this should be aliased (symlinked) to
206 <filename>multi-user.target</filename> or
207 <filename>graphical.target</filename>.</para>
208
209 <para>The default unit systemd starts at bootup can be
210 overridden with the <varname>systemd.unit=</varname> kernel
211 command line option.</para>
212 </listitem>
213 </varlistentry>
214 <varlistentry>
215 <term><filename>display-manager.service</filename></term>
216 <listitem>
217 <para>The display manager service. Usually, this should be
218 aliased (symlinked) to <filename>gdm.service</filename> or a
219 similar display manager service.</para>
220 </listitem>
221 </varlistentry>
222 <varlistentry>
223 <term><filename>emergency.target</filename></term>
224 <listitem>
225 <para>A special target unit that starts an emergency shell on the main console. This
226 target does not pull in any services or mounts. It is the most minimal version of
227 starting the system in order to acquire an interactive shell; the only processes running
228 are usually just the system manager (PID 1) and the shell process. This unit is supposed
229 to be used with the kernel command line option <varname>systemd.unit=</varname>; it is
230 also used when a file system check on a required file system fails, and boot-up cannot
231 continue. Compare with <filename>rescue.target</filename>, which serves a similar
232 purpose, but also starts the most basic services and mounts all file systems.</para>
233
234 <para>Use the <literal>systemd.unit=emergency.target</literal> kernel command line
235 option to boot into this mode. A short alias for this kernel command line option is
236 <literal>emergency</literal>, for compatibility with SysV.</para>
237
238 <para>In many ways booting into <filename>emergency.target</filename> is similar to the
239 effect of booting with <literal>init=/bin/sh</literal> on the kernel command line,
240 except that emergency mode provides you with the full system and service manager, and
241 allows starting individual units in order to continue the boot process in steps.</para>
242 </listitem>
243 </varlistentry>
244 <varlistentry>
245 <term><filename>exit.target</filename></term>
246 <listitem>
247 <para>A special service unit for shutting down the system or
248 user service manager. It is equivalent to
249 <filename>poweroff.target</filename> on non-container
250 systems, and also works in containers.</para>
251
252 <para>systemd will start this unit when it receives the
253 <constant>SIGTERM</constant> or <constant>SIGINT</constant>
254 signal when running as user service daemon.</para>
255
256 <para>Normally, this (indirectly) pulls in
257 <filename>shutdown.target</filename>, which in turn should be
258 conflicted by all units that want to be scheduled for
259 shutdown when the service manager starts to exit.</para>
260 </listitem>
261 </varlistentry>
262 <varlistentry>
263 <term><filename>final.target</filename></term>
264 <listitem>
265 <para>A special target unit that is used during the shutdown
266 logic and may be used to pull in late services after all
267 normal services are already terminated and all mounts
268 unmounted.
269 </para>
270 </listitem>
271 </varlistentry>
272 <varlistentry>
273 <term><filename>getty.target</filename></term>
274 <listitem>
275 <para>A special target unit that pulls in statically
276 configured local TTY <filename>getty</filename> instances.
277 </para>
278 </listitem>
279 </varlistentry>
280 <varlistentry>
281 <term><filename>graphical.target</filename></term>
282 <listitem>
283 <para>A special target unit for setting up a graphical login
284 screen. This pulls in
285 <filename>multi-user.target</filename>.</para>
286
287 <para>Units that are needed for graphical logins shall add
288 <varname>Wants=</varname> dependencies for their unit to
289 this unit (or <filename>multi-user.target</filename>) during
290 installation. This is best configured via
291 <varname>WantedBy=graphical.target</varname> in the unit's
292 <literal>[Install]</literal> section.</para>
293 </listitem>
294 </varlistentry>
295 <varlistentry>
296 <term><filename>hibernate.target</filename></term>
297 <listitem>
298 <para>A special target unit for hibernating the system. This
299 pulls in <filename>sleep.target</filename>.</para>
300 </listitem>
301 </varlistentry>
302 <varlistentry>
303 <term><filename>hybrid-sleep.target</filename></term>
304 <listitem>
305 <para>A special target unit for hibernating and suspending
306 the system at the same time. This pulls in
307 <filename>sleep.target</filename>.</para>
308 </listitem>
309 </varlistentry>
310 <varlistentry>
311 <term><filename>suspend-then-hibernate.target</filename></term>
312 <listitem>
313 <para>A special target unit for suspending the system for a period
314 of time, waking it and putting it into hibernate. This pulls in
315 <filename>sleep.target</filename>.</para>
316 </listitem>
317 </varlistentry>
318
319 <varlistentry>
320 <term><filename>halt.target</filename></term>
321 <listitem>
322 <para>A special target unit for shutting down and halting
323 the system. Note that this target is distinct from
324 <filename>poweroff.target</filename> in that it generally
325 really just halts the system rather than powering it
326 down.</para>
327
328 <para>Applications wanting to halt the system should not start this unit
329 directly, but should instead execute <command>systemctl halt</command>
330 (possibly with the <option>--no-block</option> option) or call
331 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>'s
332 <command>org.freedesktop.systemd1.Manager.Halt</command> D-Bus method
333 directly.</para>
334 </listitem>
335 </varlistentry>
336 <varlistentry>
337 <term><filename>init.scope</filename></term>
338 <listitem>
339 <para>This scope unit is where the system and service manager (PID 1) itself resides. It
340 is active as long as the system is running.</para>
341 </listitem>
342 </varlistentry>
343 <varlistentry>
344 <term><filename>initrd-fs.target</filename></term>
345 <listitem>
346 <para><citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>3</manvolnum></citerefentry>
347 automatically adds dependencies of type
348 <varname>Before=</varname> to
349 <filename>sysroot-usr.mount</filename> and all mount points
350 found in <filename>/etc/fstab</filename> that have
351 <option>x-initrd.mount</option> and not have
352 <option>noauto</option> mount options set.</para>
353 </listitem>
354 </varlistentry>
355 <varlistentry>
356 <term><filename>initrd-root-device.target</filename></term>
357 <listitem>
358 <para>A special initrd target unit that is reached when the root filesystem device is available, but before
359 it has been mounted.
360 <citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>3</manvolnum></citerefentry>
361 and
362 <citerefentry><refentrytitle>systemd-gpt-auto-generator</refentrytitle><manvolnum>3</manvolnum></citerefentry>
363 automatically setup the appropriate dependencies to make this happen.
364 </para>
365 </listitem>
366 </varlistentry>
367 <varlistentry>
368 <term><filename>initrd-root-fs.target</filename></term>
369 <listitem>
370 <para><citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>3</manvolnum></citerefentry>
371 automatically adds dependencies of type
372 <varname>Before=</varname> to the
373 <filename>sysroot.mount</filename> unit, which is generated
374 from the kernel command line.
375 </para>
376 </listitem>
377 </varlistentry>
378 <varlistentry>
379 <term><filename>kbrequest.target</filename></term>
380 <listitem>
381 <para>systemd starts this target whenever Alt+ArrowUp is
382 pressed on the console. Note that any user with physical access
383 to the machine will be able to do this, without authentication,
384 so this should be used carefully.</para>
385 </listitem>
386 </varlistentry>
387 <varlistentry>
388 <term><filename>kexec.target</filename></term>
389 <listitem>
390 <para>A special target unit for shutting down and rebooting
391 the system via kexec.</para>
392
393 <para>Applications wanting to reboot the system should not start this unit
394 directly, but should instead execute <command>systemctl kexec</command>
395 (possibly with the <option>--no-block</option> option) or call
396 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>'s
397 <command>org.freedesktop.systemd1.Manager.KExec</command> D-Bus method
398 directly.</para>
399 </listitem>
400 </varlistentry>
401 <varlistentry>
402 <term><filename>local-fs.target</filename></term>
403 <listitem>
404 <para><citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>3</manvolnum></citerefentry>
405 automatically adds dependencies of type
406 <varname>Before=</varname> to all mount units that refer to
407 local mount points for this target unit. In addition, it
408 adds dependencies of type <varname>Wants=</varname> to this
409 target unit for those mounts listed in
410 <filename>/etc/fstab</filename> that have the
411 <option>auto</option> mount option set.</para>
412 </listitem>
413 </varlistentry>
414 <varlistentry>
415 <term><filename>machines.target</filename></term>
416 <listitem>
417 <para>A standard target unit for starting all the containers
418 and other virtual machines. See <filename>systemd-nspawn@.service</filename>
419 for an example.</para>
420 </listitem>
421 </varlistentry>
422 <varlistentry>
423 <term><filename>multi-user.target</filename></term>
424 <listitem>
425 <para>A special target unit for setting up a multi-user
426 system (non-graphical). This is pulled in by
427 <filename>graphical.target</filename>.</para>
428
429 <para>Units that are needed for a multi-user system shall
430 add <varname>Wants=</varname> dependencies for their unit to
431 this unit during installation. This is best configured via
432 <varname>WantedBy=multi-user.target</varname> in the unit's
433 <literal>[Install]</literal> section.</para>
434 </listitem>
435 </varlistentry>
436 <varlistentry>
437 <term><filename>network-online.target</filename></term>
438 <listitem>
439 <para>Units that strictly require a configured network
440 connection should pull in
441 <filename>network-online.target</filename> (via a
442 <varname>Wants=</varname> type dependency) and order
443 themselves after it. This target unit is intended to pull in
444 a service that delays further execution until the network is
445 sufficiently set up. What precisely this requires is left to
446 the implementation of the network managing service.</para>
447
448 <para>Note the distinction between this unit and
449 <filename>network.target</filename>. This unit is an active
450 unit (i.e. pulled in by the consumer rather than the
451 provider of this functionality) and pulls in a service which
452 possibly adds substantial delays to further execution. In
453 contrast, <filename>network.target</filename> is a passive
454 unit (i.e. pulled in by the provider of the functionality,
455 rather than the consumer) that usually does not delay
456 execution much. Usually, <filename>network.target</filename>
457 is part of the boot of most systems, while
458 <filename>network-online.target</filename> is not, except
459 when at least one unit requires it. Also see <ulink
460 url="https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget">Running
461 Services After the Network is up</ulink> for more
462 information.</para>
463
464 <para>All mount units for remote network file systems
465 automatically pull in this unit, and order themselves after
466 it. Note that networking daemons that simply provide
467 functionality to other hosts generally do not need to pull
468 this in.</para>
469
470 <para>systemd automatically adds dependencies of type <varname>Wants=</varname> and
471 <varname>After=</varname> for this target unit to all SysV init script service units
472 with an LSB header referring to the <literal>$network</literal> facility.</para>
473
474 <para>Note that this unit is only useful during the original system start-up
475 logic. After the system has completed booting up, it will not track the online state of
476 the system anymore. Due to this it cannot be used as a network connection monitor
477 concept, it is purely a one-time system start-up concept.</para>
478 </listitem>
479 </varlistentry>
480 <varlistentry>
481 <term><filename>paths.target</filename></term>
482 <listitem>
483 <para>A special target unit that sets up all path units (see
484 <citerefentry><refentrytitle>systemd.path</refentrytitle><manvolnum>5</manvolnum></citerefentry>
485 for details) that shall be active after boot.</para>
486
487 <para>It is recommended that path units installed by
488 applications get pulled in via <varname>Wants=</varname>
489 dependencies from this unit. This is best configured via a
490 <varname>WantedBy=paths.target</varname> in the path unit's
491 <literal>[Install]</literal> section.</para>
492 </listitem>
493 </varlistentry>
494 <varlistentry>
495 <term><filename>poweroff.target</filename></term>
496 <listitem>
497 <para>A special target unit for shutting down and powering
498 off the system.</para>
499
500 <para>Applications wanting to power off the system should not start this unit
501 directly, but should instead execute <command>systemctl poweroff</command>
502 (possibly with the <option>--no-block</option> option) or call
503 <citerefentry><refentrytitle>systemd-logind</refentrytitle><manvolnum>8</manvolnum></citerefentry>'s
504 <command>org.freedesktop.login1.Manager.PowerOff</command> D-Bus method
505 directly.</para>
506
507 <para><filename>runlevel0.target</filename> is an alias for
508 this target unit, for compatibility with SysV.</para>
509 </listitem>
510 </varlistentry>
511 <varlistentry>
512 <term><filename>reboot.target</filename></term>
513 <listitem>
514 <para>A special target unit for shutting down and rebooting
515 the system.</para>
516
517 <para>Applications wanting to reboot the system should not start this unit
518 directly, but should instead execute <command>systemctl reboot</command>
519 (possibly with the <option>--no-block</option> option) or call
520 <citerefentry><refentrytitle>systemd-logind</refentrytitle><manvolnum>8</manvolnum></citerefentry>'s
521 <command>org.freedesktop.login1.Manager.Reboot</command> D-Bus method
522 directly.</para>
523
524 <para><filename>runlevel6.target</filename> is an alias for
525 this target unit, for compatibility with SysV.</para>
526 </listitem>
527 </varlistentry>
528 <varlistentry>
529 <term><filename>remote-cryptsetup.target</filename></term>
530 <listitem>
531 <para>Similar to <filename>cryptsetup.target</filename>, but for encrypted
532 devices which are accessed over the network. It is used for
533 <citerefentry><refentrytitle>crypttab</refentrytitle><manvolnum>8</manvolnum></citerefentry>
534 entries marked with <option>_netdev</option>.</para>
535 </listitem>
536 </varlistentry>
537 <varlistentry>
538 <term><filename>remote-fs.target</filename></term>
539 <listitem>
540 <para>Similar to <filename>local-fs.target</filename>, but
541 for remote mount points.</para>
542
543 <para>systemd automatically adds dependencies of type
544 <varname>After=</varname> for this target unit to all SysV
545 init script service units with an LSB header referring to
546 the <literal>$remote_fs</literal> facility.</para>
547 </listitem>
548 </varlistentry>
549 <varlistentry>
550 <term><filename>rescue.target</filename></term>
551 <listitem>
552 <para>A special target unit that pulls in the base system (including system mounts) and
553 spawns a rescue shell. Isolate to this target in order to administer the system in
554 single-user mode with all file systems mounted but with no services running, except for
555 the most basic. Compare with <filename>emergency.target</filename>, which is much more
556 reduced and does not provide the file systems or most basic services. Compare with
557 <filename>multi-user.target</filename>, this target could be seen as
558 <filename>single-user.target</filename>.</para>
559
560 <para><filename>runlevel1.target</filename> is an alias for this target unit, for
561 compatibility with SysV.</para>
562
563 <para>Use the <literal>systemd.unit=rescue.target</literal> kernel command line option
564 to boot into this mode. A short alias for this kernel command line option is
565 <literal>1</literal>, for compatibility with SysV.</para>
566 </listitem>
567 </varlistentry>
568 <varlistentry>
569 <term><filename>runlevel2.target</filename></term>
570 <term><filename>runlevel3.target</filename></term>
571 <term><filename>runlevel4.target</filename></term>
572 <term><filename>runlevel5.target</filename></term>
573 <listitem>
574 <para>These are targets that are called whenever the SysV
575 compatibility code asks for runlevel 2, 3, 4, 5,
576 respectively. It is a good idea to make this an alias for
577 (i.e. symlink to) <filename>graphical.target</filename>
578 (for runlevel 5) or <filename>multi-user.target</filename>
579 (the others).</para>
580 </listitem>
581 </varlistentry>
582 <varlistentry>
583 <term><filename>shutdown.target</filename></term>
584 <listitem>
585 <para>A special target unit that terminates the services on
586 system shutdown.</para>
587
588 <para>Services that shall be terminated on system shutdown
589 shall add <varname>Conflicts=</varname> and
590 <varname>Before=</varname> dependencies to this unit for
591 their service unit, which is implicitly done when
592 <varname>DefaultDependencies=yes</varname> is set (the
593 default).</para>
594 </listitem>
595 </varlistentry>
596 <varlistentry>
597 <term><filename>sigpwr.target</filename></term>
598 <listitem>
599 <para>A special target that is started when systemd receives
600 the SIGPWR process signal, which is normally sent by the
601 kernel or UPS daemons when power fails.</para>
602 </listitem>
603 </varlistentry>
604 <varlistentry>
605 <term><filename>sleep.target</filename></term>
606 <listitem>
607 <para>A special target unit that is pulled in by
608 <filename>suspend.target</filename>,
609 <filename>hibernate.target</filename> and
610 <filename>hybrid-sleep.target</filename> and may be used to
611 hook units into the sleep state logic.</para>
612 </listitem>
613 </varlistentry>
614 <varlistentry>
615 <term><filename>slices.target</filename></term>
616 <listitem>
617 <para>A special target unit that sets up all slice units (see
618 <citerefentry><refentrytitle>systemd.slice</refentrytitle><manvolnum>5</manvolnum></citerefentry>
4aabca00
ZJS
619 for details) that shall always be active after boot. By default the generic
620 <filename>system.slice</filename> slice unit as well as the root slice unit
621 <filename>-.slice</filename> are pulled in and ordered before this unit (see
96719f15
ZJS
622 below).</para>
623
4aabca00
ZJS
624 <para>Adding slice units to <filename>slices.target</filename> is generally not
625 necessary. Instead, when some unit that uses <varname>Slice=</varname> is started, the
626 specified slice will be started automatically. Adding
627 <varname>WantedBy=slices.target</varname> lines to the <literal>[Install]</literal>
628 section should only be done for units that need to be always active. In that case care
629 needs to be taken to avoid creating a loop through the automatic dependencies on
630 "parent" slices.</para>
96719f15
ZJS
631 </listitem>
632 </varlistentry>
633 <varlistentry>
634 <term><filename>sockets.target</filename></term>
635 <listitem>
636 <para>A special target unit that sets up all socket
637 units (see
638 <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>
639 for details) that shall be active after boot.</para>
640
641 <para>Services that can be socket-activated shall add
642 <varname>Wants=</varname> dependencies to this unit for
643 their socket unit during installation. This is best
644 configured via a <varname>WantedBy=sockets.target</varname>
645 in the socket unit's <literal>[Install]</literal>
646 section.</para>
647 </listitem>
648 </varlistentry>
649 <varlistentry>
650 <term><filename>suspend.target</filename></term>
651 <listitem>
652 <para>A special target unit for suspending the system. This
653 pulls in <filename>sleep.target</filename>.</para>
654 </listitem>
655 </varlistentry>
656 <varlistentry>
657 <term><filename>swap.target</filename></term>
658 <listitem>
659 <para>Similar to <filename>local-fs.target</filename>, but
660 for swap partitions and swap files.</para>
661 </listitem>
662 </varlistentry>
663 <varlistentry>
664 <term><filename>sysinit.target</filename></term>
665 <listitem>
666 <para>systemd automatically adds dependencies of the types
667 <varname>Requires=</varname> and <varname>After=</varname>
668 for this target unit to all services (except for those with
669 <varname>DefaultDependencies=no</varname>).</para>
670
671 <para>This target pulls in the services required for system
672 initialization. System services pulled in by this target should
673 declare <varname>DefaultDependencies=no</varname> and specify
674 all their dependencies manually, including access to anything
675 more than a read only root filesystem. For details on the
676 dependencies of this target, refer to
677 <citerefentry><refentrytitle>bootup</refentrytitle><manvolnum>7</manvolnum></citerefentry>.
678 </para>
679 </listitem>
680 </varlistentry>
681 <varlistentry>
682 <term><filename>syslog.socket</filename></term>
683 <listitem>
684 <para>The socket unit syslog implementations should listen
685 on. All userspace log messages will be made available on
686 this socket. For more information about syslog integration,
687 please consult the <ulink
688 url="https://www.freedesktop.org/wiki/Software/systemd/syslog">Syslog
689 Interface</ulink> document.</para>
690 </listitem>
691 </varlistentry>
692 <varlistentry>
693 <term><filename>system-update.target</filename></term>
694 <term><filename>system-update-pre.target</filename></term>
695 <term><filename>system-update-cleanup.service</filename></term>
696 <listitem>
697 <para>A special target unit that is used for offline system updates.
698 <citerefentry><refentrytitle>systemd-system-update-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>
699 will redirect the boot process to this target if <filename>/system-update</filename>
700 exists. For more information see
701 <citerefentry><refentrytitle>systemd.offline-updates</refentrytitle><manvolnum>7</manvolnum></citerefentry>.
702 </para>
703
704 <para>Updates should happen before the <filename>system-update.target</filename> is
705 reached, and the services which implement them should cause the machine to reboot. The
706 main units executing the update should order themselves after
707 <filename>system-update-pre.target</filename> but not pull it in. Services which want to
708 run during system updates only, but before the actual system update is executed should
709 order themselves before this unit and pull it in. As a safety measure, if this does not
710 happen, and <filename>/system-update</filename> still exists after
711 <filename>system-update.target</filename> is reached,
712 <filename>system-update-cleanup.service</filename> will remove this symlink and reboot
713 the machine.</para>
714 </listitem>
715 </varlistentry>
716 <varlistentry>
717 <term><filename>timers.target</filename></term>
718 <listitem>
719 <para>A special target unit that sets up all timer units
720 (see
721 <citerefentry><refentrytitle>systemd.timer</refentrytitle><manvolnum>5</manvolnum></citerefentry>
722 for details) that shall be active after boot.</para>
723
724 <para>It is recommended that timer units installed by
725 applications get pulled in via <varname>Wants=</varname>
726 dependencies from this unit. This is best configured via
727 <varname>WantedBy=timers.target</varname> in the timer
728 unit's <literal>[Install]</literal> section.</para>
729 </listitem>
730 </varlistentry>
731 <varlistentry>
732 <term><filename>umount.target</filename></term>
733 <listitem>
734 <para>A special target unit that unmounts all mount and
735 automount points on system shutdown.</para>
736
737 <para>Mounts that shall be unmounted on system shutdown
738 shall add Conflicts dependencies to this unit for their
739 mount unit, which is implicitly done when
740 <varname>DefaultDependencies=yes</varname> is set (the
741 default).</para>
742 </listitem>
743 </varlistentry>
798d3a52 744
96719f15
ZJS
745 </variablelist>
746 </refsect2>
798d3a52 747
96719f15
ZJS
748 <refsect2>
749 <title>Special System Units for Devices</title>
798d3a52 750
96719f15
ZJS
751 <para>Some target units are automatically pulled in as devices of
752 certain kinds show up in the system. These may be used to
753 automatically activate various services based on the specific type
754 of the available hardware.</para>
798d3a52 755
96719f15
ZJS
756 <variablelist>
757 <varlistentry>
758 <term><filename>bluetooth.target</filename></term>
759 <listitem>
760 <para>This target is started automatically as soon as a
761 Bluetooth controller is plugged in or becomes available at
762 boot.</para>
98d2d468 763
96719f15
ZJS
764 <para>This may be used to pull in Bluetooth management
765 daemons dynamically when Bluetooth hardware is found.</para>
766 </listitem>
767 </varlistentry>
768 <varlistentry>
769 <term><filename>printer.target</filename></term>
770 <listitem>
771 <para>This target is started automatically as soon as a
772 printer is plugged in or becomes available at boot.</para>
773
774 <para>This may be used to pull in printer management daemons
775 dynamically when printer hardware is found.</para>
776 </listitem>
777 </varlistentry>
778 <varlistentry>
779 <term><filename>smartcard.target</filename></term>
780 <listitem>
781 <para>This target is started automatically as soon as a
782 smartcard controller is plugged in or becomes available at
783 boot.</para>
784
785 <para>This may be used to pull in smartcard management
786 daemons dynamically when smartcard hardware is found.</para>
787 </listitem>
788 </varlistentry>
789 <varlistentry>
790 <term><filename>sound.target</filename></term>
791 <listitem>
792 <para>This target is started automatically as soon as a
793 sound card is plugged in or becomes available at
794 boot.</para>
795
796 <para>This may be used to pull in audio management daemons
797 dynamically when audio hardware is found.</para>
798 </listitem>
799 </varlistentry>
2c633a82
AP
800 <varlistentry>
801 <term><filename>usb-gadget.target</filename></term>
802 <listitem>
803 <para>This target is started automatically as soon as a
804 USB Device Controller becomes available at boot.</para>
805
806 <para>This may be used to pull in usb gadget
807 dynamically when UDC hardware is found.</para>
808 </listitem>
809 </varlistentry>
96719f15
ZJS
810 </variablelist>
811 </refsect2>
812
813 <refsect2>
814 <title>Special Passive System Units </title>
815
816 <para>A number of special system targets are defined that can be
817 used to properly order boot-up of optional services. These targets
818 are generally not part of the initial boot transaction, unless
819 they are explicitly pulled in by one of the implementing services.
820 Note specifically that these <emphasis>passive</emphasis> target
821 units are generally not pulled in by the consumer of a service,
822 but by the provider of the service. This means: a consuming
823 service should order itself after these targets (as appropriate),
824 but not pull it in. A providing service should order itself before
825 these targets (as appropriate) and pull it in (via a
826 <varname>Wants=</varname> type dependency).</para>
827
828 <para>Note that these passive units cannot be started manually,
829 i.e. <literal>systemctl start time-sync.target</literal> will fail
830 with an error. They can only be pulled in by dependency. This is
831 enforced since they exist for ordering purposes only and thus are
832 not useful as only unit within a transaction.</para>
833
834 <variablelist>
835 <varlistentry>
836 <term><filename>cryptsetup-pre.target</filename></term>
837 <listitem>
838 <para>This passive target unit may be pulled in by services
839 that want to run before any encrypted block device is set
840 up. All encrypted block devices are set up after this target
841 has been reached. Since the shutdown order is implicitly the
842 reverse start-up order between units, this target is
843 particularly useful to ensure that a service is shut down
844 only after all encrypted block devices are fully
845 stopped.</para>
846 </listitem>
847 </varlistentry>
848 <varlistentry>
849 <term><filename>getty-pre.target</filename></term>
850 <listitem>
851 <para>A special passive target unit. Users of this target
852 are expected to pull it in the boot transaction via
853 a dependency (e.g. <varname>Wants=</varname>). Order your
854 unit before this unit if you want to make use of the console
855 just before <filename>getty</filename> is started.
856 </para>
857 </listitem>
858 </varlistentry>
859 <varlistentry>
860 <term><filename>local-fs-pre.target</filename></term>
861 <listitem>
862 <para>This target unit is
863 automatically ordered before
864 all local mount points marked
865 with <option>auto</option>
866 (see above). It can be used to
867 execute certain units before
868 all local mounts.</para>
869 </listitem>
870 </varlistentry>
871 <varlistentry>
872 <term><filename>network.target</filename></term>
873 <listitem>
874 <para>This unit is supposed to indicate when network
875 functionality is available, but it is only very weakly
876 defined what that is supposed to mean, with one exception:
877 at shutdown, a unit that is ordered after
878 <filename>network.target</filename> will be stopped before
879 the network — to whatever level it might be set up then —
880 is shut down. It is hence useful when writing service files
881 that require network access on shutdown, which should order
882 themselves after this target, but not pull it in. Also see
883 <ulink url="https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget">Running
884 Services After the Network is up</ulink> for more
885 information. Also see
886 <filename>network-online.target</filename> described
887 above.</para>
888 </listitem>
889 </varlistentry>
890 <varlistentry>
891 <term><filename>network-pre.target</filename></term>
892 <listitem>
893 <para>This passive target unit may be pulled in by services
894 that want to run before any network is set up, for example
895 for the purpose of setting up a firewall. All network
896 management software orders itself after this target, but
897 does not pull it in.</para>
898 </listitem>
899 </varlistentry>
900 <varlistentry>
901 <term><filename>nss-lookup.target</filename></term>
902 <listitem>
903 <para>A target that should be used as synchronization point for all host/network name
904 service lookups. Note that this is independent of UNIX user/group name lookups for which
905 <filename>nss-user-lookup.target</filename> should be used. All services for which the
906 availability of full host/network name resolution is essential should be ordered after
907 this target, but not pull it in. systemd automatically adds dependencies of type
908 <varname>After=</varname> for this target unit to all SysV init script service units
909 with an LSB header referring to the <literal>$named</literal> facility.</para>
910 </listitem>
911 </varlistentry>
912 <varlistentry>
913 <term><filename>nss-user-lookup.target</filename></term>
914 <listitem>
915 <para>A target that should be used as synchronization point for all regular UNIX
916 user/group name service lookups. Note that this is independent of host/network name
917 lookups for which <filename>nss-lookup.target</filename> should be used. All services
918 for which the availability of the full user/group database is essential should be
919 ordered after this target, but not pull it in. All services which provide parts of the
920 user/group database should be ordered before this target, and pull it in. Note that this
921 unit is only relevant for regular users and groups — system users and groups are
922 required to be resolvable during earliest boot already, and hence do not need any
923 special ordering against this target.</para>
924 </listitem>
925 </varlistentry>
926 <varlistentry>
927 <term><filename>remote-fs-pre.target</filename></term>
928 <listitem>
929 <para>This target unit is automatically ordered before all
930 mount point units (see above) and cryptsetup devices
931 marked with the <option>_netdev</option>. It can be used to run
932 certain units before remote encrypted devices and mounts are established.
933 Note that this unit is generally not part of the initial
934 transaction, unless the unit that wants to be ordered before
935 all remote mounts pulls it in via a
936 <varname>Wants=</varname> type dependency. If the unit wants
937 to be pulled in by the first remote mount showing up, it
938 should use <filename>network-online.target</filename> (see
939 above).</para>
940 </listitem>
941 </varlistentry>
942 <varlistentry>
943 <term><filename>rpcbind.target</filename></term>
944 <listitem>
945 <para>The portmapper/rpcbind pulls in this target and orders
946 itself before it, to indicate its availability. systemd
947 automatically adds dependencies of type
948 <varname>After=</varname> for this target unit to all SysV
949 init script service units with an LSB header referring to
950 the <literal>$portmap</literal> facility.</para>
951 </listitem>
952 </varlistentry>
953 <varlistentry>
954 <term><filename>time-sync.target</filename></term>
955 <listitem>
956 <para>Services responsible for synchronizing the system
957 clock from a remote source (such as NTP client
958 implementations) should pull in this target and order
959 themselves before it. All services where correct time is
960 essential should be ordered after this unit, but not pull it
961 in. systemd automatically adds dependencies of type
962 <varname>After=</varname> for this target unit to all SysV
963 init script service units with an LSB header referring to
964 the <literal>$time</literal> facility. </para>
965 </listitem>
966 </varlistentry>
967 </variablelist>
968 </refsect2>
969
970 <refsect2>
971 <title>Special Slice Units</title>
972
973 <para>There are four <literal>.slice</literal> units which form the basis of the hierarchy for
974 assignment of resources for services, users, and virtual machines or containers. See
975 <citerefentry><refentrytitle>systemd.slice</refentrytitle><manvolnum>7</manvolnum></citerefentry>
976 for details about slice units.</para>
977
978 <variablelist>
979 <varlistentry>
980 <term><filename>-.slice</filename></term>
981 <listitem>
982 <para>The root slice is the root of the slice hierarchy. It usually does not contain
983 units directly, but may be used to set defaults for the whole tree.</para>
984 </listitem>
985 </varlistentry>
986
987 <varlistentry>
988 <term><filename>system.slice</filename></term>
989 <listitem>
990 <para>By default, all system services started by
991 <command>systemd</command> are found in this slice.</para>
992 </listitem>
993 </varlistentry>
994
995 <varlistentry>
996 <term><filename>user.slice</filename></term>
997 <listitem>
998 <para>By default, all user processes and services started on
999 behalf of the user, including the per-user systemd instance
1000 are found in this slice. This is pulled in by
1001 <filename>systemd-logind.service</filename></para>
1002 </listitem>
1003 </varlistentry>
1004
1005 <varlistentry>
1006 <term><filename>machine.slice</filename></term>
1007 <listitem>
1008 <para>By default, all virtual machines and containers
1009 registered with <command>systemd-machined</command> are
1010 found in this slice. This is pulled in by
1011 <filename>systemd-machined.service</filename></para>
1012 </listitem>
1013 </varlistentry>
1014 </variablelist>
1015 </refsect2>
c92fcc4f
MP
1016 </refsect1>
1017
798d3a52 1018 <refsect1>
96719f15
ZJS
1019 <title>Units managed by the user's service manager</title>
1020
1021 <refsect2>
1022 <title>Special User Units</title>
1023
1024 <para>When systemd runs as a user instance, the following special
1025 units are available, which have similar definitions as their
1026 system counterparts:
1027 <filename>exit.target</filename>,
1028 <filename>default.target</filename>,
1029 <filename>shutdown.target</filename>,
1030 <filename>sockets.target</filename>,
1031 <filename>timers.target</filename>,
1032 <filename>paths.target</filename>,
1033 <filename>bluetooth.target</filename>,
1034 <filename>printer.target</filename>,
1035 <filename>smartcard.target</filename>,
1036 <filename>sound.target</filename>.</para>
1037 </refsect2>
1038
1039 <refsect2>
1040 <title>Special Passive User Units</title>
1041
1042 <variablelist>
1043 <varlistentry>
1044 <term><filename>graphical-session.target</filename></term>
1045 <listitem>
1046 <para>This target is active whenever any graphical session is running. It is used to
1047 stop user services which only apply to a graphical (X, Wayland, etc.) session when the
1048 session is terminated. Such services should have
1049 <literal>PartOf=graphical-session.target</literal> in their <literal>[Unit]</literal>
1050 section. A target for a particular session (e. g.
1051 <filename>gnome-session.target</filename>) starts and stops
1052 <literal>graphical-session.target</literal> with
1053 <literal>BindsTo=graphical-session.target</literal>.</para>
1054
1055 <para>Which services are started by a session target is determined by the
1056 <literal>Wants=</literal> and <literal>Requires=</literal> dependencies. For services
1057 that can be enabled independently, symlinks in <literal>.wants/</literal> and
1058 <literal>.requires/</literal> should be used, see
1059 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
1060 Those symlinks should either be shipped in packages, or should be added dynamically
1061 after installation, for example using <literal>systemctl add-wants</literal>, see
1062 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
1063 </para>
1064
1065 <example>
1066 <title>Nautilus as part of a GNOME session</title>
1067
1068 <para><literal>gnome-session.target</literal> pulls in Nautilus as top-level service:</para>
1069
1070 <programlisting>[Unit]
1071 Description=User systemd services for GNOME graphical session
1072 Wants=nautilus.service
1073 BindsTo=graphical-session.target</programlisting>
1074
1075 <para><literal>nautilus.service</literal> gets stopped when the session stops:</para>
1076
1077 <programlisting>[Unit]
1078 Description=Render the desktop icons with Nautilus
1079 PartOf=graphical-session.target
1080
1081 [Service]
1082 …</programlisting>
1083 </example>
1084 </listitem>
1085 </varlistentry>
1086
1087 <varlistentry>
1088 <term><filename>graphical-session-pre.target</filename></term>
1089 <listitem>
1090 <para>This target contains services which set up the environment or global configuration
1091 of a graphical session, such as SSH/GPG agents (which need to export an environment
1092 variable into all desktop processes) or migration of obsolete d-conf keys after an OS
1093 upgrade (which needs to happen before starting any process that might use them). This
1094 target must be started before starting a graphical session like
1095 <filename>gnome-session.target</filename>.</para>
1096 </listitem>
1097 </varlistentry>
1098 </variablelist>
1099 </refsect2>
798d3a52
ZJS
1100 </refsect1>
1101
1102 <refsect1>
1103 <title>See Also</title>
1104 <para>
1105 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1106 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1107 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1108 <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1109 <citerefentry><refentrytitle>systemd.target</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1110 <citerefentry><refentrytitle>systemd.slice</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
213242a3 1111 <citerefentry><refentrytitle>bootup</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
a99655b0
ZJS
1112 <citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
1113 <citerefentry><refentrytitle>user@.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>
798d3a52
ZJS
1114 </para>
1115 </refsect1>
9f235308
LP
1116
1117</refentry>