I am trying to use a headless Rpi Zero 2 (Raspian 11) for bluetooth audio streaming.
I can establish a connection to a bluetooth speaker using bluetoothctl connect XX:XX:XX:XX:XX:XX from an SSH connection and then stream audio through a pulseaudio A2DP sink using mopidy. This works!
What does not work is keeping the connection alive. As soon as i close the SSH shell, the bluetooth connection drops. I already tried to run bluetoothctl through screen without success.
If I connect again via SSH, I am not able to connect to my speaker and get
Failed to connect: org.bluez.Error.Failed from bluetoothctl.
syslog shows
bluetoothd[474]: Endpoint unregistered: sender=:1.59 path=/MediaEndpoint/A2DPSink/sbc
bluetoothd[474]: Endpoint unregistered: sender=:1.59 path=/MediaEndpoint/A2DPSource/sbc
when closing ssh and
bluetoothd[474]: src/service.c:btd_service_connect() a2dp-sink profile connect failed for XX:XX:XX:XX:XX:XX: Protocol not available
when attempting to reconnect the speaker.
I'm quite new to Raspberries / Unix systems. Is anyone able to point me in the right direction?
EDIT: Can't comment because of low rep. This isn't a mopidy issue as far as I can see, as I can reproduce this behaviour without even starting mopidy. The speaker disconnects immediately after closing the SSH. I will edit in the output of btmon when I get home.