david@david-t2 ~/dev/kdbus $ busctl monitor
Monitoring bus message stream.
 Type=signal  Endian=l  Flags=1  Version=2  Priority=0 Cookie=-1
  Sender=org.freedesktop.DBus  Path=/org/freedesktop/DBus  Interface=org.freedesktop.DBus  Member=NameOwnerChanged
  Monotonic=21122678158  Realtime=1438248540378044  SequenceNumber=98386
  UniqueName=org.freedesktop.DBus  WellKnownNames=org.freedesktop.DBus
  MESSAGE "sss" {
          STRING ":1.98385";
          STRING "";
          STRING ":1.98385";
  };

 Type=method_call  Endian=l  Flags=0  Version=2  Priority=0 Cookie=1
  Sender=:1.98385  Destination=org.freedesktop.locale1  Path=/org/freedesktop/locale1  Interface=org.freedesktop.DBus.Properties  Member=GetAll
  Monotonic=21122678639  Realtime=1438248540378525  SequenceNumber=98387
  PID=21611  TID=21611  PPID=8014
  UID=1000  EUID=1000  SUID=1000  FSUID=1000  OwnerUID=1000  GID=1000  EGID=1000  SGID=1000  FSGID=1000  SupplementaryGIDs=91 190 1000
  Comm=localectl  TIDComm=localectl  Exe=/usr/bin/localectl
  CommandLine=localectl  Description=sd-system-localectl
  CGroup=/user.slice/user-1000.slice/session-c1.scope  Unit=session-c1.scope  Slice=user-1000.slice  UserUnit=n/a  Session=c1
  UniqueName=:1.98385  WellKnownNames=
  EffectiveCapabilities=
  PermittedCapabilities=
  InheritableCapabilities=
  BoundingCapabilities=cap_chown cap_dac_override cap_dac_read_search 
          cap_fowner cap_fsetid cap_kill cap_setgid 
          cap_setuid cap_setpcap cap_linux_immutable cap_net_bind_service 
          cap_net_broadcast cap_net_admin cap_net_raw cap_ipc_lock 
          cap_ipc_owner cap_sys_module cap_sys_rawio cap_sys_chroot 
          cap_sys_ptrace cap_sys_pacct cap_sys_admin cap_sys_boot 
          cap_sys_nice cap_sys_resource cap_sys_time cap_sys_tty_config 
          cap_mknod cap_lease cap_audit_write cap_audit_control 
          cap_setfcap cap_mac_override cap_mac_admin cap_syslog 
          cap_wake_alarm cap_block_suspend cap_audit_read
  MESSAGE "s" {
          STRING "";
  };

 Type=method_return  Endian=l  Flags=1  Version=2  Priority=0 Cookie=2  ReplyCookie=1
  Sender=:1.98376  Destination=:1.98385
  Monotonic=21122679054  Realtime=1438248540378940  SequenceNumber=98388
  PID=21609  TID=21609  PPID=1
  UID=0  EUID=0  SUID=0  FSUID=0  GID=0  EGID=0  SGID=0  FSGID=0  SupplementaryGIDs=
  Comm=systemd-localed  TIDComm=systemd-localed
  CommandLine=/usr/lib/systemd/systemd-localed  Description=sd-system-systemd_2dlocaled
  CGroup=/system.slice/systemd-localed.service  Unit=systemd-localed.service  Slice=system.slice  UserUnit=n/a  Session=n/a
  UniqueName=:1.98376  WellKnownNames=org.freedesktop.locale1
  EffectiveCapabilities=
  PermittedCapabilities=
  InheritableCapabilities=
  BoundingCapabilities=
  MESSAGE "a{sv}" {
          ARRAY "{sv}" {
                  DICT_ENTRY "sv" {
                          STRING "Locale";
                          VARIANT "as" {
                                  ARRAY "s" {
                                          STRING "LANG=en_US.UTF-8";
                                  };
                          };
                  };
                  DICT_ENTRY "sv" {
                          STRING "VConsoleKeymap";
                          VARIANT "s" {
                                  STRING "de-latin1-nodeadkeys";
                          };
                  };
                  DICT_ENTRY "sv" {
                          STRING "VConsoleKeymapToggle";
                          VARIANT "s" {
                                  STRING "";
                          };
                  };
          };
  };

 Type=signal  Endian=l  Flags=1  Version=2  Priority=0 Cookie=-1
  Sender=org.freedesktop.DBus  Path=/org/freedesktop/DBus  Interface=org.freedesktop.DBus  Member=NameOwnerChanged
  Monotonic=21122679612  Realtime=1438248540379497  SequenceNumber=98389
  UniqueName=org.freedesktop.DBus  WellKnownNames=org.freedesktop.DBus
  MESSAGE "sss" {
          STRING ":1.98385";
          STRING ":1.98385";
          STRING "";
  };

