From Gentoo Wiki
(Redirected from Dbus)
Jump to:navigation Jump to:search

D-Bus is 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 dbus USE flag for enabling support for D-Bus in other packages. Enabling this flag will pull in sys-apps/dbus automatically. This is the default for desktop profiles:

FILE /etc/portage/make.confEnabling D-Bus globally

USE flags for sys-apps/dbus A message bus system, a simple way for applications to talk to each other

X Add support for X11
debug Enable extra debug codepaths, like asserts and extra output. If you want to get meaningful backtraces see https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Backtraces
doc Add extra documentation (API, Javadoc, etc). It is recommended to enable per package instead of globally
elogind Use sys-auth/elogind for session tracking.
selinux !!internal use only!! Security Enhanced Linux support, this must be set by the selinux profile or breakage will occur
static-libs Build static versions of dynamic libraries as well
systemd Build with sys-apps/systemd at_console support
test Enable dependencies and/or preparations necessary to run tests (usually controlled by FEATURES=test but can be toggled independently)


After setting the dbus global USE flag be sure to update the system using the --changed-use option:

root #emerge --ask --changed-use --deep @world



The main configuration files include:

  • /usr/share/dbus-1/system.conf for the system bus
  • /usr/share/dbus-1/session.conf for the session bus



After configuration step, start D-Bus with:

root #/etc/init.d/dbus start

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

root #rc-update add dbus default
Even without adding D-Bus to the default runlevel it often will get started by D-Bus dependent services. This should explain why D-Bus mysteriously gets started even though it has not been formally added to a system runlevel.


Some useful commands include:

  • dbus-monitor --system - To monitor the activities in the system bus.
  • dbus-monitor --session - To monitor the activities in the session bus.
  • dbus-send <PARAMETER> - To send a message. See the dbus-send man page (man dbus-send) for more information.

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

user $dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.PowerOff boolean:false
user $dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.Reboot boolean:false

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


If using startx / .xinitrc instead of a display manager, the following is needed:

FILE ~/.xinitrc
exec dbus-launch --exit-with-session <WINDOW_MANAGER>


Use the dbus-monitor command to monitor the buses. Errors are also redirected to the syslog (/var/log/messages).

See also

External resources