You are not logged in.

#1 2021-12-17 22:55:59

Sapiens
Member
Registered: 2021-07-05
Posts: 52

Questions about using D-BUS!

I recently ran into a problem that resulted in some additional questions. As a file manager I am using Nautilus, since I wanted to connect to Samba shares on the network I installed gvfs-smb.
This however still did no result in Nautilus being able to mount or even find any shares. As it turned out I needed to start Nautilus with

dbus-launch nautilus

This immediately resulted in Nautilus being able to connect to shares.

The wiki site of D-BUS is unfortunatelly not telling much. It gives the impression there is nothing to do, and start a user session by default. I am asking myself why I need to explicitly launch Nautilus with dbus-launch though?
Is there another service I need to activate or how would I specify nautilus being launched like this by default?

Last edited by Sapiens (2023-01-07 16:46:09)

Offline

#2 2021-12-18 00:44:12

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,310

Re: Questions about using D-BUS!

you should not need to launch a distinct dbus session indeed. How are you logging in and starting your session exactly? What's your output for

loginctl show-session $XDG_SESSION_ID
echo $DBUS_SESSION_BUS_ADDRESS

Last edited by V1del (2021-12-18 15:48:33)

Offline

#3 2021-12-18 11:24:46

Ferdinand
Member
From: Norway
Registered: 2020-01-02
Posts: 338

Re: Questions about using D-BUS!

@V1del, that should be...

loginctl show-session $XDG_SESSION_ID

...I think?

@Sapiens, if your $DBUS_SESSION_BUS_ADDRESS is empty then maybe add this to your .xinitrc if you're using startx, or to your .xprofile if you're using a DM, to make sure dbus is running when your session starts?

if which dbus-launch >/dev/null && test -z "$DBUS_SESSION_BUS_ADDRESS"; then
    eval "$(dbus-launch --auto-syntax --exit-with-x11)"
fi

Last edited by Ferdinand (2021-12-18 11:36:29)

Offline

#4 2021-12-18 15:48:16

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,310

Re: Questions about using D-BUS!

Whoops you're right. But again even having the  need to invoke dbus-launch in the first place points to a broken setup. On a normal login systemd will correctly give you a user/login based dbus session, whenever you fall back to dbus-launch you either have something configured incorrectly in general or a special usecase (remote login/vnc servers or the like). The .xinitrc import case is properly covered by the default .xinitrc that the https://wiki.archlinux.org/title/Xinit#xinitrc article tells you about how to configure. If you start a distinct dbus session you are going to have a conflict with user services and the rest of your session e.g. pipewire/pulseaudio cannot properly communicate with mixers from your graphical environment for example or other weird and potentially hard to debug fallouts.

Offline

#5 2021-12-21 09:13:58

Ferdinand
Member
From: Norway
Registered: 2020-01-02
Posts: 338

Re: Questions about using D-BUS!

Thanks for explaining, @V1del. I've always had that in my .xinitrc and .xprofile. And yes, it is not part of how the wiki explains .xinitrc configuration, so it's of my own (wrong)doing tongue It seemed to make sense though; if I have no DBUS_SESSION_BUS_ADDRESS, then D-Bus is not running, so start it. But you're right, of course; if it's not running, then something is wrong and should be fixed.

If I get you right, helping @Sapiens should start by investigating why the D-Bus isn't started by systemd. But I'm a bit at a loss; there's supposed to be two D-Bus instances; the system-wide and the per-user-login-session (according to man dbus-daemon). The first is started by dbus.service, and systemctl status dbus.service will give info on anything wrong with that, but this problem is most likely connected to the user session, and I can't figure out where that dbus-daemon is started? I can see it running, but I can't find what starts it tongue

Edit:
I found this, but I'm out of my depth - I don't understand those links.

