# Bluetooth Failed to connect: org.bluez.Error.Failed

## i92guboj

Hi!

So, bluetooth doesn't work, quite strange, isn't it?  :Razz: 

I have used it a couple times in all my lifetime, sucessfully, that is. I was feeling adventurous and tried it again, but, while I've been trying for some days now, I haven't managed to get past this nice error message.

So, to sum up, I have sucessfully enabled all the kernel stuff, and it seems to work, my adapter is detected and seems to be working:

```

[pitufolandia] root@pitufolandia:/home/i92guboj

[pitufolandia] 18:24:04 # dmesg|grep -i blue

[    0.586602] thinkpad_acpi: rfkill switch tpacpi_bluetooth_sw: radio is blocked

[    1.355172] usb 1-1.4: Product: Broadcom Bluetooth Device

[    3.788175] Bluetooth: Core ver 2.22

[    3.788186] Bluetooth: HCI device and connection manager initialized

[    3.788189] Bluetooth: HCI socket layer initialized

[    3.788190] Bluetooth: L2CAP socket layer initialized

[    3.788194] Bluetooth: SCO socket layer initialized

[   17.298714] usb 1-1.4: Product: Broadcom Bluetooth Device

[   81.168360] usb 1-1.4: Product: Broadcom Bluetooth Device

[ 1649.925604] usb 1-1.4: Product: Broadcom Bluetooth Device

[pitufolandia] root@pitufolandia:/home/i92guboj

[pitufolandia] 18:24:08 # bluetoothctl 

[NEW] Controller EC:55:F9:FA:6B:1A BlueZ 5.43 [default]

[NEW] Device B0:E2:35:F8:E9:29 Redmi

[bluetooth]# devices

Device B0:E2:35:F8:E9:29 Redmi

[bluetooth]# show

Controller EC:55:F9:FA:6B:1A

        Name: BlueZ 5.43

        Alias: BlueZ 5.43

        Class: 0x00010c

        Powered: yes

        Discoverable: yes

        Pairable: yes

        UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)

        UUID: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)

        UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)

        UUID: Generic Access Profile    (00001800-0000-1000-8000-00805f9b34fb)

        UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)

        Modalias: usb:v1D6Bp0246d052B

        Discovering: no

[bluetooth]# info B0:E2:35:F8:E9:29

Device B0:E2:35:F8:E9:29

        Name: Redmi

        Alias: Redmi

        Class: 0x5a020c

        Icon: phone

        Paired: yes

        Trusted: yes

        Blocked: no

        Connected: no

        LegacyPairing: no

        UUID: OBEX Object Push          (00001105-0000-1000-8000-00805f9b34fb)

        UUID: Audio Source              (0000110a-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: Headset AG                (00001112-0000-1000-8000-00805f9b34fb)

        UUID: PANU                      (00001115-0000-1000-8000-00805f9b34fb)

        UUID: NAP                       (00001116-0000-1000-8000-00805f9b34fb)

        UUID: Handsfree Audio Gateway   (0000111f-0000-1000-8000-00805f9b34fb)

        UUID: SIM Access                (0000112d-0000-1000-8000-00805f9b34fb)

        UUID: Phonebook Access Server   (0000112f-0000-1000-8000-00805f9b34fb)

        UUID: Message Access Server     (00001132-0000-1000-8000-00805f9b34fb)

        UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)

        UUID: Generic Access Profile    (00001800-0000-1000-8000-00805f9b34fb)

        UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)

        Modalias: bluetooth:v000Fp1200d1436

```

As you can see, my phone is also detected. I managed to pair them both, it seems to work. However it fails miserably to connect.

```

[bluetooth]# connect B0:E2:35:F8:E9:29

Attempting to connect to B0:E2:35:F8:E9:29

Failed to connect: org.bluez.Error.Failed

```

I have been googling, but I have only found one million of posts about pulseaudio related stuff, which I am complete uninterested in. I just want to, you know, copy a file. How difficult can it get?

