D-BUS-1.0.2

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

Required

expat-2.0.1 or both pkg-config-0.22 and libxml2-2.6.31

Optional

X Window System, Doxygen-1.5.2 (to generate the API documentation), and xmlto (to generate HTML documentation and manuals)

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

This package's test suite cannot be run without 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, so it will have to be built twice in this situation. If you would like to run the unit tests, issue the following commands:

./configure --enable-tests &&
make &&
make check &&
make distclean

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 &&
make

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

Now, as the root user:

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

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

install -v -m644 doc/*.html /usr/share/doc/dbus-1.0.2

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-1.0.2/api \
    /usr/share/man/man3dbus &&
install -v -m644 doc/api/html/* \
    /usr/share/doc/dbus-1.0.2/api &&
install -v -m644 doc/api/man/man3dbus/* \
    /usr/share/man/man3dbus

Command Explanations

--localstatedir=/var: This parameter causes the daemon PID file, system bus socket and machine uuid file to be created in the /var directory instead of the /usr/var directory.

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"
 "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>

  <!-- Search for .service files in /usr/local -->
  <servicedir>/usr/local/share/dbus-1/services</servicedir>

</busconfig>
EOF

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-20080816 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`
    export DBUS_SESSION_BUS_ADDRESS
    

    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
    kill $DBUS_SESSION_BUS_PID
    
  • 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.

Contents

Installed Programs: dbus-cleanup-sockets, dbus-daemon, dbus-launch, dbus-monitor, dbus-send, dbus-uuidgen
Installed Library: libdbus-1.{so,a}
Installed Directories: /etc/dbus-1, /usr/include/dbus-1.0, /usr/lib/dbus-1.0, /usr/share/dbus-1, /usr/share/doc/dbus-1.0.2, /usr/share/man/man3dbus, /var/lib/dbus and /var/run/dbus

Short Descriptions

dbus-cleanup-sockets

is used to clean up leftover sockets in a directory.

dbus-daemon

is the D-BUS message bus daemon.

dbus-launch

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

dbus-monitor

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

dbus-send

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

dbus-uuidgen

is used to generate or read a universally unique ID.

libdbus-1.{so,a}

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-07-21 17:17:44 -0500