D-Bus

D-Bus is Article description::an interprocess communication (IPC) system for software applications. Software makes use of D-Bus to communicate information between services.

USE flags
Portage knows the global  USE flag for enabling support for D-Bus in other packages. Enabling this flag will pull in automatically. This is the default for desktop profiles:

Emerge
After setting the  global USE flag be sure to update the system using the   option:

Files
The main configuration files include:


 * for the system bus
 * for the session bus

The system bus: the service
A D-Bus service, such as the OpenRC service described below, typically provides the system bus, but not a session bus. Depending on system configuration, a session bus may need to be manually started in order for certain 'desktop' functionality to be available. For further details, refer to the session bus, below.

OpenRC
After configuration step, start the D-Bus system bus with:

To start the D-Bus system bus at boot time, add it the default run level:

The session bus
If using a desktop environment such as KDE or GNOME, a session bus should be created automatically. More generally, however, a session bus might not get created automatically. In particular, this is the case when using /.

To check whether a session bus is available within the X or Wayland session, open a terminal in that session and do:

This should output a string beginning with, e.g.  . If no such string is displayed, there is no D-Bus session bus visible to the session.

To ensure a D-Bus session bus is available within the X or Wayland session, start the window manager (e.g. i3, bspwm, etc.) via, e.g.:

Two things important to note here are:


 * 1) The session bus thus created will only be visible to programs created as child processes of the program launched by . Thus, any programs needing access to the session bus will need to be started via the startup procedure of that program (e.g. for i3, via ).
 * 2) The use of  here means that no subsequent lines of the  file will be executed. (For details, refer to the exec(3) man page.)

Usage
Some useful commands include:


 * - To monitor the activities in the system bus.
 * - To monitor the activities in the session bus.
 * - To send a message. See the dbus-send man page for more information.

To view dbus services:

To shutdown and reboot as a regular user when using elogind:

Changing the last argument to  should make polkit interactively ask the user for authentication credentials if it needs to.

Troubleshooting
Use the command to monitor the buses. Errors are also redirected to the syslog.

External resources

 * Introduction to D-Bus (freedesktop.org)
 * D-Bus tutorial (freedesktop.org)
 * D-Bus (Arch Wiki)