Products › lamco-dbus-tools › Docs

Record the D-Bus system bus as an ordinary user

Record the D-Bus system bus as an ordinary user: Install the dbussee-monitor helper for one group, record as yourself, and handle dbus-daemon before 1.16.4.

Describes version 0.4.1.

The system bus lets only a privileged connection listen. Install the helper once, as root, and give the right to the users who need it:

cargo build --release
sudo scripts/install-helper target/release/dbussee-monitor
sudo usermod -aG lamco-dbus-monitor "$USER"

Log in again so the group counts, then record as yourself:

dbussee record --bus system --service org.freedesktop.NetworkManager --duration 30 --out nm.json
dbustell health nm.json
dbustell timing nm.json

record uses the helper by itself for the system bus when it isn't run as root. Every other flag works as it does on the session bus. A command that's slow the first time does this on Debian 13, start to finish, and takes it all away again.

On a dbus-daemon older than 1.16.4

Debian 13 ships dbus-daemon 1.16.2, which has a flaw by which an unprivileged user could crash the system bus while a privileged monitor is attached. record, and the helper itself, refuse to attach one there:

This system bus is dbus-daemon 1.16.2. Before 1.16.4 an unprivileged user could crash a system bus while a
privileged monitor was attached to it (finding BUS-003), so record doesn't attach one. ... Give
--accept-known-flaw to go on.

A distribution may have patched the flaw without changing the version. Check your distribution's security tracker for dbus, and when you accept the risk for a short recording:

dbussee record --bus system --service org.freedesktop.login1 --duration 30 --accept-known-flaw --out login.json

If it's refused

Only a privileged connection may listen to the system bus. The helper at ... didn't run with privilege means the helper found isn't the installed one, or you aren't in the group yet, or haven't logged in again since joining it. id lists your groups.

The helper on its own

dbussee record runs the helper for you. It can also be run by itself, as any program that wants a guarded monitor might, reading what it writes:

$ ( sleep 1.5 ) | dbussee-monitor listen --address "$DBUS_SESSION_BUS_ADDRESS" --match "type='signal'" --budget-bytes 65536 > frames.bin
$ od -c frames.bin | head -2
0000000   L   D   T   M   1  \n   H 251  \0  \0  \0   {   "   u   n   i
0000020   q   u   e   _   n   a   m   e   "   :   "   :   1   .   0   "

On a system bus older than 1.16.4 it takes --accept-known-flaw too, as record passes it on. It listens until its standard input closes, here after a second and a half, and writes the bytes LDTM1, then frames: A hello naming its connection, its rules and budget, then each message, then an end (the helper's frames). --match takes rules as record does, --all everything, and --budget-bytes is what may wait for its reader before it detaches itself. Run on a private session bus (docs/measurements/stage-13/helper/), with one signal sent while it listened: 1,563 bytes.

Removing it

sudo scripts/install-helper --uninstall
sudo gpasswd -d "$USER" lamco-dbus-monitor
sudo groupdel lamco-dbus-monitor

The helper, dbussee-monitor says what the helper does with its privilege, and why.