Comment 6 for bug 1633749

Revision history for this message
Martin Pitt (pitti) wrote :

The reason is that (user) D-Bus and (user) systemd services don't run in the session any more, as they apply to all sessions of that user. To illustrate, check "systemctl status" and compare the bits that are directly under user@1000.service (user-global services) vs. the bits that are in the logind session (session-XX.scope).

So right now these don't have a "native" XDG_SESSION_ID. The intention is that you don't assume XDG_SESSION_ID and a D-Bus object path, but you query logind for it:

$ busctl call org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager GetUser u `id -u`
o "/org/freedesktop/login1/user/_1000"
$ busctl get-property org.freedesktop.login1 /org/freedesktop/login1/user/_1000 org.freedesktop.login1.User Display
(so) "c1" "/org/freedesktop/login1/session/c1"

This is actually a lot more comfortable if you use libsystemd and sd_uid_get_display(), like in https://cgit.freedesktop.org/polkit/commit/?id=a68f5dfd76 .

As a hack we could poke that into the graphical session units without poking it into *all* user services (as it would be conceptually wrong for e. g. gvfs, keyring, or pulseaudio), e. g. in unity.service's ExecStartPre=. But I think it's actually not difficult to fix it the proper way.