From c2f14b60aa068be21b902f731ae29bcdbc53dca3 Mon Sep 17 00:00:00 2001 From: David Gwilliam Date: Wed, 1 Jul 2026 07:06:25 -0700 Subject: [PATCH] audio-bridge: fix bluetoothd path + add session dbus + cleanup stale pid - bluetoothd at /usr/lib/bluetooth/bluetoothd (not in PATH on alpine) - Add session dbus via dbus-daemon --session (pipewire needs it) - Clean up stale dbus.pid files on startup (host volume persists) --- infra/audio-bridge/entrypoint.sh | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/infra/audio-bridge/entrypoint.sh b/infra/audio-bridge/entrypoint.sh index 7d05a93..4b95e42 100644 --- a/infra/audio-bridge/entrypoint.sh +++ b/infra/audio-bridge/entrypoint.sh @@ -1,36 +1,39 @@ #!/bin/sh # audio-bridge entrypoint -# Starts DBus, BlueZ, WirePlumber, then PipeWire. PA clients (librespot, mopidy) -# connect via pipewire-pulse bridge on TCP localhost:4713. +# Starts DBus (system + session), BlueZ, WirePlumber, then PipeWire. +# PA clients (librespot, mopidy) connect via pipewire-pulse bridge on TCP localhost:4713. set -e mkdir -p /run/dbus /run/user/0 chmod 0755 /run/dbus chmod 0700 /run/user/0 +# Clean up stale pid files from previous container runs (host volume persists). +rm -f /run/dbus/dbus.pid /run/user/0/dbus.pid -# System DBus (needed by bluetoothd, wireplumber, pipewire) +# System DBus (needed by bluetoothd, wireplumber) dbus-daemon --system --fork sleep 0.5 +# Session DBus (needed by PipeWire for portal/jackdbus-detect modules). +# Use XDG_RUNTIME_DIR=/run/user/0 so dbus-launch puts socket there. +export XDG_RUNTIME_DIR=/run/user/0 +dbus-daemon --session --address=unix:path=/run/user/0/bus --fork --print-pid 3 +sleep 0.3 + # BlueZ (Bluetooth stack). --compat = legacy mode for older audio devices. -# Disabled if no /dev/bluetooth/rfkill — wireplumber will skip BT modules. +# Disabled if no /sys/class/bluetooth — wireplumber will skip BT modules. if [ -d /sys/class/bluetooth ]; then - bluetoothd --compat --nodetach & + /usr/lib/bluetooth/bluetoothd --compat --nodetach & sleep 0.5 echo "[audio-bridge] bluetoothd started" else echo "[audio-bridge] no bluetooth hardware — skipping bluetoothd" fi -# PipeWire runtime env -export XDG_RUNTIME_DIR=/run/user/0 -export DBUS_SYSTEM_BUS_ADDRESS=unix:path=/run/dbus/system_bus_socket - -# WirePlumber first (it manages PipeWire session/policy, loads BT modules) +# WirePlumber first (manages PipeWire session/policy, loads BT modules on demand) wireplumber & sleep 1 -# PipeWire last. The pipewire-pulse package auto-loads the PA bridge module -# so PA clients (librespot, mopidy) can connect via TCP localhost:4713. +# PipeWire last. pipewire-pulse auto-loads PA bridge so clients connect via TCP 4713. exec pipewire