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