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