7

When trying to connect a new device through the Raspberry Pi I take the following steps without success. I can re-pair as many times as I want with any device, but I can never connect.

Other devices can create a connection with the Pi when it's discoverable (after being paired).

[bluetooth]# discoverable on
Changing discoverable on succeeded
[CHG] Controller 33:22:11:CC:BB:AA Discoverable: yes
[bluetooth]# pairable on
Changing pairable on succeeded
[bluetooth]# agent on
Agent registered
[bluetooth]# default-agent 
Default agent request successful
[bluetooth]# pair AA:BB:CC:11:22:33
Device AA:BB:CC:11:22:33 not available
[NEW] Device AA:BB:CC:11:22:33 Pixel XL
Request confirmation
[agent] Confirm passkey 123456 (yes/no): yes
[CHG] Device AA:BB:CC:11:22:33 Modalias: bluetooth:v000Fpw83523957
[CHG] Device AA:BB:CC:11:22:33 UUIDs:
        [[UUIDS-123456-234324-25325-23532523tu]]
[CHG] Device AA:BB:CC:11:22:33 Paired: yes
[bluetooth]# connect AA:BB:CC:11:22:33
Attempting to connect to AA:BB:CC:11:22:33
Failed to connect: org.bluez.Error.Failed
[CHG] Device AA:BB:CC:11:22:33 Connected: no
[CHG] Controller 33:22:11:CC:BB:AA Discoverable: no

This is a Raspberry Pi3 and the version info from bluetooth ctl is here:

Version 5.23
7

So it turns out that when I looked into the bluetoothctl logs on the Raspberry Pi that I was getting this error:

a2dp-source profile connect failed for AA:BB:CC:11:22:33: Protocol not available

You can look this by running:

sudo cat /var/log/syslog | grep -i protocol 

Which is reported all over the internet as being resolveable through this command:

pactl load-module module-bluetooth-discover

Which gives THIS error:

Failure: Module initialization failed

This answer here resolved my issue with that command (I added 2 more steps after for clarity): https://askubuntu.com/a/689297/82021

After performing the file modifications in this answer do the following:

  1. Reboot your Pi
  2. pactl load-module module-bluetooth-discover

After all this, I can now pair AND connect any bluetooth device using Raspbian on my RPi3.

  • I get the same issue when trying to connect my desktop to my raspberry pi. I'm testing your solution now, but I find it strange because this is not an audio application and your solution uses pulseaudio. Strange! Were you connecting to an audio device? – Julian Cienfuegos Oct 7 '17 at 0:53
  • 1
    My device also wasn't audio, it was phones and computers – udjamaflip Oct 7 '17 at 1:38
  • Setting up bluetooth to make my laptop and desktop communicate took me 5 minutes. Making my desktop and Rpi 2.0 B has taken two days so far and still no luck. This solution causes "systemctl start bluetooth" to fail for me, with the "sap-server: Operation not permitted (1) error". Very very strange. Will report back if I find a solution. I wonder if this fix you've posted is particular to the model 3? – Julian Cienfuegos Oct 7 '17 at 2:33
  • I'm having this same problem but your solution doesn't seem to help. I guess it's outdated? – Epicality Dec 31 '18 at 16:31
  • Should it be the exact same error the above 2 answers should work still. I recently (early December) used this to resolve the issue on a new Pi install. – udjamaflip Jan 1 at 23:31
0

On my Raspberry Pi 2 running Debian stretch armv7, I had to install bluez-utils from https://packages.debian.org/wheezy/all/bluez-utils/download as apt-get install did not find such a packet.

0

I solved this fixing two things:

  1. Changes the permissions at /etc/dbus-1/system.d/bluetooth.conf
    I crudely changed the default permission to allow. A more elgant solution is probably possible.

    <policy context="default"> <allow send_destination="org.bluez"/>
    </policy>

2. A timing bug fixed by running this:

  pactl unload-module module-bluetooth-discover
  pactl load-module module-bluetooth-discover

YMMV

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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