Special User Units
When systemd runs as a user instance, the following special units
are available:
default.target
This is the main target of the user session, started by
default. Various services that compose the normal user
session should be pulled into this target. In this regard,
default.target is similar to multi-user.target in the system
instance, but it is a real unit, not an alias.
In addition, the following units are available which have
definitions similar to their system counterparts: exit.target,
shutdown.target, sockets.target, timers.target, paths.target,
bluetooth.target, printer.target, smartcard.target, sound.target.
Special Passive User Units
graphical-session.target
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
"PartOf=graphical-session.target" in their [Unit] section. A
target for a particular session (e. g. gnome-session.target)
starts and stops "graphical-session.target" with
"BindsTo=graphical-session.target".
Which services are started by a session target is determined
by the "Wants=" and "Requires=" dependencies. For services
that can be enabled independently, symlinks in ".wants/" and
".requires/" should be used, see systemd.unit(5). Those
symlinks should either be shipped in packages, or should be
added dynamically after installation, for example using
"systemctl add-wants", see systemctl(1).
Example 1. Nautilus as part of a GNOME session
"gnome-session.target" pulls in Nautilus as top-level
service:
[Unit]
Description=User systemd services for GNOME graphical session
Wants=nautilus.service
BindsTo=graphical-session.target
"nautilus.service" gets stopped when the session stops:
[Unit]
Description=Render the desktop icons with Nautilus
PartOf=graphical-session.target
[Service]
...
graphical-session-pre.target
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
gnome-session.target.
xdg-desktop-autostart.target
The XDG specification defines a way to autostart applications
using XDG desktop files. systemd ships
systemd-xdg-autostart-generator(8) for the XDG desktop files
in autostart directories. Desktop Environments can opt-in to
use this service by adding a Wants= dependency on
xdg-desktop-autostart.target.
Special User Slice Units
There are four ".slice" units which form the basis of the user
hierarchy for assignment of resources for user applications and
services. See systemd.slice
(7) for details about slice units and
the documentation about Desktop Environments
[3] for further
information.
-.slice
The root slice is the root of the user's slice hierarchy. It
usually does not contain units directly, but may be used to
set defaults for the whole tree.
app.slice
By default, all user services and applications managed by
systemd
are found in this slice. All interactively launched
applications like web browsers and text editors as well as
non-critical services should be placed into this slice.
session.slice
All essential services and applications required for the
session should use this slice. These are services that either
cannot be restarted easily or where latency issues may affect
the interactivity of the system and applications. This
includes the display server, screen readers and other
services such as DBus or XDG portals. Such services should be
configured to be part of this slice by adding
Slice=session.slice to their unit files.
background.slice
All services running low-priority background tasks should use
this slice. This permits resources to be preferentially
assigned to the other slices. Examples include
non-interactive tasks like file indexing or backup operations
where latency is not important.