125

I'm running Debian Jessie 8.2. I have a bluetooth USB dongle connected to my machine.

I run sudo bluetoothctl -a then do the following:

[NEW] Controller 5C:F3:70:6B:57:60 debian [default]
Agent registered
[bluetooth]# scan on
Discovery started
[CHG] Controller 5C:F3:70:6B:57:60 Discovering: yes
[bluetooth]# devices
[NEW] Device 08:DF:1F:A7:B1:7B Bose Mini II SoundLink
[bluetooth]# pair 08:DF:1F:A7:B1:7B
Attempting to pair with 08:DF:1F:A7:B1:7B
[CHG] Device 08:DF:1F:A7:B1:7B Connected: yes
[CHG] Device 08:DF:1F:A7:B1:7B UUIDs:
    0000110b-0000-1000-8000-00805f9b34fb
    0000110c-0000-1000-8000-00805f9b34fb
    0000110e-0000-1000-8000-00805f9b34fb
    0000111e-0000-1000-8000-00805f9b34fb
    00001200-0000-1000-8000-00805f9b34fb
[CHG] Device 08:DF:1F:A7:B1:7B Paired: yes
Pairing successful
[CHG] Device 08:DF:1F:A7:B1:7B Connected: no
[bluetooth]# trust 08:DF:1F:A7:B1:7B
[CHG] Device 08:DF:1F:A7:B1:7B Trusted: yes
Changing 08:DF:1F:A7:B1:7B trust succeeded
[bluetooth]# connect 08:DF:1F:A7:B1:7B
Attempting to connect to 08:DF:1F:A7:B1:7B
Failed to connect: org.bluez.Error.Failed

But I can connect to my iPhone this way. Why can't I connect to my Bose Mini II SoundLink speaker?

2
  • What is the -a option? I looked at the bluetoothctl man pages but didn't see anything for this option.
    – axiopisty
    Commented Feb 3, 2023 at 13:30
  • If anybody here is still up for another challenge: unix.stackexchange.com/questions/754058/… ;) thx
    – Robert
    Commented Aug 15, 2023 at 7:56

7 Answers 7

161

This may be due to the pulseaudio-module-bluetooth package not being installed. Install it if it missing, then restart pulseaudio.

sudo apt install pulseaudio-module-bluetooth 
pulseaudio -k
pulseaudio --start

If the issue is not due to the missing package, the problem in this case is that PulseAudio is not catching up. A common solution to this problem is to restart PulseAudio. Note that it is perfectly fine to run bluetoothctl as root while PulseAudio runs as user. After restarting PulseAudio, retry to connect. It is not necessary to repeat the pairing.

Continue trying second part only if above does not work for you:

If restarting PulseAudio does not work, you need to load module-bluetooth-discover.

sudo pactl load-module module-bluetooth-discover

The same load-module command can be added to /etc/pulse/default.pa. If that still does not work, or you are using PulseAudio's system-wide mode, also load the following PulseAudio modules (again these can be loaded via your default.pa or system.pa):

module-bluetooth-policy
module-bluez5-device
module-bluez5-discover
20
  • 1
    Error when trying to install the package: ` Unable to locate package pulseaudio-bluetooth`
    – Username
    Commented Jan 27, 2016 at 19:26
  • 1
    I see now that you meant to type pulseaudio-bluetooth-module. I installed, then killed and started pulseaudio. I connected! There was no audio, but I fixed that by switching the speaker off then on again If you fix your typo, I can mark your answer correct.
    – Username
    Commented Jan 27, 2016 at 19:44
  • 6
    On latest Raspbian OS, I need to type sudo apt install pulseaudio-module-bluetooth
    – kev
    Commented Aug 20, 2016 at 13:31
  • 1
    Same for Debian 8. Commented Oct 2, 2016 at 4:21
  • 2
    2 weeks searching to fix bluetooth and you fixed it! Thanks for sharing!
    – Julien L
    Commented May 12, 2018 at 17:58
61

Try trusting the device first before paring the device.
I got the same error while attempt to pair my AirPods to Ubuntu 16.04.
In bluetoothctl with sudo I got

Attempting to pair with XX:XX:XX:XX:XX:XX  
Failed to pair: org.bluez.Error.AuthenticationCanceled

Attempting to connect to XX:XX:XX:XX:XX:XX  
Failed to connect: org.bluez.Error.Failed

Now this is what I've tried (full progress)

$ sudo bluetoothctl
[bluetooth]# power on
[bluetooth]# agent on
[bluetooth]# default-agent
[bluetooth]# scan on
[NEW] Device XX:XX:XX:XX:XX:XX David's AirPods
[bluetooth]# scan off
[bluetooth]# trust XX:XX:XX:XX:XX:XX
[bluetooth]# pair XX:XX:XX:XX:XX:XX
Attempting to pair with XX:XX:XX:XX:XX:XX
[CHG] Device XX:XX:XX:XX:XX:XX Connected: yes
[CHG] Device XX:XX:XX:XX:XX:XX UUIDs: ... 
[CHG] Device XX:XX:XX:XX:XX:XX UUIDs: ... 
[CHG] Device XX:XX:XX:XX:XX:XX UUIDs: ... 
[CHG] Device XX:XX:XX:XX:XX:XX UUIDs: ... 
[CHG] Device XX:XX:XX:XX:XX:XX UUIDs: ... 
[CHG] Device XX:XX:XX:XX:XX:XX UUIDs: ... 
[CHG] Device XX:XX:XX:XX:XX:XX UUIDs: ... 
[CHG] Device XX:XX:XX:XX:XX:XX UUIDs: ... 
[CHG] Device XX:XX:XX:XX:XX:XX Paired: yes
Pairing successful
[CHG] Device XX:XX:XX:XX:XX:XX Connected: no
[bluetooth]# connect XX:XX:XX:XX:XX:XX
Attempting to connect to XX:XX:XX:XX:XX:XX
[CHG] Device XX:XX:XX:XX:XX:XX Connected: yes
Connection successful
[bluetooth]# quit

