[Pkg-utopia-maintainers] Bug#805449: dbus: Please reboot the system when convenient. ← ?!

Simon McVittie smcv at debian.org
Wed Jun 28 20:58:42 BST 2023


On Wed, 28 Jun 2023 at 17:24:32 +0000, Thorsten Glaser wrote:
> Simon McVittie dixit:
> >On a typical Debian system, restarting `dbus-daemon --system` will
> >cause system services to stop working
> 
> WHICH ones?

I don't know what's installed on your system, so I have no way to
answer that. A random selection of services that definitely do listen
on the system bus: avahi-daemon, polkitd, rtkit-daemon, bluetoothd,
ModemManager, NetworkManager, firewalld, udisksd, elogind. This is far
from an exhaustive list, Debian is quite large.

> I’m pretty sure this only applies to systemd, which I don’t use.

This does not only apply to systemd. avahi-daemon and bluetoothd are
examples of services that rely on D-Bus and are older than systemd,
and elogind relies on D-Bus and is not even co-installable with systemd.

(Perhaps you don't use those either, but that is not implied by you not
using systemd.)

> >The D-Bus protocol operates over an AF_UNIX socket (a lot like X11 and
> >Wayland), so passing suitable options to netstat or ss will tell you
> >what is connected to it.
...
> $ sudo netstat -anp | fgrep /run/dbus/system_bus_socket
> unix  2      [ ACC ]     STREAM     LISTENING     20510    2203/dbus-daemon     /run/dbus/system_bus_socket
> unix  3      [ ]         STREAM     CONNECTED     31073    2203/dbus-daemon     /run/dbus/system_bus_socket
> unix  3      [ ]         STREAM     CONNECTED     24671    2203/dbus-daemon     /run/dbus/system_bus_socket
> unix  3      [ ]         STREAM     CONNECTED     24022    2203/dbus-daemon     /run/dbus/system_bus_socket
(etc.)

Unfortunately, that looks as though netstat is telling us the process IDs
of the server end of each connection (in the dbus-daemon), which tells
us nothing about the client end (the processes you want to list). So
you now have a good guess at *how many* clients there are, but not
*what*. That's a lot less useful than I had hoped.

If you use `sudo ss --unix -p` instead of netstat, you can correlate
the dbus-daemon end that netstat also shows with the client end by their
inode number. For instance this is the equivalent of one of your lines of
netstat output:

u_str ESTAB 0      0                     /run/dbus/system_bus_socket 33798              * 33797   users:(("dbus-daemon",pid=798,fd=46))                                                         >

and if I search the output for 33797, I can find the other end of this
connection:

u_str ESTAB 0      0                                               * 33797              * 33798   users:(("gvfs-udisks2-vo",pid=2093,fd=5))                                                     >

which tells me which process is connected to the system bus. Not exactly
convenient, but maybe scriptable (although looking at wherever netstat and
ss get their information from might be more reliable than screen-scraping
their output).

I think I've already spent more time on this than I can justify, and
I suspect you have too: dbus is not uploaded very often (particularly
to stable releases), so there's a really low limit to how many reboots
can be avoided by micro-optimizing how you deal with dbus updates. The
kernel gets at least an order of magnitude more security updates than
dbus, and you have to reboot to put a kernel update into effect anyway,
so occasional reboots are going to be necessary for a maintained machine
regardless of whether you reboot for a dbus update.

    smcv



More information about the Pkg-utopia-maintainers mailing list