$ ls -lan /run/user/1000/systemd/units
total 0
drwxr-xr-x 2 1000 1000 340 21.12.2021 08:30 ./
drwxr-xr-x 5 1000 1000 140 21.12.2021 08:30 ../
lrwxrwxrwx 1 1000 1000  32 21.12.2021 08:30 invocation:at-spi-dbus-bus.service -> 50aa0c184e00431a9b1a36f7a6640071
lrwxrwxrwx 1 1000 1000  32 21.12.2021 08:30 invocation:dbus.service -> 198bc290946e4252ba5c5a2b4ad33ffa
lrwxrwxrwx 1 1000 1000  32 21.12.2021 08:30 invocation:dbus.socket -> f1140d6d24eb4b318b6cc192e8f0a8e6
lrwxrwxrwx 1 1000 1000  32 21.12.2021 08:30 invocation:dconf.service -> 233792cf4b58439292aff3075f0f5b60
lrwxrwxrwx 1 1000 1000  32 21.12.2021 08:30 invocation:gpg-agent.service -> 72c7fabb0bb64c60a6321dc0e103bc80
lrwxrwxrwx 1 1000 1000  32 21.12.2021 08:30 invocation:gvfs-afc-volume-monitor.service -> e3e506c5e37743fa9cd1e4404a8fa9e0
lrwxrwxrwx 1 1000 1000  32 21.12.2021 08:30 invocation:gvfs-daemon.service -> b2277c58abe74ae4b46ad5b879e83b0b
lrwxrwxrwx 1 1000 1000  32 21.12.2021 08:30 invocation:gvfs-gphoto2-volume-monitor.service -> cb3cdbc9f3b2424fb9a76594eab71bd9
lrwxrwxrwx 1 1000 1000  32 21.12.2021 08:30 invocation:gvfs-mtp-volume-monitor.service -> 56cace11f5064a3884b7784feae09735
lrwxrwxrwx 1 1000 1000  32 21.12.2021 08:30 invocation:gvfs-udisks2-volume-monitor.service -> 5e4ad9d62ed8456c9d7538186adffca0
lrwxrwxrwx 1 1000 1000  32 21.12.2021 08:30 invocation:mpris-proxy.service -> d097cd0ee86e48c99030b27a58823357
lrwxrwxrwx 1 1000 1000  32 21.12.2021 08:30 invocation:obex.service -> 405248fcf0de45058a93b4993c453501
lrwxrwxrwx 1 1000 1000  32 21.12.2021 08:30 invocation:pulseaudio.service -> 2d3d340314944fb3b9455eeec2b48343
lrwxrwxrwx 1 1000 1000  32 21.12.2021 08:30 invocation:session-end.service -> 64ca955d56684ae2859f58c6b0118380
lrwxrwxrwx 1 1000 1000  32 21.12.2021 08:30 invocation:ssh-agent.service -> 1db7ebe5c4b942abb0ae22c835975438
$ cat /run/user/1000/systemd/units/invocation\:dbus.service 
cat: '/run/user/1000/systemd/units/invocation:dbus.service': No such file or directory

Aw.. please disregard my fumbling around - it's in a parallel directory to the system/dbus.service of course; /usr/lib/systemd/user/dbus.service smile
(I'm curious about those links though)

So, @Sapiens - if you're still with us smile do you have any output from

systemctl status dbus

and

systemctl --user status dbus

Last edited by Ferdinand (2021-12-21 10:48:06)

Offline

#6 2022-01-10 02:49:49

Sapiens
Member
Registered: 2021-07-05
Posts: 52

Re: Questions about using D-BUS!

V1del wrote:

you should not need to launch a distinct dbus session indeed. How are you logging in and starting your session exactly? What's your output for

loginctl show-session $XDG_SESSION_ID
echo $DBUS_SESSION_BUS_ADDRESS

@V1del I am starting the session via the `startx`command.

[sapiens]$ loginctl show-session $XDG_SESSION_ID
Id=1
User=1000
Name=sapiens
Timestamp=Thu 2022-01-06 20:49:00 CET
TimestampMonotonic=73178119
VTNr=1
Seat=seat0
TTY=tty1
Remote=no
Service=login
Scope=session-1.scope
Leader=5420
Audit=1
Type=tty
Class=user
Active=yes
State=active
IdleHint=yes
IdleSinceHint=1641687265996103
IdleSinceHintMonotonic=188798537824
LockedHint=no
[sapiens]$ echo $DBUS_SESSION_BUS_ADDRESS
unix:path=/run/user/1000/bus

Last edited by Sapiens (2023-01-07 16:46:57)

Offline

#7 2022-01-10 08:14:07

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,355

Re: Questions about using D-BUS!

Please post your xinitrc (and see the last link below…)

Offline

Board footer

Powered by FluxBB