Bug 5950 - many applications fail to start with new systemd (common dbus)
: many applications fail to start with new systemd (common dbus)
Status: NEW
: ThinLinc
Server OS
: pre-1.0
: PC Unknown
: P2 Normal
: PoolTodo
Assigned To:
: 6190
  Show dependency treegraph
Reported: 2016-07-08 15:55 by
Modified: 2018-07-04 15:41 (History)
Acceptance Criteria:

patch (2.50 KB, patch)
2018-07-02 13:07, Pierre Ossman
patch (3.62 KB, patch)
2018-07-04 15:41, Pierre Ossman


You need to log in before you can comment on or make changes to this bug.

Description From cendio 2016-07-08 15:55:47
They've moved the session D-Bus in to one that is shared between all sessions
for a user. This seems to wreak havoc with Gnome that has many D-Bus activated
programs. E.g. gnome-terminal and nautilus no longer work.

This was seen on Fedora 24.

Upstream bug:

------- Comment #1 From cendio 2016-07-08 16:09:15 -------
Hacking this in to the start of tl-dbus-launch.sh seems to solve the issue:

if [ "${DBUS_SESSION_BUS_ADDRESS}" = "unix:path=/run/user/`id -u`/bus" ]; then
------- Comment #2 From cendio 2016-07-08 16:28:27 -------
An alternative approach is suggested here:


The workaround they've come up with to fix the problem of sharing
systemd/dbus-daemon between sessions is to send it information about how env
should look like.

Looking at Fedora 24 I can see them running this when a session is started:

systemctl --user import-environment DISPLAY XAUTHORITY

if which dbus-update-activation-environment >/dev/null 2>&1; then
        dbus-update-activation-environment DISPLAY XAUTHORITY

Running that in ThinLinc also fixes things.
------- Comment #3 From cendio 2016-07-11 11:00:40 -------
Note that this is currently broken even without ThinLinc so upstream may revert
this lunacy. See the upstream bug.
------- Comment #4 From cendio 2016-07-11 11:36:19 -------
See also this bug and the upstream bugs it refers to:

------- Comment #5 From cendio 2016-08-25 10:17:08 -------
We'll have a look if this affects Ubuntu 16.04.
------- Comment #6 From cendio 2016-08-25 17:08:21 -------
(In reply to comment #5)
> We'll have a look if this affects Ubuntu 16.04.

Ubuntu 16.04 is not affected by this from what I can tell. I can use
gnome-terminals, gedits and nautilus in multiple sessions independently.
DBUS_SESSION_BUS_ADDRESS is unique across two (one local, one ThinLinc)
simultanous sessions for the same user.
------- Comment #7 From cendio 2017-02-27 15:52:48 -------
Also affects xfce. tl-notify fails to work because Xfce's notification daemon
isn't properly spawned from dbus:

> Feb 27 15:48:49 ossman.lkpg.cendio.se dbus-daemon[18959]: [session uid=1016 pid=18959] Activating via systemd: service name='org.freedesktop.Notifications' unit='xfce4-notifyd.service' requested by ':1.60' (uid=1016 pid=19709 comm="/usr/bin/python3 /bin/d-feet " label="unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023")
> Feb 27 15:48:49 ossman.lkpg.cendio.se systemd[18763]: Starting XFCE notifications service...
> Feb 27 15:48:49 ossman.lkpg.cendio.se xfce4-notifyd[19886]: Unable to init server: Could not connect: Connection refused
> Feb 27 15:48:49 ossman.lkpg.cendio.se xfce4-notifyd[19886]: cannot open display: 
> Feb 27 15:48:49 ossman.lkpg.cendio.se systemd[18763]: xfce4-notifyd.service: Main process exited, code=exited, status=1/FAILURE
> Feb 27 15:48:49 ossman.lkpg.cendio.se systemd[18763]: Failed to start XFCE notifications service.
> Feb 27 15:48:49 ossman.lkpg.cendio.se systemd[18763]: xfce4-notifyd.service: Unit entered failed state.
> Feb 27 15:48:49 ossman.lkpg.cendio.se systemd[18763]: xfce4-notifyd.service: Failed with result 'exit-code'.
> Feb 27 15:50:49 ossman.lkpg.cendio.se dbus-daemon[18959]: [session uid=1016 pid=18959] Failed to activate service 'org.freedesktop.Notifications': timed out (service_start_timeout=120000ms)
------- Comment #8 From cendio 2017-02-27 16:08:34 -------
Filed a new bug for xfce:

------- Comment #9 From cendio 2017-03-09 15:18:41 -------
Ubuntu is now affected, see bug 6190.
------- Comment #10 From cendio 2017-08-02 09:50:55 -------
Also affects OpenSUSE.
------- Comment #13 From cendio 2018-05-09 13:54:53 -------
Reopening for discussion.
------- Comment #15 From cendio 2018-07-02 10:56:27 -------
It seems like things are converging on the following pattern:

 - Update DISPLAY and XAUTHORITY in dbus/systemd early in the session startup

 - Update *everything* just before starting the desktop environment

Fedora assumes the latter is done by the DE:s themselves, which is true in some
cases (dont in gnome-session, startkde). But it isn't true in every case
(unity, xfce, gnome-flashback). Ubuntu has therefore put it in the general
session startup.

It is also crucial that the XDG environment variables (e.g. DESKTOP_SESSION)
are pushed to dbus/systemd. We set these up in tl-run-profile, which means we
cannot update the environment properly before that.
------- Comment #16 From cendio 2018-07-02 13:07:20 -------
Created an attachment (id=876) [details]

Suggested patch that does the above.
------- Comment #17 From cendio 2018-07-04 15:41:08 -------
Created an attachment (id=879) [details]

Updated patch that adds filtering of the environment pushed. systemd doesn't
accept everything and will discard the entire request if it gets anything it
doesn't like.