A collection of units for the systemd user session.
Switch branches/tags
Pull request Compare This branch is 34 commits behind ahkok:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



This package contains several systemd unit files related to the systemd
user session, aka `systemd --user`. The goal of this package is to
provide an easy way for people to collect, share and deploy systemd
user session installations and help test the systemd user session
core code.


In the "units" folder, you will find several unit files for the system
domain and the user session. The most critical ones are:

  system/user-session@.service - This unit creates an auto-login
  mechanism in systemd. This is the unit that "starts" a
  user session. It can either be run manually: `systemd start
  user-session@joe.service`. Or one could make this happen at boot
  time automatically with `systemctl enable user-session@joe.service`.

  user/dbus.socket and user/dbus.service - This creates the dbus
  session bus for the systemd user session. The session bus should
  live under XDG_RUNTIME_DIR, and so the user-session@.service refers
  to this bus address. This is needed to make dbus activation under
  the user session work.

  default.target - not packaged. This symlink is pointing to the target
  unit file that should be started by systemd --user. If invalid, empty
  or missing, nothing will happen when you start the user session.

  other - various example units are packaged for several popular Linux
  desktop sessions. They are examples, which work for the author,
  but may not necessarily function properly on other distributions.


  systemd - required. This package uses the pkg-config file from
  systemd to make sure items are installed in the proper locations.

  PAM needs to be enabled in systemd. Your system should have
  `pam_systemd.so` used in the `login` or `system-auth` files in

  xorg-launch-helper - currently required. Xorg by itself does not
  run properly as a systemd service. The xorg-launch-helper project
  performs this task and installs several unit files that are required
  for most of the units in this project to function.

  dbus - current dbus code sends a malformed DBUS_SESSION_BUS_ADDRESS
  to any dbus-activated unit under the systemd user session. A patch
  is pending upstream to resolve the issue. Until this is accepted,
  you need to either apply this patch manually to dbus yourself, or
  live without dbus activation. For reference, the bug is here:
  https://bugs.freedesktop.org/show_bug.cgi?id=50962. A copy of the
  last-good version of the patch can be found in the /patches/
  folder in this source tree.

  permissions - in order for a normal user to start Xorg and control
  sound and/or video without seat management, the user running the
  session will likely need to be added to the video and audio groups,
  and you may have to make Xorg setuid root (4711). This is a
  potential security risk, so, use caution.


  Just run the usual `configure --prefix...; make; make install`.

  Building from git requires running `./autogen.sh` first.


There are two things that need to be done manually by the SA to enable
and configure the user session properly.

1) Choose the default target (desktop).

Systemd has various places where this choice can be set. The
distribution should place a `default.target` symlink in
${prefix}/systemd/user/. The SA should place the symlink in
${sysconfdir}/systemd/user/, and last, the user themselves can
override those two locations by creating the `default.target` symlink
in ~/.config/systemd/user.

2) Enable auto-logon/start user session at boot time (optional).

This should simply be done by the SA running: `systemctl enable
user-session@joe.service`. However, this is currently yet not
supported in systemctl, so you have to manually create a symlink:

ln -sf /usr/lib/systemd/system/user-session@.service \

Note that if you are using systemd version 186 or newer, you must use UIDs
instead of usernames here.

ln -sf /usr/lib/systemd/system/user-session@.service \


You can connect to the user session over dbus and use regular systemctl
commands to start/stop units, look at the state etc.

root> # su - joe
joe> $ export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/dbus/user_bus_socket
joe> $ systemctl --user

One useful thing to try is to run dbus-monitor as joe after setting the session
bus address. It will show you if the session bus is functional.

The system journal should capture all messages output by user session
services. The user is currently not able to see those messages if you
disabled persistent journal logging (IOW, if you don't have /var/log/journal).


Download release tarballs here: