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)

另见[编辑 | 编辑源代码]