dbus: fix ujail configuration
authorBjørn Mork <[email protected]>
Tue, 5 Aug 2025 15:34:42 +0000 (17:34 +0200)
committerRobert Marko <[email protected]>
Thu, 14 Aug 2025 08:58:04 +0000 (10:58 +0200)
Running dbus as an unprivileged user fails for two reasons: Cannot write pid file
and cannot read the installed policies:

 Tue Aug  5 17:12:41 2025 daemon.info dbus-daemon[8568]: jail: exec-ing /usr/bin/dbus-daemon
 Tue Aug  5 17:12:41 2025 daemon.info dbus-daemon[8585]: Encountered error 'Failed to open "/etc/dbus-1/system.d/org.freedesktop.ModemManager1.conf": Permission denied' while parsing '/etc/dbus-1/system.d/org.freedesktop.ModemManager1.conf'
 Tue Aug  5 17:12:41 2025 daemon.err dbus-daemon[8568]: dbus-daemon[8585]: Encountered error 'Failed to open "/etc/dbus-1/system.d/org.freedesktop.ModemManager1.conf": Permission denied' while parsing '/etc/dbus-1/system.d/org.freedesktop.ModemManager1.conf'
 Tue Aug  5 17:12:41 2025 daemon.warn dbus-daemon[8585]: Failed to start message bus: Failed to open "/var/run/dbus.pid": Permission denied
 Tue Aug  5 17:12:41 2025 daemon.err dbus-daemon[8568]: dbus-daemon[8585]: Failed to start message bus: Failed to open "/var/run/dbus.pid": Permission denied
 Tue Aug  5 17:12:41 2025 daemon.info dbus-daemon[8568]: jail: jail (8585) exited with exit: 1

Fix by dropping the pid file when running unprivileged and changing the owner
of the installed policies.

Fixes: f238d6dd0996 ("dbus: run as regular user rather than as root")
Signed-off-by: Bjørn Mork <[email protected]>
utils/dbus/Makefile
utils/dbus/files/dbus.init

index 193d54d2cb971837df49520ff32d7328f098c0d5..e29b59673df6e18713681c2c3fce8574a5bdddad 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=dbus
 PKG_VERSION:=1.16.2
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=https://dbus.freedesktop.org/releases/dbus
index ec2e97b61960e0050f16631e1902e9740725889a..afd59c98bd70ec2b465be66300f231e8489cac6e 100644 (file)
@@ -15,6 +15,7 @@ start_service() {
        mkdir -m 0755 -p /var/lib/dbus
        mkdir -m 0755 -p /var/run/dbus
        chown dbus:dbus /var/lib/dbus /var/run/dbus
+       chown -R dbus:dbus /etc/dbus-1
 
        [ -x /usr/bin/dbus-uuidgen ] && /usr/bin/dbus-uuidgen --ensure
 
@@ -26,6 +27,7 @@ start_service() {
        procd_set_param stdout 1
        procd_set_param stderr 1
        [ -x /sbin/ujail -a -e /etc/capabilities/dbus.json ] && {
+               procd_append_param command --nopidfile
                procd_add_jail dbus
                procd_set_param user dbus
                procd_set_param group dbus