Products › lamco-dbus-tools › Docs

Record your first D-Bus traffic: A dbussee tutorial

Record your first D-Bus traffic: A tutorial that records one desktop notification with dbussee, reads it back with dbustell and catches an error in a ring.

Describes version 0.4.1. Run again step by step on the final build on 2026-12-02, in Fedora 45's GNOME session on dbus-broker (docs/measurements/stage-13/tutorials/).

This lesson takes you from nothing to a recording of one desktop notification, read back and seen live. It needs a desktop session with a notification daemon, and notify-send, which most desktops have. It takes a few minutes and changes nothing on your machine.

1. Build the programs

git clone <the repository> lamco-dbus-tools
cd lamco-dbus-tools
cargo build --release
export PATH=$PWD/target/release:$PATH

2. Look at your bus first

dbussee bus

It says which program your session bus is, how it knows, and what the bus says of itself. Then:

dbussee names

It lists every well-known name on the bus, who owns it, and the process and unit behind each. Look for org.freedesktop.Notifications: That's the program that will show your notification.

Neither command listens to traffic. They only ask the bus, and nothing they send can start a service.

3. Record one service

In one terminal:

dbussee record --service org.freedesktop.Notifications --duration 15 --out notify.json

Within those 15 seconds, in another terminal:

notify-send "Hello" "from my first recording"

When the first command ends it says how many messages it recorded and why it stopped.

--service asked the bus for what that one name sends and what's sent to it, and nothing else. A recording always asks for only what you name, because the bus copies every matching message to it, and copying costs the bus work. --all would take everything, and it's never the default.

On dbus-broker, as on Fedora, the recording says before it starts:

Note: This bus is dbus-broker, which never applies a rule's destination, so `destination='org.freedesktop.Notifications'` will take messages sent to anyone, and --service everything. With dbuskeep keeping the bus, --rules-as-specified applies it as the specification says.

dbus-broker ignores the half of the rule that names a destination, so there it takes everything, 68 messages in those 15 seconds on Fedora. The recording is still right about what it holds, and says so again as finding BUS-004. With dbuskeep run keeping the bus, --rules-as-specified has the service apply the rule as written (match rules).

4. Read it back

dbustell health notify.json

It gives the bus, who was on it when the recording began, and any findings. The messages themselves are records in the file. With jq:

jq -c '.records[] | select(.mechanism_id == "bus-messages") | .payload.map
       | map({(.[0]): .[1]}) | add | {type: .type.map[1][1].str, sender: (.sender.str? // null),
         destination: (.destination.str? // null), member: (.member.str? // null)}' notify.json

You'll see the call to Notify from notify-send's connection, its reply with the notification's number, and perhaps signals the daemon sent after. On GNOME the call goes to gjs, which owns the name and passes it on to the shell, so there are two Notify calls, one each way of the hand-off. A field the message hasn't, as a reply's member, is null. Each record's stamp is when the recorder read the message: D-Bus messages carry no time of their own.

The notification's text isn't in the file. A body is kept as its length unless you ask for more, since a body can hold a password as easily as a greeting. Record again with --bodies decoded and the text is there.

5. Watch it live

dbussee watch --service org.freedesktop.Notifications

Send another notification and watch the lines appear: The time, the type of each message, who sent it to whom, and what it is. Ctrl-C ends it.

6. Catch something that goes wrong

A ring keeps only the last minutes and writes them when something goes wrong:

dbussee record --all --ring 60 --on-error --duration 0 --out caught.json

In another terminal, ask the bus for a name nobody owns:

busctl --user call org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus GetNameOwner s no.such.name

The bus answers with an error, the ring fires, records five seconds more, and writes caught.json: The minute before the error and what followed it. The ring's own record says what fired it:

jq -c '.records[] | select(.member == "ring") | .payload.map | map({(.[0]): .[1]}) | add | .fired_by' caught.json

{"str":"the error org.freedesktop.DBus.Error.NameHasNoOwner from org.freedesktop.DBus to :1.115"}, with the connection's name that day.

What you've done

You've read a bus without touching its services, recorded one service's traffic without its contents, seen it live, and caught an error with what led up to it. Recording a bus has the rest: Long recordings as streams, files for Wireshark, reading what busctl capture wrote, and finding calls that are stuck. Doing no harm says what a recording costs the bus, and how the recorder keeps from harming it.