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