D-Bus socket-activation dependency problems?

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
snovotill
Posts: 16
Joined: 2021-08-19 00:00

D-Bus socket-activation dependency problems?

#1 Post by snovotill »

Trying to start a plain vanilla session D-Bus with ordinary D-Bus Socket Activation at the usual unix:path=/run/user/1001/bus without a parent systemd --user process such as user@1001.service but it is fighting me every step of the way:

Code: Select all

# Set up the socket location:
$ XDG_RUNTIME_DIR="/run/user/$(id -u $USER)"
$ echo $XDG_RUNTIME_DIR
/run/user/1001
$ export XDG_RUNTIME_DIR

#Start the Systemd dbus.socket unit which will now create the listening socket:
$ systemctl --user start dbus.socket
Failed to connect to bus: No medium found
# It wants D-Bus to initialize D-Bus!

Okay loopy, we'll give you D-Bus so you can start D-Bus!
$ dbus-run-session systemctl --user start dbus.socket
dbus-daemon[215703]: [session uid=1001 pid=215703] Activating service name='org.freedesktop.systemd1' requested by ':1.0' (uid=1001 pid=215704 comm="systemctl --user start dbus.socket")
dbus-daemon[215703]: [session uid=1001 pid=215703] Activated service 'org.freedesktop.systemd1' failed: Process org.freedesktop.systemd1 exited with status 1
Failed to start dbus.socket: Process org.freedesktop.systemd1 exited with status 1
See user logs and 'systemctl --user status dbus.socket' for details.

# Huh? Let's see what we've got:
$ echo "$DBUS_SESSION_BUS_ADDRESS"
«a big fat newline prints here»
#​ Total failure to create the D-Bus activation socket!
# Should have been set to unix:path=/run/user/1001/bus
# Should have been a short order cook.
There are no useful entries anywhere in journalctl.
Surely it must be possible to bring up a dbus.socket instance for dbus.service ...without the need for user@1001.service parent???
He HHHeeeelp!

Aki
Global Moderator
Global Moderator
Posts: 4342
Joined: 2014-07-20 18:12
Location: Europe
Has thanked: 127 times
Been thanked: 585 times

Re: D-Bus socket-activation dependency problems?

#2 Post by Aki »

Could you better explain what you intend to achieve?
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀

snovotill
Posts: 16
Joined: 2021-08-19 00:00

Re: D-Bus socket-activation dependency problems?

#3 Post by snovotill »

Sure ...I'm wanting to start my D-Bus socket activation unit /usr/lib/systemd/user/dbus.socket on my socket address, which I exported as XDG_RUNTIME_DIR="/run/user/$(id -u $USER)" in my console session (which has no parent user@1001.service). Objective is to be able to use my session D-Bus normally, like I would be able to had I logged into Gnome. D-Bus is refusing to start the socket, does not spit out LISTEN_FDS, and therefore fails to invoke /usr/lib/systemd/user/dbus.service when the socket is tickled (per my original post). Thanks for your interest, I'm pretty much stuck.

lindi
Debian Developer
Debian Developer
Posts: 646
Joined: 2022-07-12 14:10
Has thanked: 2 times
Been thanked: 129 times

Re: D-Bus socket-activation dependency problems?

#4 Post by lindi »

It would really help to understand what is the end goal here. Is there some particular program that you would like to use without GUI?

snovotill
Posts: 16
Joined: 2021-08-19 00:00

Re: D-Bus socket-activation dependency problems?

#5 Post by snovotill »

The end goal is to have the session D-Bus running in the same way as it does when I'm logged into Gnome, so that I can use the same scripts and commands, for instance when accessing the secrets API via session bus, pkexec, etc etc. The second goal (I did not know this was going to become a goal) is to understand what hoops I have to jump through to enable socket activation for a service. It seems that socket activation only works after a GUI login, which is REALLY weird seeing that D-Bus is not a GUI feature.

CwF
Global Moderator
Global Moderator
Posts: 3263
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 69 times
Been thanked: 289 times

Re: D-Bus socket-activation dependency problems?

#6 Post by CwF »

snovotill wrote: 2024-05-15 02:27 weird seeing that D-Bus is not a GUI feature.
I suspect it is the session manager that initiates the D-Bus session. I have never thought about it specifically but maybe some minimal XTerm Xorg session could initiate the d-bus. I have done that for a single terminal ncurses based 'desktop'. Not sure of any current methods...
Mottainai

lindi
Debian Developer
Debian Developer
Posts: 646
Joined: 2022-07-12 14:10
Has thanked: 2 times
Been thanked: 129 times

Re: D-Bus socket-activation dependency problems?

#7 Post by lindi »

snovotill wrote: 2024-05-15 02:27 The end goal is to have the session D-Bus running in the same way as it does when I'm logged into Gnome, so that I can use the same scripts and commands, for instance when accessing the secrets API via session bus, pkexec, etc etc. The second goal (I did not know this was going to become a goal) is to understand what hoops I have to jump through to enable socket activation for a service. It seems that socket activation only works after a GUI login, which is REALLY weird seeing that D-Bus is not a GUI feature.
Ok and your are logging in from console and not from SSH?

User avatar
NorthEast
Posts: 358
Joined: 2018-11-18 04:35
Has thanked: 12 times
Been thanked: 31 times

Re: D-Bus socket-activation dependency problems?

#8 Post by NorthEast »

dbus appears to be activated here: /etc/X11/Xsession.d/20dbus_xdg-runtime

snovotill
Posts: 16
Joined: 2021-08-19 00:00

Re: D-Bus socket-activation dependency problems?

#9 Post by snovotill »

Ok and your are logging in from console and not from SSH?
The problem occurs after SU or SSH or Any time that commands are run withing a user environment which has not GUI session.
dbus appears to be activated here: /etc/X11/Xsession.d/20dbus_xdg-runtime
Yeah, this is where it disappears into the weeds.

I worry that systemd might require a user@1001.service instance to exist.
If so then the question changes to: What is the workaround?
If not then man dbus-update-activation-environment might hold the answer.

Post Reply