#833318 /etc/X11/Xsession.d/95dbus_update-activation-env: dbus-update-activation-environment --systemd always fails without dbus-user-session package installed

Package:
dbus-x11
Source:
dbus
Description:
simple interprocess messaging system (X11 deps)
Submitter:
Mirosław Zalewski
Date:
2021-08-25 09:45:07 UTC
Severity:
normal
#833318#5
Date:
2016-08-02 21:29:55 UTC
From:
To:
Dear Maintainer,

`dbus-update-activation-environment --systemd` fails on systems without
dbus-user-session package installed. This limits usefulness of
`/etc/X11/Xsession.d/95dbus_update-activation-env` file and renders
comment there misleading.

   * What led up to the situation?

I was trying to understand why `systemctl --user show-environment`
prints only very limited number of variables and why this happens:

#v+
dbus-update-activation-environment --all --systemd
dbus-update-activation-environment: warning: error sending to systemd: org.freedesktop.DBus.Error.Spawn.ChildExited: Process org.freedesktop.systemd1 exited with status 1
#v-


   * What exactly did you do (or not do) that was effective (or
     ineffective)?

Comment in `/etc/X11/Xsession.d/95dbus_update-activation-env` says that
Xsession environment variables will be put in "systemd --user, if
running". Therefore, I expected all variables defined there to be
available in systemd user services. Since they were not, I thought that
maybe systemd --user starts only after dbus-launch, but that seems to
not be a case:

#v+
ps -o pid,user,args -C dbus-launch -C systemd
  PID USER     COMMAND
    1 root     /sbin/init
 4079 sddm     /lib/systemd/systemd --user
 4090 sddm     dbus-launch --autolaunch 60bcc674655243c8a520cc5813fe7172 --binary-syntax --close-stderr
 4138 minio    /lib/systemd/systemd --user
 4200 minio    /usr/bin/dbus-launch --exit-with-session --sh-syntax
#v-

After some search, I finally looked up `dbus-update-activation-environment`
source code. This error message comes from line 399, which handles
return value of dbus call to `org.freedesktop.systemd1` service on
connection defined as `dbus_bus_get (DBUS_BUS_SESSION, &error);`. I can
only assume that tool is trying to talk to systemd on session bus.
However, `org.freedesktop.systemd1` service is available only on system
bus (and seems to refer to system's systemd, not user instance) - not on
session bus. I can verify that by using `qdbusviewer` tool.

After installing `dbus-user-session` package, I can find
`org.freedesktop.systemd1` on session bus, `systemctl --user show-environment`
prints many variables and `dbus-update-activation-environment --all --systemd`
call does not print any error message.

   * What outcome did you expect instead?

systemd --user instance to be populated with Xsession variables by
default, OR `/etc/X11/Xsession.d/95dbus_update-activation-env` file not
misleading me into thinking that systemd should have these variables
defined. Rephrasing comment to say that only dbus environment is
changed, and `dbus-user-session` must be installed for systemd --user
instance, would be very much appreciated.

#833318#10
Date:
2018-11-27 08:41:00 UTC
From:
To:
I can confirm this bug. Very annoying.


Without this packages, the KDE session and all user units had their own
dbus server/bus. Only after installing the dbus-user-session package all
share the same bus under /run/user/1000/bus.

However, from examining /etc/X11/Xsession.d/*, in particular the call to
dbus-update-activation-environment --systemd, that suggests that this
should be the default configration.


Thanks Mirosław for your research!

#833318#15
Date:
2018-11-27 09:00:48 UTC
From:
To:
What do you consider to be a bug here? Please phrase it in terms of:

* what I did
* what I expected should happen
* what actually happened

What, specifically, do you think should be the default configuration?

The purpose of the dbus-user-session package is that it gives sysadmins
the choice between two models for what "the session bus" means:

* without dbus-user-session: each X11 session has its own separate
  session bus, and there is no per-uid session bus that can be used to
  communicate with `systemd --user` (this is the traditional behaviour)

* with dbus-user-session: there is one session bus per uid, spanning
  one or more possibly overlapping login sessions (this is now the
  recommended behaviour)

Thanks,
    smcv

#833318#20
Date:
2021-08-25 09:41:14 UTC
From:
To:
Witam,

Nawiązałem kontakt, gdy szukałem odpowiedniej dla rzetelnej osoby, może
założyć fundację dla stworzonego kraju.
Nazywam się pani Angela Smith, mój mąż zmarł na koronawirusa. Mój mąż i ja
mamy depozyt w wysokości 25 200 000,00 USD w jego banku.

Poprzedni mój mąż, aby cudne, polecić, aby znaleźć miejsce, gdzie
pieniądze, a także inne kliniki weterynaryjne, poprzednie wzorowanie się na
bardzo interesuje. Jestem męża rozgrywane ostatnie moje wiersze.

  Z powodu mojego mojego autorstwa. Przekaż przekazałbym te 25 200 000,00
USD, aby mogli mogli zostać tym humanitarnym projektem. Chciałbym, abyś
założył w swoim kraju Fundację Opieki nad Zwierzętami. Klinika, która
bezpłatnie leczy zwierzęta w kraju. Fundusze mogą być również odpowiednie
na pomoc na młodszym i małym dzieciom.

Alternatywnie możesz zainwestować ostatnią 25 200 000 USD w lukratywną lub
strefę pracy, którą 24, a następnie co roczny zysk z działalności na pomoc
domu dziecka, starszym i klinik opieki nad zwierzętami.

Jeśli jesteś zainteresowany, zaczniesz rozumieć mój w mojej pracy, zanim
zaczniesz bankle na Twoje konto.

Aby Twoje zamówienie na Twoje nazwisko, będę potrzebować Twojego.
1. Pełne imiona i nazwiska
2. Adres
3. Numer telefonu, pod który mogę zapewnić


Czekam na wniosek.

Dziękuję Ci bardzo,
Pani Angela Smith