Consider defining system bus socket to be in /run/dbus on FHS systems
The interoperable location of the system bus socket in system-wide installations of D-Bus on Unix systems is /var/run/dbus/system_bus_socket.
Recent Linux distributions implement /run, which is standardized by the FHS version 3.0. /run is intended to be transient (a tmpfs) and is the best place to put system-wide sockets like the one for the system bus.
In all /run implementations that I am aware of most /run implementations, but notably not Slackware, /run is in fact guaranteed to be equivalent to /var/run, typically by making /var/run a symbolic link to /run (a symbolic link in the other direction would also be a valid implementation, and so would a Linux bind-mount or FreeBSD nilfs). However, the FHS does not actually guarantee this. (I think it should, and I have opened https://bugs.linuxfoundation.org/show_bug.cgi?id=1396).
At the moment, our policy is that the interoperable location is officially /var/run, and if /var/run and /run somehow differ, /var/run is the right one to use. However, this can cause problems if access to /var is mediated by an automounter.
We have considered changing the D-Bus Specification to have /run/dbus/system_bus_socket as the preferred/canonical path, and correspondingly changing the implementation to use ${runstatedir}/dbus/system_bus_socket.
However, we cannot just say "yes, obviously we should do this", use ${runstatedir}
, and move on with our lives, because there exist operating systems (Slackware) where /var/run
and /run
both exist, and they are different. On those operating systems, changing the well-known system bus socket would be a backwards compatibility break.
I think the policy applied by those operating systems is foolish - they are why we can't have nice things - but we take backwards compatibility seriously.
For dbus to use /run
in preference to /var/run
while working correctly in all cases, we would have to make clients try to connect to both addresses, and make the server try to listen on both addresses (but cope gracefully with inability to listen in /var/run
if it's already listening in /run
).
This is complicated by the fact that the system bus socket is a configure-time parameter, and is not necessarily in either /var/run
or /run
- it might be in /opt/freedesktop/dbus/var/run
or something.
If you know for sure that on your specific operating system, /var/run
is guaranteed to be equivalent to /run
and the latter is the path you want, then you can configure --with-system-socket=/run/dbus/system_bus_socket
.