Discussion:
Bug#987862: dbus: messagebus homedir out of sync on legacy installations
(too old to reply)
Christoph Anton Mitterer
2021-05-01 04:00:02 UTC
Permalink
Package: dbus
Version: 1.12.20-2
Severity: normal


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.
Simon McVittie
2025-03-04 16:10:01 UTC
Permalink
Control: severity -1 minor
Control: tags -1 + wontfix
Post by Christoph Anton Mitterer
It seems that previously, the homedir for messagebus used to be /var/run/dbus
while nowadays it is /nonexistent for new installations.
Yes.
Post by Christoph Anton Mitterer
Could some logic be added to an upcoming version, that all existing installations
are aligned with that?
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
Chris Hofstaedtler
2025-03-04 16:20:02 UTC
Permalink
Post by Simon McVittie
Post by Christoph Anton Mitterer
It seems that previously, the homedir for messagebus used to be /var/run/dbus
while nowadays it is /nonexistent for new installations.
Yes.
Post by Christoph Anton Mitterer
Could some logic be added to an upcoming version, that all existing installations
are aligned with that?
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.
I'm CCing the adduser maintainer(s), as this seems to be an
interesting use/edge-case.
Post by Simon McVittie
[..]
Chris
Simon McVittie
2025-03-04 16:40:01 UTC
Permalink
Post by Chris Hofstaedtler
Post by Simon McVittie
Post by Christoph Anton Mitterer
It seems that previously, the homedir for messagebus used to be /var/run/dbus
while nowadays it is /nonexistent for new installations.
Yes.
Post by Christoph Anton Mitterer
Could some logic be added to an upcoming version, that all existing installations
are aligned with that?
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.
I'm CCing the adduser maintainer(s), as this seems to be an
interesting use/edge-case.
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

Loading...