Unyablog.

のにれんのブログ

systemd の dbus のパス

よく混乱するのでメモ。

Init としての systemd

/run/systemd/private

systemd 専用の direct な socket。 なので、ここに投げたら直接 systemd に飛ぶ*1。 systemctl などはここに投げている。

systemd が直接 bind / listen しているので、 dbus-monitor で見たりはできない。はず。

/run/systemd/private Used internally as communication channel between systemctl(1) and the systemd process. This is an AF_UNIX stream socket. This interface is private to systemd and should not be used in external projects.OSOCKADDR_UN_LEN

https://www.freedesktop.org/software/systemd/man/systemd.html#/run/systemd/private

/run/dbus/system_bus_socket

こちらは system bus と呼ばれるもので、 dbus-daemon が作成している。/etc/dbus-1/system.d/foo.conf に然るべき設定を置けば dbus-monitor --system で monitor できる。

DebuggingDBus - Ubuntu Wiki

systemctl の場合、 systemd の private で機能が足りない時に使われる。

例えば systemd-run --wait など*2

systemd --user 時

/run/user/$uid/systemd/private

これは systemd --user が作成する同様の private な socket。 systemctl --user を使うとこちらに飛ぶ。

/run/user/$uid/bus

これは session bus と呼ばれるもので、ユーザーのセッションごとに作られるもの。自分の環境だと dbus-daemon によってここに作られる。 このパスは $DBUS_SESSION_BUS_ADDRESS に入る事が多い。

system bus と同様に、 /etc/dbus-1/session.d/foo.conf で設定できる。

GUIsystemd --user に対する method_call はここに投げると良さそう。

*1:A よって A みたいな文章だ

*2: ref/unref が足りないらしい