"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<!--
+ SPDX-License-Identifier: LGPL-2.1+
+
This file is part of systemd.
Copyright 2010 Lennart Poettering
</refnamediv>
<refsynopsisdiv><para>
- <!-- sort alphabetically, targets first -->
- <filename>basic.target</filename>,
+ <!-- sort alphabetically, targets first --><filename>basic.target</filename>,
<filename>bluetooth.target</filename>,
<filename>cryptsetup-pre.target</filename>,
<filename>cryptsetup.target</filename>,
<filename>exit.target</filename>,
<filename>final.target</filename>,
<filename>getty.target</filename>,
+ <filename>getty-pre.target</filename>,
<filename>graphical.target</filename>,
<filename>halt.target</filename>,
<filename>hibernate.target</filename>,
<filename>poweroff.target</filename>,
<filename>printer.target</filename>,
<filename>reboot.target</filename>,
+ <filename>remote-cryptsetup.target</filename>,
<filename>remote-fs-pre.target</filename>,
<filename>remote-fs.target</filename>,
<filename>rescue.target</filename>,
<filename>suspend.target</filename>,
<filename>swap.target</filename>,
<filename>sysinit.target</filename>,
- <filename>syslog.socket</filename>,
<filename>system-update.target</filename>,
<filename>time-sync.target</filename>,
<filename>timers.target</filename>,
<filename>umount.target</filename>,
- <!-- slices -->
- <filename>-.slice</filename>,
+ <!-- slices --><filename>-.slice</filename>,
<filename>system.slice</filename>,
<filename>user.slice</filename>,
<filename>machine.slice</filename>,
- <!-- the rest -->
+ <!-- the rest --><filename>-.mount</filename>,
<filename>dbus.service</filename>,
<filename>dbus.socket</filename>,
<filename>display-manager.service</filename>,
+ <filename>init.scope</filename>,
+ <filename>syslog.socket</filename>,
<filename>system-update-cleanup.service</filename>
</para></refsynopsisdiv>
<title>Special System Units</title>
<variablelist>
+ <varlistentry>
+ <term><filename>-.mount</filename></term>
+ <listitem>
+ <para>The root mount point, i.e. the mount unit for the <filename>/</filename> path. This unit is
+ unconditionally active, during the entire time the system is up, as this mount point is where the basic
+ userspace is running from.</para>
+ </listitem>
+ </varlistentry>
+
<varlistentry>
<term><filename>basic.target</filename></term>
<listitem>
<filename>poweroff.target</filename> on non-container
systems, and also works in containers.</para>
- <para>systemd will start this unit when it receives a
- request to shut down over D-Bus or a
+ <para>systemd will start this unit when it receives the
<constant>SIGTERM</constant> or <constant>SIGINT</constant>
signal when running as user service daemon.</para>
</para>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><filename>getty-pre.target</filename></term>
+ <listitem>
+ <para>A special passive target unit. Users of this target
+ are expected to pull it in the boot transaction via
+ a dependency (e.g. <varname>Wants=</varname>). Order your
+ unit before this unit if you want to make use of the console
+ just before <filename>getty</filename> is started.
+ </para>
+ </listitem>
+ </varlistentry>
<varlistentry>
<term><filename>graphical.target</filename></term>
<listitem>
really just halts the system rather than powering it
down.</para>
- <para>Applications wanting to halt the system should start
- this unit.</para>
+ <para>Applications wanting to halt the system should not start this unit
+ directly, but should instead execute <command>systemctl halt</command>
+ (possibly with the <option>--no-block</option> option) or call
+ <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>'s
+ <command>org.freedesktop.systemd1.Manager.Halt</command> D-Bus method
+ directly.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><filename>init.scope</filename></term>
+ <listitem>
+ <para>This scope unit is where the system and service manager (PID 1) itself resides. It is active as long as
+ the system is running.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><filename>kbrequest.target</filename></term>
<listitem>
<para>systemd starts this target whenever Alt+ArrowUp is
- pressed on the console. This is a good candidate to be
- aliased (symlinked) to
- <filename>rescue.target</filename>.</para>
+ pressed on the console. Note that any user with physical access
+ to the machine will be able to do this, without authentication,
+ so this should be used carefully.</para>
</listitem>
</varlistentry>
<varlistentry>
<para>A special target unit for shutting down and rebooting
the system via kexec.</para>
- <para>Applications wanting to reboot the system with kexec
- should start this unit.</para>
+ <para>Applications wanting to reboot the system should not start this unit
+ directly, but should instead execute <command>systemctl kexec</command>
+ (possibly with the <option>--no-block</option> option) or call
+ <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>'s
+ <command>org.freedesktop.systemd1.Manager.KExec</command> D-Bus method
+ directly.</para>
</listitem>
</varlistentry>
<varlistentry>
it. Note that networking daemons that simply provide
functionality to other hosts generally do not need to pull
this in.</para>
+
+ <para>Note that this unit is only useful during the original system start-up logic. After the system has
+ completed booting up, it will not track the online state of the system anymore. Due to this it cannot be used
+ as a network connection monitor concept, it is purely a one-time system start-up concept.</para>
</listitem>
</varlistentry>
<varlistentry>
<para>A special target unit for shutting down and powering
off the system.</para>
- <para>Applications wanting to power off the system should
- start this unit.</para>
+ <para>Applications wanting to reboot the system should not start this unit
+ directly, but should instead execute <command>systemctl poweroff</command>
+ (possibly with the <option>--no-block</option> option) or call
+ <citerefentry><refentrytitle>systemd-logind</refentrytitle><manvolnum>8</manvolnum></citerefentry>'s
+ <command>org.freedesktop.login1.Manager.PowerOff</command> D-Bus method
+ directly.</para>
<para><filename>runlevel0.target</filename> is an alias for
this target unit, for compatibility with SysV.</para>
<para>A special target unit for shutting down and rebooting
the system.</para>
- <para>Applications wanting to reboot the system should start
- this unit.</para>
+ <para>Applications wanting to reboot the system should not start this unit
+ directly, but should instead execute <command>systemctl reboot</command>
+ (possibly with the <option>--no-block</option> option) or call
+ <citerefentry><refentrytitle>systemd-logind</refentrytitle><manvolnum>8</manvolnum></citerefentry>'s
+ <command>org.freedesktop.login1.Manager.Reboot</command> D-Bus method
+ directly.</para>
<para><filename>runlevel6.target</filename> is an alias for
this target unit, for compatibility with SysV.</para>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><filename>remote-cryptsetup.target</filename></term>
+ <listitem>
+ <para>Similar to <filename>cryptsetup.target</filename>, but for encrypted
+ devices which are accessed over the network. It is used for
+ <citerefentry><refentrytitle>crypttab</refentrytitle><manvolnum>8</manvolnum></citerefentry>
+ entries marked with <option>_netdev</option>.</para>
+ </listitem>
+ </varlistentry>
<varlistentry>
<term><filename>remote-fs.target</filename></term>
<listitem>
shell. Isolate to this target in order to administer the system in single-user mode with all file systems
mounted but with no services running, except for the most basic. Compare with
<filename>emergency.target</filename>, which is much more reduced and does not provide the file systems or
- most basic services.</para>
+ most basic services. Compare with <filename>multi-user.target</filename>, this target could be seen as
+ <filename>single-user.target</filename>.</para>
<para><filename>runlevel1.target</filename> is an alias for this target unit, for compatibility with
SysV.</para>
<listitem>
<para>A special target unit that sets up all slice units (see
<citerefentry><refentrytitle>systemd.slice</refentrytitle><manvolnum>5</manvolnum></citerefentry> for
- details) that shall be active after boot. By default the generic <filename>user.slice</filename>,
- <filename>system.slice</filename>, <filename>machines.slice</filename> slice units, as well as the root
- slice unit <filename>-.slice</filename> are pulled in and ordered before this unit (see below).</para>
+ details) that shall be active after boot. By default the generic <filename>system.slice</filename>
+ slice unit, as well as the root slice unit <filename>-.slice</filename>, is pulled in and ordered before
+ this unit (see below).</para>
<para>It's a good idea to add <varname>WantedBy=slices.target</varname> lines to the <literal>[Install]</literal>
section of all slices units that may be installed dynamically.</para>
<term><filename>remote-fs-pre.target</filename></term>
<listitem>
<para>This target unit is automatically ordered before all
- remote mount point units (see above). It can be used to run
- certain units before the remote mounts are established. Note
- that this unit is generally not part of the initial
+ mount point units (see above) and cryptsetup devices
+ marked with the <option>_netdev</option>. It can be used to run
+ certain units before remote encrypted devices and mounts are established.
+ Note that this unit is generally not part of the initial
transaction, unless the unit that wants to be ordered before
all remote mounts pulls it in via a
<varname>Wants=</varname> type dependency. If the unit wants
<refsect1>
<title>Special Passive User Units</title>
- <refsect2>
- <title>graphical-session.target</title>
-
- <para>This target is active whenever any graphical session is running. It
- is used to stop user services which only apply to a graphical (X,
- Wayland, etc.) session when the session is terminated. Such services
- should have <literal>PartOf=graphical-session.target</literal> in their
- <literal>[Unit]</literal> section. A target for a particular session
- (e. g. <filename>gnome-session.target</filename>) starts and stops
- <literal>graphical-session.target</literal> with
- <literal>BindsTo=graphical-session.target</literal>.</para>
-
- <para>Which services are started by a session target is determined by the
- <literal>Wants=</literal> and <literal>Requires=</literal> dependencies.
- For services that can be enabled independently, symlinks in
- <literal>.wants/</literal> and <literal>.requires/</literal> should be
- used, see
- <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
- Those symlinks should either be shipped in packages, or should be added
- dynamically after installation, for example using <literal>systemctl add-wants</literal>, see
- <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
- </para>
+ <variablelist>
+ <varlistentry>
+ <term><filename>graphical-session.target</filename></term>
+ <listitem>
+ <para>This target is active whenever any graphical session is running. It is used to stop user services which
+ only apply to a graphical (X, Wayland, etc.) session when the session is terminated. Such services should
+ have <literal>PartOf=graphical-session.target</literal> in their <literal>[Unit]</literal> section. A target
+ for a particular session (e. g. <filename>gnome-session.target</filename>) starts and stops
+ <literal>graphical-session.target</literal> with <literal>BindsTo=graphical-session.target</literal>.</para>
+
+ <para>Which services are started by a session target is determined by the <literal>Wants=</literal> and
+ <literal>Requires=</literal> dependencies. For services that can be enabled independently, symlinks in
+ <literal>.wants/</literal> and <literal>.requires/</literal> should be used, see
+ <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>. Those
+ symlinks should either be shipped in packages, or should be added dynamically after installation, for example
+ using <literal>systemctl add-wants</literal>, see
+ <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
+ </para>
- <example>
- <title>Nautilus as part of a GNOME session</title>
+ <example>
+ <title>Nautilus as part of a GNOME session</title>
- <para><literal>gnome-session.target</literal> pulls in Nautilus as
- top-level service:</para>
+ <para><literal>gnome-session.target</literal> pulls in Nautilus as top-level service:</para>
- <programlisting>[Unit]
+ <programlisting>[Unit]
Description=User systemd services for GNOME graphical session
Wants=nautilus.service
-BindsTo=graphical-session.target
- </programlisting>
+BindsTo=graphical-session.target</programlisting>
- <para><literal>nautilus.service</literal> gets stopped when the session stops:</para>
+ <para><literal>nautilus.service</literal> gets stopped when the session stops:</para>
- <programlisting>[Unit]
+ <programlisting>[Unit]
Description=Render the desktop icons with Nautilus
PartOf=graphical-session.target
[Service]
-…
- </programlisting>
- </example>
- </refsect2>
-
- <refsect2>
- <title>graphical-session-pre.target</title>
-
- <para>This target contains services which set up the environment or
- global configuration of a graphical session, such as SSH/GPG agents
- (which need to export an environment variable into all desktop processes)
- or migration of obsolete d-conf keys after an OS upgrade (which needs to
- happen before starting any process that might use them). This target must
- be started before starting a graphical session
- like <filename>gnome-session.target</filename>.</para>
- </refsect2>
+…</programlisting>
+ </example>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><filename>graphical-session-pre.target</filename></term>
+ <listitem>
+ <para>This target contains services which set up the environment or global configuration of a graphical
+ session, such as SSH/GPG agents (which need to export an environment variable into all desktop processes) or
+ migration of obsolete d-conf keys after an OS upgrade (which needs to happen before starting any process that
+ might use them). This target must be started before starting a graphical session like
+ <filename>gnome-session.target</filename>.</para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
</refsect1>
<refsect1>
<title>Special Slice Units</title>
- <para>There are four <literal>.slice</literal> units which form
- the basis of the hierarchy for assignment of resources for
- services, users, and virtual machines or containers.</para>
+ <para>There are four <literal>.slice</literal> units which form the basis of the hierarchy for assignment of
+ resources for services, users, and virtual machines or containers. See
+ <citerefentry><refentrytitle>systemd.slice</refentrytitle><manvolnum>7</manvolnum></citerefentry> for details about slice
+ units.</para>
<variablelist>
<varlistentry>
<term><filename>-.slice</filename></term>
<listitem>
- <para>The root slice is the root of the hierarchy. It
- usually does not contain units directly, but may be used to
- set defaults for the whole tree.</para>
+ <para>The root slice is the root of the slice hierarchy. It usually does not contain units directly, but may
+ be used to set defaults for the whole tree.</para>
</listitem>
</varlistentry>
<listitem>
<para>By default, all user processes and services started on
behalf of the user, including the per-user systemd instance
- are found in this slice.</para>
+ are found in this slice. This is pulled in by
+ <filename>systemd-logind.service</filename></para>
</listitem>
</varlistentry>
<listitem>
<para>By default, all virtual machines and containers
registered with <command>systemd-machined</command> are
- found in this slice.
- </para>
+ found in this slice. This is pulled in by
+ <filename>systemd-machined.service</filename></para>
</listitem>
</varlistentry>
</variablelist>
<citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.target</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.slice</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
- <citerefentry project='man-pages'><refentrytitle>bootup</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>bootup</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>
</para>
</refsect1>