Issues with BlueALSA and BOSE A2DP Speaker on DietPi (Mopidy Setup)

Hi everyone,

I’m trying to set up my BOSE Bluetooth speaker on DietPi using BlueALSA as an A2DP device for Mopidy, but I’m running into connection issues. I would appreciate any guidance.

What I’ve done so far:

  1. Installed BlueALSA:
which bluealsa
/usr/bin/bluealsa
  1. Started BlueALSA:
sudo bluealsa -p a2dp-sink
  • BlueALSA starts and logs:
Acquired D-Bus service name: org.bluealsa
Registering media application: /org/bluez/hci0
Exporting media endpoint object: /org/bluez/hci0/A2DP/SBC/sink/1
  1. Prepared the speaker in pairing mode
  2. Tried connecting the speaker via bluetoothctl:
bluetoothctl
power on
agent on
default-agent
scan on
trust xx:C6:xx:66:xx:99
connect xx:xx:xx:66:xx:99
  • Result:
Failed to connect: org.bluez.Error.Failed br-connection-profile-unavailable
  1. Tried testing audio via ALSA:
aplay -D BOSE /usr/share/sounds/alsa/Front_Center.wav
  • Result:
Couldn't get BlueALSA PCM: PCM not found
  1. BlueALSA virtual PCMs are not listed yet (bluealsa-aplay -L shows nothing)

System:

  • DietPi (latest version) on Raspberry Pi
  • Mopidy installed
  • BlueZ + BlueALSA Utilities installed

Problem / Question:

  • The BOSE speaker does not connect properly; the A2DP profiles are unavailable even though BlueALSA is running.
  • How can I get the speaker to connect correctly so BlueALSA creates the PCM and I can use it in Mopidy?
  • Are there any special considerations for DietPi / headless setups for Bluetooth A2DP?

Thanks in advance for your help!

I guess you missed to pair it first, here is what I did (I tested it on a RPI3B with my Nothing Ear headphones)

  1. Activated bluetooth and ALSA via dietpi-config
  2. Installed bluez-alsa-utils via apt
  3. killed the already running process and did bluealsa --profile=a2dp-sink --codec=sbc to verify it’s working
  4. Then I checked the systemd service, it was not running (systemctl status bluealsa )
  5. activated and started it
systemctl enable bluealsa
systemctl start bluealsa
  1. started bluetoothctl and did:
bluetoothctl
power on
agent on
default-agent
scan on
pair 2C:BE:EB:73:CC:A0
trust 2C:BE:EB:73:CC:A0
connect 2C:BE:EB:73:CC:A0

Then I verfied:

[Nothing Ear]> info 2C:BE:EB:73:CC:A0
Device 2C:BE:EB:73:CC:A0 (public)
        Name: Nothing Ear
        Alias: Nothing Ear
        Class: 0x00240404 (2360324)
        Icon: audio-headset
        Paired: yes
        Bonded: yes
        Trusted: yes
        Blocked: no
        Connected: yes
        LegacyPairing: no
        UUID: SDP                       (00000001-0000-1000-8000-00805f9b34fb)
        UUID: Serial Port               (00001101-0000-1000-8000-00805f9b34fb)
        UUID: Audio Sink                (0000110b-0000-1000-8000-00805f9b34fb)
        UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
        UUID: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)
        UUID: A/V Remote Control Cont.. (0000110f-0000-1000-8000-00805f9b34fb)
        UUID: Handsfree                 (0000111e-0000-1000-8000-00805f9b34fb)
        UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)
        UUID: Generic Audio             (00001203-0000-1000-8000-00805f9b34fb)
        UUID: Generic Access Profile    (00001800-0000-1000-8000-00805f9b34fb)
        UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
        UUID: Vendor specific           (66666666-6666-6666-6666-666666666666)
        UUID: Vendor specific           (aeac4a03-dff5-498f-843a-34487cf133eb)
        UUID: Vendor specific           (df21fe2c-2515-4fdb-8886-f12c4d67927c)
        Modalias: bluetooth:v02B0p0000d001F

also with aplay:

bluealsa-aplay -L
bluealsa:DEV=2C:BE:EB:73:CC:A0,PROFILE=a2dp,SRV=org.bluealsa
    Nothing Ear, trusted audio-headset, playback
    A2DP (SBC): S16_LE 2 channels 48000 Hz

and then just a simple audio test:

