[PATCH 09/13] img/app: pipewire: stop fighting s6 over lockfiles

Alyssa Ross
2025-11-26T21:34:42Z

This causes a particular problem when PipeWire is not run as root,
because it can't overwrite the root-owned lockfiles from s6.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
---
img/app/image/etc/s6-rc/pipewire/run | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/img/app/image/etc/s6-rc/pipewire/run b/img/app/image/etc/s6-rc/pipewire/run
index 1774b91..afaada1 100644
--- a/img/app/image/etc/s6-rc/pipewire/run
+++ b/img/app/image/etc/s6-rc/pipewire/run
@@ -1,12 +1,21 @@
#!/bin/execlineb -P
# SPDX-License-Identifier: EUPL-1.2+
-# SPDX-FileCopyrightText: 2023-2024 Alyssa Ross <hi@alyssa.is>
+# SPDX-FileCopyrightText: 2023-2025 Alyssa Ross <hi@alyssa.is>
# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>

-s6-ipcserver-socketbinder -B /run/pipewire/pipewire-0
+if { chown pipewire:pipewire /run/pipewire }
+if { chmod 0755 /run/pipewire }
+
+# PipeWire likes to create its own .lock files for its sockets,
+# so we have to disable lockfile creation in s6-ipcserver-socketbinder
+# by disabling SO_REUSEADDR, and work around that by removing potential
+# previous instances of the sockets first.
+if { rm -f /run/pipewire/pipewire-0 /run/pipewire/pipewire-0-manager }
+
+s6-ipcserver-socketbinder -BD /run/pipewire/pipewire-0
fdmove -c 3 0

-s6-ipcserver-socketbinder -B /run/pipewire/pipewire-0-manager
+s6-ipcserver-socketbinder -BD /run/pipewire/pipewire-0-manager
fdmove -c 4 0

redirfd -r 0 /dev/null
--
2.51.0