D-Bus

From Gentoo Wiki
Jump to: navigation, search

D-Bus is an interprocess communication (IPC) system for software applications; software makes use of D-Bus to communicate between services.

Installation

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="dbus"


Optional USE flags for sys-apps/dbus:
USE flag (what is that?) Default Recommended Description
X Yes Add support for X11
debug No Enable extra debug codepaths, like asserts and extra output. If you want to get meaningful backtraces see http://www.gentoo.org/proj/en/qa/backtraces.xml
doc No Add extra documentation (API, Javadoc, etc). It is recommended to enable per package instead of globally
static-libs No Build static versions of dynamic libraries as well
systemd No Build with sys-apps/systemd at_console support

Emerge

After setting at least the dbus global USE flag be sure update the system using --changed-use option so Portage will be sure to notice the changes:

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

Configuration

The main configuration files include:

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

Services

OpenRC

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
Tip
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 added formally added to a system runlevel.

Usage

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.

Troubleshooting

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

See also

  • eudev - A fork of systemd's udev with the goal of obtaining better compatibility with existing software such as OpenRC.
  • udev - The device manager for the Linux kernel.

External resources