^C
david@david-t2 ~/dev/kdbus $

kdbus

kdbus is a transport layer for the DBus IPC system. It is meant as replacement for the UDS (Unix Domain Socket) transport layer which is the de-facto default for local DBus communication. kdbus is not directly related to DBus, nor is it limited to transporting DBus messages. However, kdbus was designed specifically for DBus so it does exhibit DBus specific behavior. Further use-cases are possible, though.

With the kdbus transport layer, the dbus-daemon is no longer needed. kdbus provides a full bus transport and thus eliminates the bus manager that is implemented by dbus-daemon. Note that UDS also provides such a full bus transport, but lacks extended features like message tracking, policy handling, peer tracking and a name database. Hence, dbus-daemon is needed if UDS is used as transport.

Apart from providing a full bus transport, kdbus also extends DBus with new features. This includes reliable metadata transmission, simplified policy, single/zero-copy message transactions and namespaced endpoints.

Implementation

The kdbus.ko kernel module is available at git.kernel.org and included in linux-next. It implements the kdbus transport layer and exposes its API via a virtual file system, usually mounted at /sys/fs/kdbus.

Since version 221, systemd will automatically load the kdbus module (if available), mount kdbusfs and create the system and user bus via kdbus. A dbus1 compatibility daemon, called systemd-bus-proxyd, is spawned for each bus. It listens on the old UDS dbus1 socket and provides a compatibility layer to kdbus. Thus, legacy software will run on kdbus systems without any changes required.

systemd will read the kdbus={0,1} kernel command-line option and load kdbus only if it is set to 1. Otherwise, a legacy boot is done and kdbus will not be loaded nor used by your system. Hence, you can disable kdbus entirely by specifying kdbus=0 on your kernel command line. If the command line option is omitted, the default is used (which might be either, depending how systemd was compiled).

The sd-bus library supports both transports (dbus1 and kdbus) natively. Further native ports for gdbus and qt are underway.

Development:

Code repositories:

Documentation:

Testing

To run your system on kdbus, you need the kdbus kernel module installed and a recent systemd version:

You're highly recommended to run the newest version of both. Please extend your kernel command line with kdbus=1 to enable (and kdbus=0 to disable) kdbus.

Once you booted your system, you can use busctl to list bus users. If the DESCRIPTION column contains non-empty entries, you've successfully booted with kdbus enabled. You can also verify this by looking for a log message systemd[1]: Inserted module 'kdbus', or see whether /sys/fs/kdbus contains a sub-directory called 0-system.

If you encounter any issues, please report them to us via the systemd issues tracker at github.

Testing on Fedora

If you run Fedora Rawhide, then you already run a recent systemd version that supports kdbus. Furthermore, the Fedora Rawhide kernel includes the kdbus.ko kernel module. Hence, there is no need to install those manually. All you need is pass kdbus=1 on the kernel commandline (default for Rawhide is 0).

Testing on Arch Linux

The systemd package of Arch Linux includes all relevant code to run kdbus. All you need is to install the kdbus.ko kernel module and pass kdbus=1 on the kernel command line (default for Arch Linux is 0). We recommend using the kdbus-package from the AUR to build the kdbus.ko kernel module.

Compiling kdbus.ko

If your distribution does not ship a kdbus.ko kernel module, you need to compile it yourself. If you know how to compile your own kernel, all you need is to merge Greg's tree from kernel.org (or use the tree directly; or use linux-next).

If you do not want to compile your own kernel, you can use the out-of-tree kdbus.ko kernel module:

$ git clone https://github.com/systemd/kdbus.git     # clone the out-of-tree repository
$ cd kdbus                                           # enter repository
$ git checkout -f v4.1                               # checkout branch for kernel-4.1
$ make -j4                                           # build module
$ # make tt                                          # Optional: run test-suite
$ sudo make install                                  # install module into /lib/modules/`uname -r`/

Please use the branch according to your kernel version (See uname -r and pick branches v4.0, v4.1 or v4.2 accordingly; older releases are not supported). Please also always use git checkout -f <branch> or git reset --hard <branch> as all branches but master are rebased. Never use git pull or git merge!

If you don't want to deal with rebases, use the master branch. This branch tracks the upstream tree from Greg, but also only applies to the version Greg's tree is based on. The v4.X branches carry necessary reverts/changes for the given version.

Every time you update your kernel, you need to re-compile the kdbus.ko module for the new kernel. Your kernel will refuse to load modules not built explicitly for the given kernel.

Known issues

No known issues at the moment.

Common Problems

Kernel oopses and panics during boot

If you encounter kernel bugs during system boot, you might have hit a bug in the kdbus.ko module. However, chances are more likely you compiled the wrong kdbus.ko version. Please verify your kernel-headers are correctly installed, your build directory in /lib/modules/`uname -r`/build is consistent and you actually compiled the correct branch.

If you still see kernel bugs, please report them to us!