Products › lamco-dbus-tools › Interfaces

D-Bus pcap and pcapng files: busctl capture, dbus-monitor --pcap

D-Bus pcap and pcapng files from busctl capture and dbus-monitor --pcap open in Wireshark, and lamco-dbus-tools reads them into a capture and writes them back.

File format busctl capture, dbus-monitor --pcap

The pcap and pcapng files of D-Bus messages are the standard way to keep a bus's traffic: busctl capture writes pcapng, dbus-monitor --pcap writes classic pcap, and Wireshark opens both and decodes each message. They're what a developer is most likely to be sent, or asked for, in a bug report. lamco-dbus-tools reads either into its own capture format, so every analysis runs on a file someone else took, and writes pcapng back out, so its recordings open in Wireshark.

What it is

Both formats hold packets, each with a stamp and the bytes, under a link type that says what the bytes are. For D-Bus the link type is 231, raw D-Bus messages, listed in the tcpdump.org link-type registry: Each packet is one whole message, header and body, exactly as it was marshalled, so a reader decodes it with the specification's wire format. pcapng adds sections, interfaces with their own stamp resolution, and comments on sections and packets. Classic pcap has one header and then the packets.

What the files don't carry matters as much as what they do:

  • A packet's stamp is the writing tool's wall clock, which can jump. It isn't the bus's time, and two files from two machines can't be set against each other by it.
  • Nothing says which machine or bus the file came from, or which implementation served it.
  • There's no snapshot of who owned which name, so a message to :1.42 can't be tied to a program unless the file holds the name changes that explain it.
  • Nothing says what the writer was asked to record, so a missing message can't be told from one that was never matched.

A file holds bodies whole, values and all. A capture taken from a real session can hold passwords, tokens and file names.

How lamco-dbus-tools reads it

dbussee record --pcap also writes each message's bytes, exactly as the bus sent them, to a pcapng file beside the recording: One interface of link type 231 with nanosecond stamps, each packet's comment naming its record. dbusdo doesn't read or write the files. dbustell import reads a pcapng or classic pcap file into a capture through the same header reader a recording uses, keeps the stamps as the writer's wall clock, and says what the file can't tell. A file that isn't a D-Bus capture is refused whole. dbustell export rebuilds each message from its record into pcapng. A message whose body wasn't kept as bytes is left out and counted, so record with --bodies raw to export everything.

dbussee record --all --duration 10 --pcap rec.pcapng --out rec.json   # a recording, and its bytes as pcapng
dbustell import session.pcapng --out session.json                     # busctl capture's file into a capture
dbustell import monitor.pcap --bodies decoded --out monitor.json      # dbus-monitor --pcap's file, values kept
dbustell timing session.json                                          # any analysis, on the imported file
dbustell scrub rec.json --out rec-clean.json                          # remove bodies and replace names first
dbustell export rec-clean.json --out rec.pcapng                       # then write pcapng for Wireshark

dbustell scrub removes every message body and replaces the host name, user names in home directories and mail addresses. Read a scrubbed capture before you post it: It can't find a person's name written in a well-known name or an object path.

Where it has been run

The README's run record lists the standard files both ways on private buses with dbus-daemon 1.16.2 and dbus-broker 37 on 2026-11-28: 16 messages rebuilt with every value the same, and busctl's and dbus-monitor's files read whole. The use case "An upgrade that slowed a call", which exports and imports pcapng, was run from its own recording among the use cases run between 2026-11-30 and 2026-12-02.

Findings

  • INS-001: The capture does not fully name its clock.
  • INS-004: The times are another tool's wall clock.

Related