bus1 / dbus-broker

Linux D-Bus Message Broker
https://github.com/bus1/dbus-broker/wiki
Apache License 2.0
661 stars 78 forks source link

How to replace dbus-broker as session bus? #344

Closed royeom closed 2 months ago

royeom commented 4 months ago

Below is my service file to launch session bus with dbus-daemon. I wanna replace ExecStart with dbus-broker or dbus-broker-launch.

... [Service] Slice=my-active.slice Group=CustomGroup ExecStart=/usr/bin/dbus-daemon --session --nofork --address=unix:path=/var/run/dbus/my_session_bus_socket ExecReload=/usr/bin/dbus-send --print-reply --session --type=method_call --dest=org.freedesktop.DBus / org.freedesktop.DBus.ReloadConfig Nice=-19 ...

I tried like this. But it doesn't work.. Environment="DBUS_SESSION_BUS_ADDRESS=unix:path=/var/run/dbus/my_session_bus_socket" ExecStart=/usr/bin/dbus-broker-launch --scope user --audit

Could anyone let me know? :)

dvdhrm commented 4 months ago

The github-wiki contains information on this: https://github.com/bus1/dbus-broker/wiki#using-dbus-broker

You can find the service-files for dbus-broker in the repository, and they are usually installed alongside dbus-broker on your system.

royeom commented 4 months ago

There is a common usage for user bus on the github-wiki. :( I need to use specific socket ( '/var/run/dbus/my_session_bus_socket' ).

Could you suggest how to use specific socket path with session bus?

dvdhrm commented 4 months ago

dbus-broker-launch requires to be socket-activated. The unit shipped with the launcher has an entry [Install] Alias=dbus.service, meaning it will be operating as dbus.service, rather than dbus-broker.service when enabled.

This automatically pulls in dbus.socket, which is provided by your distribution. This socket unit provides the socket to dbus-broker (using the standard location for the user bus).

If you want to use a different socket path, copy dbus.socket to my-dbus.socket and dbus-broker.service to my-dbus.service, adjust the socket path accordingly and start the units.

Please refer to the systemd manuals for details on how service and socket units operate. dbus-broker-launch uses the standard system service and socket units without any special handling.

dvdhrm commented 2 months ago

I will close this as resolved. Let me know if there are still open questions, or re-open the issue instead! Thanks!