Introduction to D-BUS

D-BUS is a message bus system, a simple way for applications to talk to one another. D-BUS supplies both a system daemon (for events such as “new hardware device added” or “printer queue changed”) and a per-user-login-session daemon (for general IPC needs among user applications). Also, the message bus is built on top of a general one-to-one message passing framework, which can be used by any two applications to communicate directly (without going through the message bus daemon).

Package Information

D-BUS Dependencies


pkg-config-0.20, expat-2.0.0 or libxml2-2.6.26, GLib-2.10.3, GTK+-2.8.20, Qt-3.3.7, Qt-4.x.x, X Window System, GCC-4.0.3 (for the Java compiler and tools), Pyrex (version is known to work and requires Python-2.4.4), GtkSharp-1.0.x (requires Mono), Monodoc, Doxygen-1.4.6 (to generate the API documentation), and xmlto (to generate HTML documentation and manuals)

Listed below are some additional notes about the dependencies

  • Review the information from running ./configure --help for the available parameters to pass to the configure script to enable the various dependencies.

  • To build the Mono bindings, you must have GtkSharp installed. If you wish to use recent versions of GtkSharp, you'll need to make some trivial patches to the D-BUS sources. See http://www.mono-project.com/GtkSharpUpgrade for details.

  • If you have a recent version of Monodoc installed (>= 1.1.10) and you passed the --enable-mono-docs parameter to configure, the D-BUS build will fail. You can review the parts of this patch (http://www.mail-archive.com/frugalware-darcs@frugalware.org/msg10156.html) that apply to the Monodoc installation, to fix the build problems. Note this is untested by the BLFS Team, but should work just fine.

HAL Requirements

GLib-2.10.3 must be installed before you begin building D-BUS if you plan on installing HAL- GLib is required to build the libdbus-glib library, which is required by the HAL daemon.

If you plan on using HAL with KDE, you'll need to link D-BUS with the Qt libraries. Ensure you've installed Qt before beginning the D-BUS installation.

If you desire to use the hal-device-manager program, Pyrex (note the known working version listed in the dependencies) must be installed before you begin building D-BUS as the D-BUS Python bindings are required. You will also need to remove the --disable-python parameter from the configure command in the instructions below.

User Notes: http://wiki.linuxfromscratch.org/blfs/wiki/dbus

Kernel Configuration

Ensure the following option is enabled in the kernel configuration and recompile the kernel if necessary:

General Setup
  System V IPC

Installation of D-BUS

As the root user, create a system user and group to handle the system message bus activity:

groupadd -g 18 messagebus &&
useradd -c "D-BUS Message Daemon User" -d /dev/null \
        -u 18 -g messagebus -s /bin/false messagebus

Install D-BUS by running the following commands (you may wish to review the output from ./configure --help first and add any desired parameters to the configure command shown below):

./configure --prefix=/usr \
            --sysconfdir=/etc \
            --localstatedir=/var \
            --disable-python &&

The --enable-doxygen-docs parameter does not work properly. If you have Doxygen installed and you wish to build the API documentation, issue doxygen.

This package's test suite cannot be run without passing additional parameters to configure. These parameters are not intended to be used in a production build of D-BUS so you will have to build twice (issuing make distclean after the first build) if you want to run the regression tests.

Now, as the root user:

make install &&
install -v -m755 -d /usr/share/doc/dbus-0.62 &&
install -v -m644 doc/{TODO,*.{dtd,xml,xsl,html,txt,c}} \

If you built the API documentation, install it by issuing the following commands as the root user:

install -v -m755 -d /usr/share/doc/dbus-0.62/api &&
install -v -m644 doc/api/html/* \

Command Explanations

--localstatedir=/var: This parameter causes the daemon PID file to be created in /var/run/dbus instead of /usr/var/run/dbus.

--disable-python: This parameter is required if Python is not installed. Remove the parameter if Python (and Pyrex) is installed and you wish to build the Python bindings.

Configuring dbus

Config Files

/etc/dbus-1/session.conf, /etc/dbus-1/system.conf and /etc/dbus-1/system.d/*

Configuration Information

The configuration files listed above should probably not be modified. If changes are required, you should create /etc/dbus-1/session-local.conf and/or /etc/dbus-1/system-local.conf and make any desired changes to these files.

If any packages install a D-Bus .service file outside of the standard /usr/share/dbus-1/services directory, that directory should be added to the local session configuration. For instance, /usr/local/share/dbus-1/services can be added by performing the following commands as the root user:

cat > /etc/dbus-1/session-local.conf << "EOF"
<!DOCTYPE busconfig PUBLIC
 "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"

  <!-- Search for .service files in /usr/local -->


Boot Script

To automatically start dbus-daemon when the system is rebooted, install the /etc/rc.d/init.d/dbus bootscript from the blfs-bootscripts-20060910 package.

make install-dbus

Note that this boot script only starts the system-wide D-BUS daemon. Each user requiring access to D-BUS services will also need to run a session daemon as well. There are many methods you can use to start a session daemon using the dbus-launch command. Review the dbus-launch man page for details about the available parameters and options. Here are some suggestions and examples:

  • Add dbus-launch to the line in the ~/.xinitrc file that starts your graphical desktop environment as shown in the section called “Configuring the Core GNOME Packages”.

  • If you use xdm or some other display manager that calls the ~/.xsession file, you can add dbus-launch to the line in your ~/.xsession file that starts your graphical desktop environment. The syntax would be similar to the example in the ~/.xinitrc file.

  • If you use gdm or some other display manager that utilizes custom files to initiate sessions, use the example in the section called “Configuration Information” of the GDM instructions to create a file containing dbus-launch.

  • The examples shown previously use dbus-launch to specify a program to be run. This has the benefit (when also using the --exit-with-session parameter) of stopping the session daemon when the specified program is stopped. You can also start the session daemon in your system or personal startup scripts by adding the following lines:

    # Start the D-BUS session daemon
    eval `dbus-launch`

    This method will not stop the session daemon when you exit your shell, therefore you should add the following line to your ~/.bash_logout file:

    # Kill the D-BUS session daemon
  • A hint has been written that provides ways to start scripts using the KDM session manager of KDE. The concepts in this hint could possibly used with other session managers as well. The hint is located at http://www.linuxfromscratch.org/hints/downloads/files/execute-session-scripts-using-kdm.txt.


Installed Programs: dbus-binding-tool, dbus-cleanup-sockets, dbus-daemon, dbus-launch, dbus-monitor, dbus-send and dbus-viewer
Installed Libraries: libdbus-1.{so,a} and optionally, dbus-1.jar, libdbus-gcj-1.{so,a}, libdbus-glib-1.{so,a}, libdbus-qt-1.{so,a}, libdbus-qt4-1.{so,a}, libdbus-mono-1.{so,a} and Python modules
Installed Directories: /etc/dbus-1, /usr/include/dbus-1.0, /usr/lib/dbus-1.0, /usr/lib/python2.4/site-packages/dbus, /usr/share/dbus-1, /usr/share/doc/dbus-0.62 and /var/run/dbus

Short Descriptions


is used to create header files from GLib object files.


is used to clean up leftover sockets in a directory.


is the D-BUS message bus daemon.


is used to start dbus-daemon from a shell script. It would normally be called from a user's login scripts.


is used to monitor messages going through a D-BUS message bus.


is used to send a message to a D-BUS message bus.


is a graphical D-BUS frontend utility.


contains the API functions used by the D-BUS message daemon. D-BUS is first a library that provides one-to-one communication between any two applications; dbus-daemon is an application that uses this library to implement a message bus daemon.

Last updated on 2007-02-01 13:44:24 -0600