Linux: List all available services at dbus

Hi,

the following commands lists all services connected to dbus system and current session bus:
For the systen bus enter

michael@debdevt:~ $ dbus-send --system --dest=org.freedesktop.DBus --type=method_call --print-reply /org/freedesktop/DBus org.freedesktop.DBus.ListNames

and for the current session

michael@debdevt:~ $ dbus-send --session --dest=org.freedesktop.DBus --type=method_call --print-reply /org/freedesktop/DBus org.freedesktop.DBus.ListNames

In non X11 environment you have to establish a dbus session bus instance first

if test -z "$DBUS_SESSION_BUS_ADDRESS" ; then
      eval `dbus-launch --sh-syntax`
      echo "D-Bus per-session daemon address is: $DBUS_SESSION_BUS_ADDRESS"
fi

Otherwise you got the error message “Failed to open connection to session bus: /usr/bin/dbus-launch terminated abnormally with the following error: Autolaunch error: X11 initialization failed.”

If you prefare a graphical tool use qdbusviewer from the qttools5-dev-tools package

root@debdevt:~ # apt-get install qt5-default qttools5-dev-tools
root@debdevt:~ # qdbusviewer &

Linux qdbusviewer
Linux qdbusviewer

Michael

Leave a Reply