[systemd-devel] user units and system units behavior

Mantas Mikulėnas grawity at gmail.com
Sat Feb 14 10:12:52 PST 2015


On Sat, Feb 14, 2015 at 7:36 PM, Alison Chaiken <alison at she-devel.com>
wrote:

> Thanks very much, Ivan, for the detailed explanation.
>
> I asked:
> >> Question: What does the error message 'Process
> >> org.freedesktop.systemd1 exited with status 1' mean?
>
> Ivan:
> > 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.
>
> Why shouldn't the user be able to activate the systemd user instance?
>

I think the idea was that the user instance would be started automatically
when the user first logged in.

(Which it *is*, at least on Arch: logind starts "user at 1000.service" for me
as soon as pam_systemd tells it that I've logged in.

Some distros break it, either intentionally or by accident. Not sure about
Fedora.)


>  Should they start services in the /user unit directories with
> 'systemctl --session' then?


`systemctl --session` was never a thing.

    In the spirit of 'systemctl cat' and
> 'systemctl edit' commands that find the applicable unit even when the
> invoker doesn't know the complete path, I would hope that non-SUID
> users could type 'systemctl start foo.service' and it would "just
> work".
>

Not sure how that's at all related to knowing the complete path?


> Is 'systemctl --user' completely broken then?   If so, shouldn't we
> remove it from the documentation?
>

It's not broken on stock systemd. As long as your `systemd --user` instance
is running, systemctl can contact it directly over the
"$XDG_RUNTIME_DIR/systemd/private" socket, so there's no hard dependency on
on any D-Bus bus either (neither system nor session nor user).

So if you see `systemctl --user` trying to contact systemd over the bus, it
only does so after it has given up trying to contact it over the private
socket. Does that socket exist?

Also check if the system service "user@*<your uid>*.service" is active, if
it has logged any errors. Try starting that .service manually too.


> 'ps | grep dbus' does in fact show a "--session" bus on Fedora 21 and
> GNOME, but I guess there is no direct 'plumbing' way to request it to
> start units.   Instead the 'porcelain' GNOME method of configured
> services calling each other is required.
>

The bus doesn't start systemd units directly, only pre-systemd "DBus
services".

(Those can be started manually, by
calling org.freedesktop.DBus.StartServiceByName() over DBus – e.g. using
`gdbus call` – or automatically, by simply trying to use them.)

To start systemd units/.services, you need to have a `systemd --user`
running; see above.

-- 
Mantas Mikulėnas <grawity at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150214/a17d2a91/attachment.html>


More information about the systemd-devel mailing list