Skip to content

Wayland: Existing D-Bus session bus gets ignored, breaking service access

!71 (merged) made the compositor run through dbus-run-session unconditionally. If the system already provides a session bus (as is the norm with systemd, with dbus.service running as a per-user instance) this breaks access to services connected to that session bus. Impact naturally depends on which dbus services are relevant to the user, I've had it break access to gnome-keyring-daemon.service (which breaks applications using the keyring in turn, e.g. Gajim becomes unresponsive and eventually crashes), and make Podman commands fail because Podman can't reach the user systemd instance (which listens on the systemd-started session bus). Some of these might be hidden if the relevant D-Bus service is also started on the bus created by dbus-run-session.

I've fixed the issue locally by adding the following check in startxfce4 to use dbus-run-session only if DBUS_SESSION_BUS_ADDRESS is unset or empty:

    XFCE4_SESSION_COMPOSITOR="${OPTS:-labwc --config-dir ${XDG_CONFIG_HOME:-${HOME}/.config}/xfce4/labwc --config ${XDG_CONFIG_HOME:-${HOME}/.config}/xfce4/labwc/rc.xml $startup_option xfce4-session}"
    if [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then
       XFCE4_SESSION_COMPOSITOR="dbus-run-session -- ${XFCE4_SESSION_COMPOSITOR}"
    fi

If someone explicitly doesn't want to use an existing session bus (maybe for testing with a nested compositor) they can simply unset DBUS_SESSION_BUS_ADDRESS.