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