[PATCH 1/8] host/rootfs: create dbus socket externally

Alyssa Ross
2025-12-10T12:48:39Z

This is the first step towards running dbus as non-root.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
---
.../template/data/service/dbus/notification-fd | 2 +-
.../data/service/dbus/notification-fd.license | 2 +-
.../vm-services/template/data/service/dbus/run | 13 +++++++++++--
3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/host/rootfs/image/etc/s6-linux-init/run-image/service/vm-services/template/data/service/dbus/notification-fd b/host/rootfs/image/etc/s6-linux-init/run-image/service/vm-services/template/data/service/dbus/notification-fd
index 00750edc..b8626c4c 100644
--- a/host/rootfs/image/etc/s6-linux-init/run-image/service/vm-services/template/data/service/dbus/notification-fd
+++ b/host/rootfs/image/etc/s6-linux-init/run-image/service/vm-services/template/data/service/dbus/notification-fd
@@ -1 +1 @@
-3
+4
diff --git a/host/rootfs/image/etc/s6-linux-init/run-image/service/vm-services/template/data/service/dbus/notification-fd.license b/host/rootfs/image/etc/s6-linux-init/run-image/service/vm-services/template/data/service/dbus/notification-fd.license
index 5a406331..0d3d47ca 100644
--- a/host/rootfs/image/etc/s6-linux-init/run-image/service/vm-services/template/data/service/dbus/notification-fd.license
+++ b/host/rootfs/image/etc/s6-linux-init/run-image/service/vm-services/template/data/service/dbus/notification-fd.license
@@ -1,2 +1,2 @@
SPDX-License-Identifier: CC0-1.0
-SPDX-FileCopyrightText: 2022 Alyssa Ross <hi@alyssa.is>
+SPDX-FileCopyrightText: 2025 Alyssa Ross <hi@alyssa.is>
diff --git a/host/rootfs/image/etc/s6-linux-init/run-image/service/vm-services/template/data/service/dbus/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/vm-services/template/data/service/dbus/run
index 40b75355..365e1697 100755
--- a/host/rootfs/image/etc/s6-linux-init/run-image/service/vm-services/template/data/service/dbus/run
+++ b/host/rootfs/image/etc/s6-linux-init/run-image/service/vm-services/template/data/service/dbus/run
@@ -4,10 +4,19 @@

importas -i VM VM

+s6-ipcserver-socketbinder -B /run/vm/by-id/${VM}/portal-bus
+
+fdmove -c 3 0
+redirfd -r 0 /dev/null
+
nsenter --mount=/run/vm/by-id/${VM}/mount

unshare --cgroup --ipc --net --uts
+
+export LISTEN_FDS 1
+getpid LISTEN_PID
+
dbus-daemon
--config-file /usr/share/dbus-1/session.conf
- --print-address 3
- --address unix:path=/run/vm/by-id/${VM}/portal-bus
+ --print-address 4
+ --address systemd:
--
2.51.0