dbus-1.12.16

#### Beyond Linux® From Scratch (systemd Edition) - Version 9.0

### Chapter 12. System Utilities

- Prev

  cups-pk-helper-0.2.6

- Next

  Fcron-3.2.1

- Up
- Home

# dbus-1.12.16

## Introduction to D-Bus

Even though D-Bus was built in LFS, there are some features provided by the package that other BLFS packages need, but their dependencies didn't fit into LFS.

This package is known to build and work properly using an LFS-9.0 platform.

### Package Information

- Download (HTTP): https://dbus.freedesktop.org/releases/dbus/dbus-1.12.16.tar.gz

- Download MD5 sum: 2dbeae80dfc9e3632320c6a53d5e8890

- Download size: 2.0 MB

- Estimated disk space required: 21 MB (add 17 MB for the tests)

- Estimated build time: 0.3 SBU (add 8.5 SBU for the tests)

### D-Bus Dependencies

#### Required

Systemd-241

#### Recommended

Xorg Libraries (for dbus-launch program)

#### Optional

For the tests: dbus-glib-0.110, D-Bus Python-1.2.8, PyGObject-3.32.2, and Valgrind-3.15.0; for documentation: Doxygen-1.8.16, xmlto-0.0.28, Ducktype, and Yelp Tools

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

## Installation of D-Bus

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                 \
                --enable-user-session                \
                --disable-doxygen-docs               \
                --disable-xml-docs                   \
                --disable-static                     \
                --docdir=/usr/share/doc/dbus-1.12.16 \
                --with-console-auth-dir=/run/console \
                --with-system-pid-file=/run/dbus/pid \
                --with-system-socket=/run/dbus/system_bus_socket &&
    make

See below for test instructions.

### Warning

Installing the package will override all files installed by D-Bus in LFS. It is critical that nothing uses D-Bus libraries or programs during the installation. The best way to ensure that these libraries are not being used is to run the installation in rescue mode. To switch to rescue mode, run the following command as the `root` user (from a TTY):

    systemctl start rescue.target

Now, as the `root` user:

    make install

The shared library needs to be moved to `/lib`, and as a result the `.so` file in `/usr/lib` will need to be recreated. Run the following command as the `root` user:

    mv -v /usr/lib/libdbus-1.so.* /lib &&
    ln -sfv ../../lib/$(readlink /usr/lib/libdbus-1.so) /usr/lib/libdbus-1.so

If you are using a DESTDIR install, dbus-daemon-launch-helper needs to be fixed afterwards. Issue, as `root` user:

    chown -v root:messagebus /usr/libexec/dbus-daemon-launch-helper &&
    chmod -v      4750       /usr/libexec/dbus-daemon-launch-helper

If not in chroot, at this point, you should reload the systemd daemon, and reenter multi-user mode with the following commands (as the `root` user):

    systemctl daemon-reload
    systemctl start multi-user.target

The dbus tests cannot be run until after dbus-glib-0.110 has been installed. They must be run as an unprivileged user from a local session with bus address. To run the standard tests issue make check.

If you want to run the unit regression tests, configure requires additional parameters which expose additional functionality in the binaries that 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         \
                --enable-asserts       \
                --disable-doxygen-docs \
                --disable-xml-docs     &&
    make                               &&
    make check

The test test-bus.sh is known to fail. There has also been reports 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 ignored.

## Command Explanations

`--disable-doxygen-docs`: This switch disables doxygen documentation build and install, if you have doxygen installed. If doxygen is installed, and you wish to build them, remove this parameter.

`--disable-xml-docs`: This switch disables html documentation build and install, if you have xmlto installed. If xmlto is installed, and you wish to build them, remove this parameter.

`--disable-static`: This switch prevents installation of static versions of the libraries.

`--enable-user-session`: This parameter enables per-user DBus sessions with systemd.

`--with-console-auth-dir=/run/console/`: This parameter specifies the directory to check for console ownerhip.

`--with-system-pid-file=/run/dbus/pid`: This parameter specifies the location of the PID file.

`--with-system-socket=/run/dbus/system_bus_socket`: This parameter specifies the location of the system bus socket.

`--enable-tests`: Build extra parts of the code to support all tests. Do not use on a production build.

`--enable-embedded-tests`: Build extra parts of the code to support only unit tests. Do not use on a production build.

`--enable-asserts`: Enable 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 build.

## Configuring D-Bus

### 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

### D-Bus Session Daemon

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.

- 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.

- 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 be 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

A list of the installed files, along with their short descriptions can be found at ../../../../lfs/view/9.0-systemd/chapter06/dbus.html#contents-dbus.

Last updated on 2019-08-17 15:49:15 -0700

- Prev

  cups-pk-helper-0.2.6

- Next

  Fcron-3.2.1

- Up
- Home