123

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?

ZygD
  • 149
Username
  • 819
  • What is the -a option? I looked at the bluetoothctl man pages but didn't see anything for this option. – axiopisty Feb 03 '23 at 13:30
  • If anybody here is still up for another challenge: https://unix.stackexchange.com/questions/754058/connecting-bluetooth-headphones-keeps-failing ;) thx – Robert Aug 15 '23 at 07:56

7 Answers7

160

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
Julian
  • 103
Alex Jones
  • 6,353
59

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.

  • 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 Jan 11 '18 at 05: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 Feb 21 '18 at 00:00
  • 2
    this was the most useful answer.. I tried all the solutions.. but this worked like a charm. – infoclogged Apr 23 '18 at 11:40
  • Thanks, got it working on Ubuntu 20.04.2 LTS – Mihai Tomescu Mar 05 '21 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. – Vladislav Ivanishin Nov 22 '21 at 19:09
  • its still showing me the error Failed to connect: org.bluez.Error.Failed – devpa Dec 13 '21 at 11:47
  • this is the best answer – Willy satrio nugroho Jul 02 '22 at 03:30
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

Archemar
  • 31,554
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.

arna
  • 371
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.

  • 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 && bluetoothctl pair && bluetoothctl connect – Jeremiah Rose Jul 17 '21 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.

jyn
  • 213
  • 2
  • 7