D-Bus
D-Bus is a message bus system that provides an easy way for inter-process communication. It consists of a daemon, which can be run both system-wide and for each user session, and a set of libraries to allow applications to use D-Bus.
dbus is pulled and installed as a dependency of systemd and user session bus is started automatically for each user.
Implementations
Arch provides two D-Bus message broker implementations. Initially, user will be asked to choose a desired dbus-units provider during installation of systemd package. Only one implementation can be installed at a time.
dbus-broker
dbus-broker is currently the default implementation for Arch [1] [2]. It is a drop-in replacement for the reference implementation, which aims "to provide high performance and reliability, while keeping compatibility to the D-Bus reference implementation".
Select dbus-broker-units when asked for dbus-units provider, or install it explicitly.
Reference implementation
The reference implementation is still officially supported by Arch.
Select dbus-daemon-units when asked for dbus-units provider, or install it explicitly.
Tips and tricks
Override dbus service
This is useful when specifying a particular service among other services providing the same well-known bus name. See KeePass#Autostart and KDE Wallet#Automatic D-Bus activation for example.
D-Bus services can be masked by setting Exec=/bin/false
in service files of $XDG_DATA_HOME/dbus-1/services
. For example, to mask gvfsd,
$ cp /usr/share/dbus-1/services/org.gtk.vfs.Daemon.service ~/.local/share/dbus-1/services $ sed 's|^Exec=.*|Exec=/bin/false|' ~/.local/share/dbus-1/services/org.gtk.vfs.Daemon.service
If the service is already launched, the override will not work. The existing service's process must be killed, or launched earlier.
Debugging
- D-Spy — Easy to use D-Bus debugger GUI tool. D-Spy can be used to inspect D-Bus interfaces of running programs and invoke methods on those interfaces.
- QDbusViewer — GUI D-Bus debugger. Can be used to inspect D-Bus services and invoke methods on them.
You can also use busctl(1) from systemd.
See also
- https://freedesktop.org/wiki/Software/dbus/
- https://freedesktop.org/wiki/IntroductionToDBus/
-
https://uyha.github.io/technical/dbus-systemd.html systemd uses DBus as the mechanism to interact with it. This article introduces just enough DBus concepts and the usage of
busctl
to communicate with systemd.