forked from ahkok/user-session-units
/
README
123 lines (86 loc) · 4.75 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
user-session-units
==================
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.
Content:
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.
Prerequisites:
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
/etc/pam.d.
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.
Installation:
Just run the usual `configure --prefix...; make; make install`.
Building from git requires running `./autogen.sh` first.
Configuration:
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 \
/etc/systemd/system/graphical.target.wants/user-session@joe.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 \
/etc/systemd/system/graphical.target.wants/user-session@1000.service
Debugging:
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:
http://foo-projects.org/~sofar/user-session-units/