D-Bus

出自 Arch Linux 中文维基

這篇文章的某些內容需要擴充。

原因: Mention disabling of dbus services through use of systemctl mask and overrides in /etc/dbus-1/services (在 Talk:D-Bus 中討論)

D-Bus 是一個為進程間通信提供簡單方法的消息總線系統。它由一個可為全系統加載或是為單個用戶會話加載的守護進程和一系列供應用程式使用 D-Bus 的庫組成。

dbus 作為 systemd 的依賴被拉取和安裝,並且用戶會話總線會為每個用戶自動啟動

替代實現[編輯 | 編輯原始碼]

dbus-broker[編輯 | 編輯原始碼]

dbus-broker — A drop-in replacement for the libdbus reference implementation, which aims "to provide high performance and reliability, while keeping compatibility to the D-Bus reference implementation".

https://github.com/bus1/dbus-broker || dbus-broker

dbus-broker — A drop-in replacement for the libdbus reference implementation, which aims "to provide high performance and reliability, while keeping compatibility to the D-Bus reference implementation".

https://github.com/bus1/dbus-broker || dbus-broker

要將 dbus-broker 作為系統總線啟用,要先禁用 dbus.service 然後啟用 dbus-broker.service

要將其作為用戶總線啟用,可以為單個或全部用戶啟用dbus-broker.service 用戶單元

最後要重啟來讓這些設置生效。

提示與技巧[編輯 | 編輯原始碼]

覆蓋 dbus 服務[編輯 | 編輯原始碼]

你可以在 $XDG_DATA_HOME/dbus-1/services 覆蓋 dbus 服務。

如果服務已經被啟動了,覆蓋工作不會立即生效。必須先殺死已有的服務進程,或者更早地啟動服務。

You can use this to always use a particular service when you have several installed providing the same well-known bus name.

調試[編輯 | 編輯原始碼]

  • D-Feet — Easy to use D-Bus debugger GUI tool. D-Feet can be used to inspect D-Bus interfaces of running programs and invoke methods on those interfaces.
https://wiki.gnome.org/Apps/DFeet || d-feet
  • QDbusViewer — GUI D-Bus debugger. Can be used to inspect D-Bus services and invoke methods on them.
https://doc.qt.io/qt-5/qdbusviewer.html || qt5-tools

你也可以用 systemdbusctl(1)

另見[編輯 | 編輯原始碼]