#987862 dbus: messagebus homedir out of sync on legacy installations

Package:
dbus
Source:
dbus
Description:
simple interprocess messaging system (system message bus)
Submitter:
Christoph Anton Mitterer
Date:
2025-03-04 16:30:01 UTC
Severity:
normal
Tags:
#987862#5
Date:
2021-05-01 03:50:04 UTC
From:
To:
Hi.

It seems that previously, the homedir for messagebus used to be /var/run/dbus
while nowadays it is /nonexistent for new installations.

Could some logic be added to an upcoming version, that all existing installations
are aligned with that?

Thanks,
Chris.

#987862#10
Date:
2025-03-04 16:04:47 UTC
From:
To:
Control: severity -1 minor
Control: tags -1 + wontfix

Yes.

Unfortunately, no, I don't think that's going to be possible.
We did a similar transition in src:policykit-1, but we found that usermod
will refuse to change the home directory of a user that is currently
running any processes. For policykit-1, polkitd is essentially stateless,
so we can just shut it down any time and let D-Bus activation restart it
(with the new home directory) next time it's needed.

But if dbus is installed, then it's very very likely that the system
bus is running (as the messagebus user), and stopping/restarting the
system bus on a running system isn't supported/supportable, so the
practical result is that the home directory cannot be changed by the
maintainer scripts.

Editing the messagebus user's home directory during boot (before the bus
has started) would be sort-of-possible, but seems high-risk: if it somehow
fails, the system will not start up correctly and will be left in a
hard-to-debug state. So I don't think that's a good idea either.

As a result I think this is going to have to just stay as-is forever on
existing installations.

     smcv

#987862#19
Date:
2025-03-04 16:15:08 UTC
From:
To:
I'm CCing the adduser maintainer(s), as this seems to be an
interesting use/edge-case.

Chris

#987862#24
Date:
2025-03-04 16:27:58 UTC
From:
To:
Note that usermod is part of passwd (a lower layer than adduser), not
part of adduser.

If I understand correctly, most of the options we pass to adduser only
set its behaviour if it creates our user: if our user already existed,
adduser does not alter it.

We don't currently use sysusers.d in the dbus packaging, but if we did, I
believe it would behave similarly to adduser: if the messagebus user
needed to be created, it would be created with a specified home
directory, but if it already existed, systemd-sysusers would not alter it.

     smcv