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

Running dbus-broker-launch without systemd (the reprise) #340

Open pharcosyle opened 5 months ago

pharcosyle commented 5 months ago

This has been discussed before (https://github.com/bus1/dbus-broker/issues/183, https://github.com/bus1/dbus-broker/pull/188). I'd like to run dbus-broker-launch without systemd.

My use case: I'm a Guix user (and developer, a bit) and I'd like to add an alternative option to use dbus-broker instead of dbus. Guix already jumps through some hoops to get dbus working as it uses elogind not systemd (although I use seatd) and I figure as long as we're hacking our way to functional distro dbus support anyway we might as well use a better implementation. I understand that there will be no service activation: that's fine, service activation sort of sucks so I/we already manually run daemons for pretty much everything (GNU Shepherd is nice for this).

I've patched the source so it compiles successfully against elogind. I've also naively updated that years-old PR (see https://github.com/pharcosyle/dbus-broker/commit/ec11a6b5a59180827c8bceebb2ce4a0c1c6dc5b0). I think the only thing I have left to do is create a unix socket that I pass to dbus-broker-launch and manage its lifecycle sensibly but I don't really know how to do that. I'd be grateful if anyone could give me some advice on how to go about completing this task or offer alternatives. Thank you!

dvdhrm commented 5 months ago

Hi! The test-suite in ./test/dbus/ already creates a dbus-broker instance, which it then runs tests against. The util-broker.c module shows how to create a unix-listener socket and pass it to a new instance of dbus-broker. It also shows how to do that with the reference implementation dbus-daemon.

Also note that at-spi2 (GNOME accessibility) does something similar and spawns its own dbus-broker instance.

There is no need to use dbus-broker-launch if service activation is not desired. Furthermore, if activation is desired, you can use dbus-broker-launch as example how to design a launcher for dbus-broker.

Lastly, you can always stick to dbus-daemon to get a well-maintained solution that does not require systemd.

pharcosyle commented 5 months ago

Thanks so much, this is good info. I realize as I work on this more I really need to understand DBus and its role in Guix better. This is slower-going than I'd hoped so I'm putting it on the backburner for now, but thank you again!

nmeum commented 5 months ago

Hey, perhaps a bit off-topic, but I am also interested in making it easier to run and use dbus-broker on Guix and Alpine (both systems without systemd). Let me know if you come up with a good Guix (home) service for dbus-broker 🙋

pharcosyle commented 5 months ago

I'll make you a deal: I'll furnish the Guix packages for it and you make the service. Here, I'll do my part now: dbus-broker-guix.patch.txt

mid-kid commented 2 months ago

Glad to read that there's still interest in making new software not hard-depend on systemd where it doesn't need to. I'm personally interested in making it work with OpenRC, as I wanted to implement some form of dbus activation in it (instead of letting them run unsupervised). Is there any specific reason why dbus activation is frowned upon in Guix?

pharcosyle commented 1 month ago

Is there any specific reason why dbus activation is frowned upon in Guix?

It's not. However GNU Shepherd, Guix's service manager / init system, is deeply programmable and really nice and I'd prefer to run all the services on my machine through it rather than automagically with dbus activation.