D-Bus

From ArchWiki
(Redirected from D-Bus (Español))

This article or section needs expansion.

Reason: Mention disabling of dbus services through use of systemctl mask and overrides in /etc/dbus-1/services (Discuss in Talk: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.

Note: dbus-broker currently does not have support for AppArmor. However, officially supported kernels do not support AppArmor mediation for D-Bus, either.

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.
https://apps.gnome.org/Dspy/ || d-spy
  • QDbusViewer — GUI D-Bus debugger. Can be used to inspect D-Bus services and invoke methods on them.
https://doc.qt.io/qt-6/qdbusviewer.html || qt6-tools

You can also use busctl(1) from systemd.

See also