root@TestPi3B:~# aplay -D bluealsa:DEV=2C:BE:EB:73:CC:A0,PROFILE=a2dp /usr/share/sounds/alsa/Front_Center.wav
[985] D: bluealsa-pcm.c:1538: Getting BlueALSA PCM: PLAYBACK 2C:BE:EB:73:CC:A0 a2dp
[985] D: bluealsa-pcm.c:1296: /org/bluealsa/hci0/dev_2C_BE_EB_73_CC_A0/a2dpsrc/sink: Setting constraints
Wiedergabe: WAVE '/usr/share/sounds/alsa/Front_Center.wav' : Signed 16 bit Little Endian, Rate: 48000 Hz, mono
[985] D: bluealsa-pcm.c:566: /org/bluealsa/hci0/dev_2C_BE_EB_73_CC_A0/a2dpsrc/sink: Initializing HW
[985] D: bluealsa-pcm.c:580: /org/bluealsa/hci0/dev_2C_BE_EB_73_CC_A0/a2dpsrc/sink: Changing BlueALSA PCM configuration: 2 ch, 48000 Hz -> 1 ch, 48000 Hz
[985] D: bluealsa-pcm.c:631: /org/bluealsa/hci0/dev_2C_BE_EB_73_CC_A0/a2dpsrc/sink: FIFO buffer size: 2048 frames
[985] D: bluealsa-pcm.c:636: /org/bluealsa/hci0/dev_2C_BE_EB_73_CC_A0/a2dpsrc/sink: Selected HW buffer: 4 periods x 12000 bytes == 48000 bytes
[985] D: bluealsa-pcm.c:667: /org/bluealsa/hci0/dev_2C_BE_EB_73_CC_A0/a2dpsrc/sink: Initializing SW
[985] D: bluealsa-pcm.c:667: /org/bluealsa/hci0/dev_2C_BE_EB_73_CC_A0/a2dpsrc/sink: Initializing SW
[985] D: bluealsa-pcm.c:717: /org/bluealsa/hci0/dev_2C_BE_EB_73_CC_A0/a2dpsrc/sink: Prepared
[985] D: bluealsa-pcm.c:667: /org/bluealsa/hci0/dev_2C_BE_EB_73_CC_A0/a2dpsrc/sink: Initializing SW
[985] D: bluealsa-pcm.c:392: /org/bluealsa/hci0/dev_2C_BE_EB_73_CC_A0/a2dpsrc/sink: Starting
[989] D: bluealsa-pcm.c:235: /org/bluealsa/hci0/dev_2C_BE_EB_73_CC_A0/a2dpsrc/sink: Starting IO loop: 8
[985] D: bluealsa-pcm.c:723: /org/bluealsa/hci0/dev_2C_BE_EB_73_CC_A0/a2dpsrc/sink: Draining
[985] D: bluealsa-pcm.c:392: /org/bluealsa/hci0/dev_2C_BE_EB_73_CC_A0/a2dpsrc/sink: Starting
[989] D: bluealsa-pcm.c:244: /org/bluealsa/hci0/dev_2C_BE_EB_73_CC_A0/a2dpsrc/sink: Pausing IO thread
[989] D: bluealsa-pcm.c:258: /org/bluealsa/hci0/dev_2C_BE_EB_73_CC_A0/a2dpsrc/sink: IO thread resumed
[989] D: bluealsa-pcm.c:244: /org/bluealsa/hci0/dev_2C_BE_EB_73_CC_A0/a2dpsrc/sink: Pausing IO thread
[985] D: bluealsa-pcm.c:428: /org/bluealsa/hci0/dev_2C_BE_EB_73_CC_A0/a2dpsrc/sink: Stopping
[989] D: bluealsa-pcm.c:171: /org/bluealsa/hci0/dev_2C_BE_EB_73_CC_A0/a2dpsrc/sink: IO thread cleanup
[985] D: bluealsa-pcm.c:428: /org/bluealsa/hci0/dev_2C_BE_EB_73_CC_A0/a2dpsrc/sink: Stopping
[985] D: bluealsa-pcm.c:646: /org/bluealsa/hci0/dev_2C_BE_EB_73_CC_A0/a2dpsrc/sink: Freeing HW
[985] D: bluealsa-pcm.c:475: /org/bluealsa/hci0/dev_2C_BE_EB_73_CC_A0/a2dpsrc/sink: Closing

And I was hearing a nice voice in the headphones :smiley:

I also installed mopidy, and to get sound via BT working I edited /etc/mopidy/mopidy.conf, added

[audio]
output = alsasink device=bluealsa:DEV=2C:BE:EB:73:CC:A0,PROFILE=a2dp

(replace the MAC address)
and restarted the service.

is this the right file content?

cat /etc/systemd/system/bluealsa.service
[Unit]
Description=BlueALSA Bluetooth ALSA Proxy
Requires=bluetooth.service
After=bluetooth.service

[Service]
Type=simple
User=root
ExecStart=/usr/bin/bluealsa -p a2dp-source -p a2dp-sink
Restart=on-failure
RestartSec=5s

[Install]
WantedBy=multi-user.target

Yes, the installation of mopidy will add some lines to the service file, but this is expected behaviour.

is this service necessary?

bluealsa-aplay

Not for mopidy. If I understand correctly it’s needed when you wanna send audio to the SBC.

Is it working now?
Was the solution to pair the devices first?

Yes, to pair it…and between each command you need to wait until it’s finished.

Thanks a lot