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).
This package is known to build and work properly using an LFS-7.6
Download MD5 sum: dfb810eda8780cf9debf7169b3ca5fe1
Download size: 1.8 MB
Estimated disk space required: 28 MB (additional 81 MB to
build and install the doxygen and xmlto documentations, and 8
MB for the tests)
Estimated build time: 0.3 SBU (additional 0.6 SBU for the
Libraries (for dbus-launch program)
For the tests: dbus-glib-0.102, D-Bus
Python-1.2.0, and PyGObject-2.28.6; for the development
documentation: Doxygen-126.96.36.199; for man pages and XML/HTML
User Notes: http://wiki.linuxfromscratch.org/blfs/wiki/dbus
Installation of D-Bus
If they do not already exist, 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 /var/run/dbus \
-u 18 -g messagebus -s /bin/false messagebus
Install D-Bus by running the
following commands (you may wish to review the output from
first and add any desired parameters to the configure command shown below):
./configure --prefix=/usr \
See below for test instructions.
Now, as the
If you are still building your system in chroot or you did not
start the daemon yet, but you want to compile some packages that
require D-Bus, generate
D-Bus UUID to avoid warnings when
compiling some packages with the following command as the
The dbus tests cannot be run until after dbus-glib-0.102 has
been installed. They must be run as an unprivileged user from a
local session with bus address. Tests fail through ssh. If you want
to run only the unit tests, replace, below,
D-Bus Python-1.2.0 has to be installed, before.
The tests require passing additional parameters to configure and exposing additional
functionality in the binaries. These interfaces are not intended to
be used in a production build of D-Bus. If you would like to run the tests,
issue the following commands (for the tests, you don't need to
build the docs):
make distclean &&
./configure --enable-tests \
If run-test.sh fails,
it can be disabled with the following sed, before running the
commands for the tests:
sed -i -e 's:run-test.sh:$(NULL):g' test/name-test/Makefile.in
Note there has been a report that the tests may fail if running
inside a Midnight Commander shell. You may get out-of-memory error
messages when running the tests. These are normal and can be safely
This switch disables doxygen documentation build and install, if
you have doxygen installed.
Delete, if doxygen is installed
and you wish to build and install them.
switch disables html documentation build and install, if you have
xmlto installed. Delete, if
xmlto is installed and you wish to
build and install them.
switch prevents installation of static versions of the libraries.
switch disables systemd support in D-Bus.
switch prevents installation of systemd unit files.
This parameter specifies location of the ConsoleKit auth dir.
--enable-tests: Build extra
parts of the code to support all tests. Configure will end with a
NOTE warning about increased size of libraries and decreased
Build extra parts of the code to support only unit tests. Configure
will end with a NOTE warning about increased size of libraries and
debugging code to run assertions for statements normally assumed to
be true. This prevents a warning that '
--enable-tests' on its own is only
useful for profiling and might not give true results for all tests,
but adds its own NOTE that this should not be used in a production
The configuration files listed above should probably not be
modified. If changes are required, you should create
make any desired changes to these files.
If any packages install a D-Bus
.service file outside of the
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
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 -->
To automatically start dbus-daemon when the system is
rebooted, install the
/etc/rc.d/init.d/dbus bootscript from the
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
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
~/.xinitrc file that
starts your graphical desktop environment.
If you use xdm or some other display
manager that calls the
~/.xsession file, you can add
to the line in your
~/.xsession file that starts your
graphical desktop environment. The syntax would be similar
to the example in the
The examples shown previously use dbus-launch to specify a
program to be run. This has the benefit (when also using
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
This method will not stop the session daemon when you exit
your shell, therefore you should add the following line to
# 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 be used with other session managers as
well. The hint is located at
dbus-launch, dbus-monitor, dbus-run-session, dbus-send and
/usr/share/doc/dbus-1.8.14, /var/lib/dbus and
is used to clean up leftover sockets in a directory.
is the D-Bus message bus
is used to start dbus-daemon from a
shell script. It would normally be called from a user's
is used to monitor messages going through a D-Bus message bus.
start a process as a new D-Bus session.
is used to send a message to a D-Bus message bus.
is used to generate a universally unique ID.
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
Last updated on 2015-01-10 13:46:42 +0000