Since I am not what I'd call an expert in the bluetooth stack, I have also tried blueman and blueberry. They seem to do exactly the same: they both pair ok against the phone (pair, unpair, pair, unpair, that's what I do...). Neither of them can connect. Blueman fails silently, though in the terminal I can read something about removed devices or the like (can't remember the exact thing). Blueberry, on the other side, hangs there telling me that can't connect while I sit there enjoying the animated icon in that little window.

I can transfer files using bluetooth between this redmi phone and some other 3 phones or so that I have tested.

But I can't seem to figure how to transfer one file from or to my linux laptop. I suppose the first thing is getting the thing to connect...

So, any ideas there?

Thanks for reading!

----------

## Logicien

Broadcom devices may need firmware files.

Do you have a Dbus session started?

Try to connect from your cellular.

Cellulars have audio capabilities, Bluez may need Pulseaudio

 even if you don't use audio Bluetooth.

----------

## i92guboj

 *Logicien wrote:*   

> Broadcom devices may need firmware files.
> 
> Do you have a Dbus session started?
> 
> 

 

I should. A way to consistently check that would be good   :Laughing: 

In any case, I think that blueman will error out when starting if dbus is not in place. I remember that much from one of my experiments.

 *Quote:*   

> Try to connect from your cellular.

 

Please, define "connect". I have tried pairing both ways and it doesn't seem to make a difference. It pairs, however issuing the connect command from bluetoothctl gives the error above. I don't know how to issue that same command from an Android phone. I usually just use the "share" feature, and then pick "bluetooth" to send something (a photo, for example). It will always fail as well.

----------

## i92guboj

Also, I am asuming that being unable to connect is a bad thing. I have no idea if that's true though.

My only concern is being able to send files one way or the other. That's all I want. I don't need modem capabilities, I don't need to play audio using bluetooth or something like that. Just send a couple photos.

I use my phone when at work to connect to the internet from my laptop, using a wifi zone, and passing photos using that is hurting my data plan badly. I could be using bluetooth for that purpose instead and my life would be much easier. But, as always, getting bluetooth to work is demonstrating to be a daunting task.

----------

## i92guboj

After running circles for several hours, I am able to send files TO the phone. However, I can't still send files FROM the phone TO the laptop, which is precisaly what I need.

I recompiled several packages with USE=bluetooth and did a few other things though I am not sure they are entirely relevant. I have to double check everything. Also, obexftp doesn't automatically error when trying to connect, though it doesn't work anyway, but it says something more now:

```
# obexftp -b B0:E2:35:F8:E9:29 -l

Browsing B0:E2:35:F8:E9:29 ...

Connecting...failed: connect

unknown error on connect

Still trying to connect

Connecting...failed: connect

unknown error on connect

Still trying to connect

Connecting...failed: connect

unknown error on connect

Still trying to connect
```

It takes a bit, like it's checking something.

I am wondering whether this could be some kind of python versioning issue. It wouldn't be the first time I stump on this python_single_target stuff. But it's been a long day. 

If I can sort something out tomorrow I'll let you know. 

It's getting more difficult each day to make things work, ugh. I'm getting old, maybe  :Razz: 

----------

## i92guboj

Also, when I try to send a file from my phone, right now, the blue tray icon shows activity (the white B logo inside of it turns green). I guess that means that it's, at least, trying to do something, but not sure exactly what.

When that happens, in less than one second, I can see this in the terminal from where I launched blueman: 

```

_________

__init__ (/usr/lib64/python3.4/site-packages/blueman/main/Device.py:26)

caching initial properties 

_________

__del__ (/usr/lib64/python3.4/site-packages/blueman/main/Device.py:72)

deleting device /org/bluez/hci0/dev_B0_E2_35_F8_E9_29 

_________

Destroy (/usr/lib64/python3.4/site-packages/blueman/main/Device.py:94)

invalidating device /org/bluez/hci0/dev_B0_E2_35_F8_E9_29 

```

Then it pauses for a couple seconds, and after that it outputs some more lines:

```

_________

__init__ (/usr/lib64/python3.4/site-packages/blueman/main/Device.py:26)

caching initial properties 

_________

__del__ (/usr/lib64/python3.4/site-packages/blueman/main/Device.py:72)

deleting device /org/bluez/hci0/dev_B0_E2_35_F8_E9_29 

_________

Destroy (/usr/lib64/python3.4/site-packages/blueman/main/Device.py:94)

invalidating device /org/bluez/hci0/dev_B0_E2_35_F8_E9_29 

_________

__init__ (/usr/lib64/python3.4/site-packages/blueman/main/Device.py:26)

caching initial properties 

_________

__del__ (/usr/lib64/python3.4/site-packages/blueman/main/Device.py:72)

deleting device /org/bluez/hci0/dev_B0_E2_35_F8_E9_29 

_________

Destroy (/usr/lib64/python3.4/site-packages/blueman/main/Device.py:94)

invalidating device /org/bluez/hci0/dev_B0_E2_35_F8_E9_29
```

I have no idea if all this "delete device" and "invalidate device" stuff means something or not.

 :Rolling Eyes: 

----------

## i92guboj

Ok.

I just sent my first file using bluetooth from my phone to my laptop, with success.

Things I did (so you can try).

I added these into my kernel and recompiled: CONFIG_BRIDGE, CONFIG_BRIDGE_IGMP_SNOOPING, CONFIG_BRIDGE_VLAN_FILTERING, CONFIG_VLAN_8021Q, CONFIG_VLAN_8021Q_GVRP and CONFIG_VLAN_8021Q_MVRP

I emerged bluez-firmware, and compiled /lib/firmware/BCM2033-FW.bin into my kernel image

I unmasked, keyworded and emerged the latest blueman alpha, and the latest unstable bluez

I emerged obexftp

I also added the "network" use flag to blueman, this is the last thing I did along with the kernel bridge stuff

Probably I did many more things I don't remember right now.

I will try to revert some of these and see if the thing continue working or breaks. In any case, if you stump into this remember that this thread is only about getting the ability to transfer files to and from my phone, nothing else. I am not interested in bt audio nor anything else.

EDIT: I removed the firmware from the kernel and unmerged it, it works, so I assume its out of the equation. I recompiled the kernel taking out all of the options I added above, except CONFIG_BRIDGE. That also worked fine.

As for obexftp, I unmerged it and I could still send files, but not receive them. So, I need it to receive files it seems. Any indication about that would have saved me many hours, but taking into account that's such a basic functionality, if I am right and you need that to receive files, the package should be a DEPEND for bluez or blueman.

After I am done with the rest of my checks, I might open a bug about that, if none has been reported already.

2nd EDIT

I toyed a bit more with the obexftp thing. It's not needed, I was wrong. It seems that, for some reason, when the little "B" logo is white, the first time I send a file it turns green and the transfer fails. Once it's green, I can send files and it will work. I have no idea why. It seems that it needs to be already connected or otherwise the transfer will immediately timeout and fail.

That confused me, and I thought that obexftp had something to do with that. But it seems that's not true.

3rd EDIT

I tried reverting to stable bluez and non-alpha blueman. Blueman could be reverted to ~amd64 without trouble. However, downgrading bluez broke it again. 5.44 works, 5.43-r1 doesn't. I'll truly have to set a watch on this, just next to my watch on samba, and double check my system updates not to touch these unless I have some spare time to fix stuff that will break.

I'll check a couple more things and then post here as a reminder on which things did the magic, for whomever stumps into this and for my own future reference.Last edited by i92guboj on Fri Apr 07, 2017 11:46 am; edited 1 time in total

----------

## Jaglover

Thanks for sharing, I have had issues with BT, too. Currently only about every third attempt to transfer a file succeeds. The weird thing is only my Motorola phone has problems, Asus tablet transfers files no problem. Go figure.

----------

## i92guboj

 *Jaglover wrote:*   

> Thanks for sharing, I have had issues with BT, too. Currently only about every third attempt to transfer a file succeeds. The weird thing is only my Motorola phone has problems, Asus tablet transfers files no problem. Go figure.

 

That's the reason why I never used this technology in any intensive manner, and that's the reason why I never endorse it.

It never worked reliably. I have no interest in knowing if the problem is the zillion proprietary implementations around, or maybe the network specifications at a physical level, blah... when something as simple as this keeps failing miserably for over twenty years it's about time to concentrate on something else.

It has never been particularly easy to use either. There are bluetooth dongles in every single drawer which have only been used by the techie son or nephew the day they came into your house, and have never been used again because the papas and the mamas have no idea how to correctly pair the thing that keeps disconnecting every five minutes. They have no idea whether the thing is connected or not, to start with.

But trends are not necessarily focused on efficiency, are they?   :Laughing: 

----------

## Jaglover

I just checked my kernel and I have none of those options enabled. I think I have to study what they are for.

----------

## i92guboj

If I had to guess I'd say they are related to that ppp-over-bt thing people use. 

But I have no idea.

When I get some spare time I'll do some more trimming down of this mess, and they will probably probe to be of no use for my concrete purpose.

All in all, I suspect that bluez version was the issue here. Maybe the "network" use flag had something to do as well. I'll let you all know once I get the time to check.  :Wink: 

----------