Now the AirPods works beautifully between my iPhone and Ubuntu.

8
  • 5
    @Grod, just because there is an accepted answer doesn't mean it works for everyone. In my case, the accepted answer did not work, but this one as well as removing the device first did work.
    – Garrett
    Commented Jan 11, 2018 at 5:04
  • 3
    Thanks! I was trying to pair my magic keyboard and it was failing with "Failed to connect: org.bluez.Error.Failed" no matter what I tried. Only the sequence of: turn keyboard off then on again, scan on, trust XX, pair XX, connect XX worked.
    – Eloff
    Commented Feb 21, 2018 at 0:00
  • 2
    this was the most useful answer.. I tried all the solutions.. but this worked like a charm. Commented Apr 23, 2018 at 11:40
  • Thanks, got it working on Ubuntu 20.04.2 LTS Commented Mar 5, 2021 at 15:50
  • 1
    Also, for me removing the device first helped (I used to connect to it, but did a factory reset since): remove XX:XX:XX:XX:XX:XX. Commented Nov 22, 2021 at 19:09
10

this procedure works for me, thx.

additional comments:

I was trying to add a bluetooth speaker, this was the error message that I had,

[NEW] Device FC:58:FA:B9:BF:A1 Anker A7910
[bluetooth]# connect FC:58:FA:B9:BF:A1
Attempting to connect to FC:58:FA:B9:BF:A1
[CHG] Device FC:58:FA:B9:BF:A1 Connected: yes
Failed to connect: org.bluez.Error.Failed
[CHG] Device FC:58:FA:B9:BF:A1 Connected: no
[CHG] Device FC:58:FA:B9:BF:A1 Connected: yes
[CHG] Device FC:58:FA:B9:BF:A1 Connected: no

I removed the device and then repeat all the steeps that David Jung share.

this is how it looks now:

[Anker A7910]# info FC:58:FA:B9:BF:A1
Device FC:58:FA:B9:BF:A1
    Name: Anker A7910
    Alias: Anker A7910
    Class: 0x260404
    Icon: audio-card
    Paired: yes
    Trusted: yes
    Blocked: no
    Connected: yes
    LegacyPairing: yes
    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-800

Thx again

3
  • Actually removing the device first and then re-pairing did it for me. Not sure why though.
    – xji
    Commented Feb 6, 2018 at 20:41
  • after trying everything else - removing the devide and re-paring is the only things which works for me
    – alwe
    Commented Jul 23, 2018 at 6:33
  • Same here, this is what did it for me, thanks a lot !
    – kigiri
    Commented Sep 6, 2020 at 10:36
4

In my case, a related error message (Failed to pair: org.bluez.Error.AuthenticationFailed) was happening just because the device was already paired to another source.

Lesson learned : When debugging bluetooth pairing issues, step zero should be checking the device is fully available to new connections, disconnected from any other source, and rebooting the source and the bluetooth device.

1
  • 1
    But how to check the state of fully available ?
    – Stephane
    Commented Mar 1, 2022 at 8:37
2

To long for a comment and hence writing an answer to benefit others from the observation :

In my case, Ubuntu 17.04, just installing the bluez ( sudo apt-get install bluez) worked. I did not need any of the pulseaudio packages. I just followed David Jungs answer to do the first ever connection with the JBL bluetooth headset. Make sure that the headset has just been powered on - basically it is set in the discoverable mode.

Also, for reconnecting ( for example after a restart ), simply calling bluetoothctl -a and then connect works. If you have a applet in your window manager, then of course one can connect from there, otherwise the command line interface is bluetoothctl -a. Don't forget to issue devices command in the sudo bluetoothctl -a menu to be sure that your device is available. If the device list is empty, follow first the answer from @David Jung.

Be sure to have the services running. Check for sudo systemctl status bluetooth.service and sudo systemctl status bluetooth.target. Both should be active and loaded! Sometimes, restarting both the services, before bluetoothctl -a works. I did all the commands under sudo rights, just to avoid any loopholes.

An useful utility is btmon to monitor, what exactly is going on, when you connect, or pair, or anything related to the bluetooth commands.

2

I got the Failed to connect: org.bluez.Error.Failed error when hand-typing commands in Terminal in Fedora 34 in an attempt to manually connect my headphones. The problem was apparently that the bluetoothctl pair and bluetoothctl connect commands must be executed at nearly the same time; if there's any substantial delay between them, the latter command will always fail.

To solve the issue, I executed the command bluetoothctl trust <MAC address> and then the chained commands bluetoothctl pair <MAC address> && bluetoothctl connect <MAC address> to ensure that they were executed at almost the same time.

1
  • This totally got my Jabra 75T Bluetooth earbuds working in Ubuntu 20.04!!!! I'd just been ready give up on them. Apparently the timing of commands is important. This is what I did: bluetoothctl remove <mac> && bluetoothctl pair <mac> && bluetoothctl connect <mac> Commented Jul 17, 2021 at 14:13
2

I got this error when I forgot to turn the bluetooth headset on. It showed up in bluetoothctl, but trying to connect failed with the same non-descriptive error. Turning on the device caused it to work fine, both through the desktop bluetooth panel and through bluetoothctl connect.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .