[systemd-devel] user units and system units behavior

Ivan Shapovalov intelfx100 at gmail.com
Sat Feb 14 05:20:50 PST 2015


On 2015-02-14 at 00:17 -0800, Alison Chaiken wrote:
> Inside a Fedora 21 Qemu, I made a dead-simple 'gnome-weather.service'
> and experimented with moving it in between system and user directories
> in systemd 215.
> 
> Case 0: With /etc/systemd/system/gnome-weather.service,  starts
> normally with 'systemctl start gnome-weather'
> 
> Case 1: With /etc/systemd/user/gnome-weather.service, starts normally
> with 'systemctl --user start gnome-weather'
> 
> I wanted to try 'busctl monitor' so I compiled systemd 218 and installed it.
> 
> [achaiken at fedora21 ~]$ systemctl --version
> systemd 218
> -PAM -AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP
> +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ -LZ4 -SECCOMP +BLKID +ELFUTILS
> +KMOD +IDN
> 
> Case 0: works as before, with 'busctl monitor
> org.freedesktop.systemd1' producing many screens of output.
> 
> Case 1: 'systemctl --user start gnome-weather'  now fails:
> 
> [achaiken at fedora21 ~]$ systemctl start --user gnome-weather
> Failed to start gnome-weather.service: Process
> org.freedesktop.systemd1 exited with status 1
> 
> Meanwhile 'busctl --user monitor org.freedesktop.systemd1' shows no output.
> 
> Question: What does the error message 'Process
> org.freedesktop.systemd1 exited with status 1' mean?

Hi Alison,

this is a sign of that the systemd user instance (`systemd --user`)
isn't running.

More specifically, the systemd user instance wasn't running, so its bus
name hadn't been taken, so the dbus1 server tried to do the "bus
activation", but the dbus1 service file for systemd (not to be confused
with systemd's unit files) contains Exec=/bin/false (as to prevent bus
activation), so that activation had failed.

..or this could be a sign of that `systemctl --user` couldn't connect to
`systemd --user`.

> 
> Question: is it correct that the user bus show no traffic in the
> second case?   Or is that a symptom of what's wrong?

This is the current out-of-the-box situation. The problem lies in that
there is currently no single "user bus". There is a number of session
busses, launched by a scriptlet in /etc/X11/xinitrc.d for each X11
session separately. Everything in the user's world works through that
bus. But not `systemd --user`: it is per-user, not per-session. It just
appears before any session is created, so it does not know about any
session busses.

The intent here, as I understand it, some time ago was to have a single
user bus under a well-defined address
($XDG_RUNTIME_DIR/dbus/user_bus_socket), which will be managed by the
systemd user instance (by means of dbus.socket+dbus.service, just like
in the system instance). But there is no such bus, so `systemctl --user`
connects to the systemd user instance via their own private bus: cf.
src/libsystemd/sd-bus/bus-util.c:bus_open_transport_systemd() and
src/libsystemd/sd-bus/bus-util.c:bus_open_user_systemd().

That's why you can't see the traffic using `busctl --user`.

And this all is going to change when kdbus becomes finally there.

HTHs,
-- 
Ivan Shapovalov / intelfx /
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 213 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150214/d20bc8e0/attachment.sig>


More information about the systemd-devel mailing list