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.

  • SSH and Bluetooth are unrelated. Might be related to modipy as it runs HTTP server. Type sudo btmon, do everything you do in order again and post the whole output.
    – Mr. Panda
    Dec 13, 2021 at 11:11
  • sudo btmon did not really show anything useful here, was there anything specific to look for? And yes, i tried buster. However, I use the pi for homeassistant. Busters old packages lead to conflicts everywhere, this is not really an option..
    – Tim
    Dec 15, 2021 at 12:51

1 Answer 1


If someone stumbles upon this: pulseaudio was the culprit. pulseaudio uses systemd to check if anyone is logged on, else it shuts down. This also closes the BT connection.

I fixed my problem by running pulseaudio as a system service (which is discouraged, maybe starting with pulseaudio --daemonize might also work) & adding mopidy and root to pulse-access. Seems fine so far!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.