DebuggingDBus
|
⇤ ← Revision 1 as of 2010-05-07 13:26:40
Size: 2675
Comment: Initial explanation of how to view session/system bus
|
Size: 2713
Comment:
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 53: | Line 53: |
| {{{ sudo reboot }}} |
|
| Line 60: | Line 63: |
| sudo reboot |
This page is part of the debugging series — pages with debugging details for a variety of Ubuntu packages. |
Introduction
As more and more applications and system services use D-Bus, it becomes more important to know how to see what happens on the bus.
There are two buses commonly used: the session bus and the system bus. Either may be used by any application, depending on what it is doing.
How to monitor the session bus
This one is easy. Just run dbus-monitor and watch the output. This usually gives you enough information about what is happening on the bus.
dbus-monitor
If it's too much information, pass a watch expression like so:
dbus-monitor "type='signal',sender='org.gnome.TypingMonitor',interface='org.gnome.TypingMonitor'"
How to monitor the system bus
This is trickier, because D-Bus policy typically prevents anything but signals from being viewable by dbus-monitor. But we can change that.
- Make a backup of /etc/dbus-1/system.conf:
sudo cp /etc/dbus-1/system.conf /etc/dbus-1/system.conf~
- Edit /etc/dbus-1/system.conf
sudo editor /etc/dbus-1/system.conf
Find the <policy context="default"> section and replace it with the following block. This block opens up the system bus to viewing by anyone.
Note that this is not a safe policy! You should revert this change after you are done debugging.
<policy context="default"> <!-- Allow everything to be sent --> <allow send_destination="*" eavesdrop="true"/> <!-- Allow everything to be received --> <allow eavesdrop="true"/> <!-- Allow anyone to own anything --> <allow own="*"/> <allow user="*"/> </policy>Then comment out or delete the nearby <includedir> line. This line will include individual policies for specific services. But we don't want those individual policies to further restrict the bus. So we force our above lax policy by not including sub-policies.
<!-- <includedir>system.d</includedir> -->
- Reboot to get a fresh dbus daemon using this new policy.
sudo reboot
- Now run dbus-monitor as root. You should be able to see all signals, method calls, and method replies.
sudo dbus-monitor --system
- When done debugging, remember to go back to your previous, secure policy:
sudo cp /etc/dbus-1/system.conf~ /etc/dbus-1/system.conf sudo reboot
DebuggingDBus (last edited 2014-06-19 07:56:53 by 91-145-74-44)