Products › lamco-dbus-tools › Interfaces

org.freedesktop.DBus.Monitoring BecomeMonitor: Recording a D-Bus bus

org.freedesktop.DBus.Monitoring BecomeMonitor turns a connection into a D-Bus monitor, and lamco-dbus-tools records with it while guarding the bus it watches.

D-Bus method org.freedesktop.DBus.Monitoring.BecomeMonitor

org.freedesktop.DBus.Monitoring.BecomeMonitor is the method that turns a connection into a monitor: From then on the bus sends it a copy of every message its rules match, including calls and replies meant for others. dbus-monitor uses it, and so does every recording lamco-dbus-tools makes. What matters to anyone recording a busy bus is what the bus does when the monitor stops keeping up, and that's where the toolkit's guard comes in.

What it is

The method lives on /org/freedesktop/DBus under the optional interface org.freedesktop.DBus.Monitoring. It takes two arguments: An array of match rules and a UINT32 of flags, which must be 0. An empty array means every message. The specification says what happens next:

  • The connection loses all its bus names, its unique name included, and all its match rules.
  • It may no longer send messages. A monitor reads and nothing else.
  • Its rules are treated as if each said eavesdrop='true', so it may receive messages that should only have gone to another connection.
  • Only a user privileged on the bus may become a monitor. The definition is the implementation's own.

It replaced eavesdropping through AddMatch, which needed the bus's access rules relaxed and so changed what other connections could receive. The specification is plain that monitoring still costs the bus: It copies every matching message, and where there was barely enough time or memory, a delivery that would have succeeded can fail.

The two implementations differ in who may monitor and in what a monitor that stops reading does to the bus. On a session bus the user may monitor their own bus on both. On the system bus, dbus-daemon decides by policy, which an administrator can widen, and dbus-broker allows only root or its own account. The repository's measurements found that when a monitor stops reading, dbus-daemon stalls the sender, while dbus-broker fills the user's quota and disconnects the monitor, the sender and an unrelated program. dbus-daemon before 1.16.4 has a flaw that lets an unprivileged user crash a system bus while a privileged monitor is attached.

How lamco-dbus-tools reads it

dbussee record, watch and pending become a monitor with the rules --service, --match or --all build, and add one rule of their own for name owner changes. The reader only reads and stamps, and another thread writes. When more than the budget (--budget) waits to be written, the recorder closes its own connection before the bus has to act, and the capture says where it stopped. --helper has dbussee-monitor become the monitor in a process of its own, so a recorder stopped by a debugger can't make the bus stall. On a dbus-daemon system bus older than 1.16.4, recording is refused without --accept-known-flaw. dbuskeep run keeps the last minutes with one monitor, which other programs read through. dbusdo has nothing to do here: A monitor sends nothing. Every dbustell analysis reads what the monitor recorded.

dbussee record --all --duration 5 --out first.json          # five seconds of everything
dbussee watch --service org.freedesktop.Notifications       # a line for each message, as it passes
dbussee record --bus system --helper --duration 20 --out sys.json   # the system bus through the installed helper
dbustell health first.json                                  # how the recording ended, and its findings
dbuskeep run --window 900                                   # one monitor keeping the last 15 minutes

Where it has been run

The README's run record lists a ten-minute recording of an idle desktop's session bus on Debian 13 with Xfce (75 messages, the stream whole) on 2026-11-28, and of a desktop in use on RHEL 10 with GNOME 49 over RDP on dbus-broker (1,757 messages, the stream whole) on 2026-11-29. The system bus was recorded by an ordinary user through the installed helper on Debian 13 with dbus-daemon 1.16.2, after acknowledging the known flaw (734 messages), and on Fedora 45 with dbus-broker 37 (4,561), on 2026-11-29. On private buses with dbus-daemon 1.16.2 and dbus-broker 37, a slowed writer detached and an unrelated service was unharmed, and a recorder held stopped behind the helper left the sender done and an unrelated service answering. BUS-003 was reported on every dbus-daemon of the desktop runs.

Findings

  • BUS-003: This dbus-daemon has the monitoring flaw fixed in 1.16.4.
  • INS-002: The recording ended before it was asked to.
  • INS-003: Messages are missing from the recording.

Related