friedgorilla
Posts: 1
Joined: Mon Jan 25, 2016 3:13 pm

Bluetooth Issues! Blue-utils & bluez-simeple-agent

Mon Jan 25, 2016 3:26 pm

Hi guys, I am trying to connect to a Bluetooth keyboard. The bluetooth dongle works fine but I cant get some of the stuff to work in raspbian. I browsed through the nets for hours and I cant find any solution.

I have managed to install

Code: Select all

sudo apt-get install bluez python-gobject
sudo apt-get install bluetooth bluez-utils blueman
BUT, when I run the second command, it gave me this message:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package bluez-utils is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
bluez

E: Package 'bluez-utils' has no installation candidate
I can't find a solution to install this. I tried various methods like getting a fresh image, doing apt-get update and update, but i still can't get it work.
I'm using Raspberry Pi 2 Model B, install NOOBS (Raspbian v1.5.0).

I also can't run bluez-simple-agent. They return an error message, "bluez-simple-agent command cannot be found"

Need help! Thank you very much.

User avatar
rpdom
Posts: 12947
Joined: Sun May 06, 2012 5:17 am
Location: Ankh-Morpork

Re: Bluetooth Issues! Blue-utils & bluez-simeple-agent

Mon Jan 25, 2016 3:42 pm

The functionality of bluez-simple-agent seems to have been replaced by bluetoothctl.

Unfortunately the manpage doesn't give much help

http://manpages.debian.org/cgi-bin/man. ... uetoothctl

User avatar
Douglas6
Posts: 4472
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Bluetooth Issues! Blue-utils & bluez-simeple-agent

Mon Jan 25, 2016 4:59 pm

Bluez-utils has been removed in the Bluez 5 package. Bluez-simple-agent is renamed, to simple-agent (I think) but bluetoothctl has been added for managing devices. It's a sweet little CLI used for various tasks like pairing and trusting. Google will find you examples, or here's a quote from a much longer post on this forum:

Let's go ahead and pair our Bluetooth-enabled mobile device. I've tested this set-up with a couple of Bluetooth dongles, and my Nexus 4 phone running Android 4.4. We'll use the CLI interface bluetoothctl. Start it with

Code: Select all

sudo bluetoothctl
Enter the following commands to bring up the adapter, make it discoverable (for three minutes), start a pairing agent, and make that agent the default

Code: Select all

power on
discoverable on
agent on
default-agent
Now, on your mobile device, search for devices, and initiate pairing. The paring process is slightly different depending on the dongle, so follow the directions on the Pi and on the phone. The phone may provide a random PIN, and bluethoothctl will ask you to confirm the PIN. Enter 'yes'. Then click 'pair' on the phone. Or, The phone will ask you to enter a PIN code. Enter '0000' on the phone, and bluetoothctl will ask you for a PIN code. Enter the same code. In either case, bluetoothctl should inform you that pairing was successful. It will then ask you to authorize the connection. Enter 'yes'.
Now trust the mobile device (notice that bluetoothctl features auto-complete, so you can type the first few characters of the device's bluetooth address (which was displayed a few lines previously) and hit <tab> to complete the address.

NOTE: Whenever you see 'AA:BB:CC:DD:EE:FF' or 'AA_BB_CC_DD_EE_FF' in this guide, replace it with the actual address of your mobile Bluetooth device, in the proper format (colons or underscores).

Code: Select all

trust AA:BB:CC:DD:EE:FF
Quit bluetoothctl with 'quit'.

stderr
Posts: 2178
Joined: Sat Dec 01, 2012 11:29 pm

Re: Bluetooth Issues! Blue-utils & bluez-simeple-agent

Mon Jan 25, 2016 5:02 pm

rpdom wrote:The functionality of bluez-simple-agent seems to have been replaced by bluetoothctl.
It would be wonderful to secure a promise from whoever decides to "change everything" all the time that bluetoothctl will be the way you control bluetooth from now on.

User avatar
Douglas6
Posts: 4472
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Bluetooth Issues! Blue-utils & bluez-simeple-agent

Mon Jan 25, 2016 5:13 pm

stderr wrote:It would be wonderful to secure a promise from whoever decides to "change everything" all the time that bluetoothctl will be the way you control bluetooth from now on.
Don't count on it from the guys at BlueZ.

pet2001
Posts: 1
Joined: Mon Mar 28, 2016 7:13 pm

Re: Bluetooth Issues! Blue-utils & bluez-simeple-agent

Mon Mar 28, 2016 7:17 pm

Very helpful explanation of "bluetoothctl" with an great example for pairing Keyboards and even Audio.
Its German, but the examples are easy to understand. :D

https://kofler.info/bluetooth-konfigura ... etoothctl/

sevenz
Posts: 1
Joined: Wed Apr 13, 2016 5:39 am

Re: Bluetooth Issues! Blue-utils & bluez-simeple-agent

Wed Apr 13, 2016 5:41 am

pet2001 wrote:Very helpful explanation of "bluetoothctl" with an great example for pairing Keyboards and even Audio.
Its German, but the examples are easy to understand. :D

https://kofler.info/bluetooth-konfigura ... etoothctl/
Thanks for this post! Now my keyboard bluetooth connects with my pi!

murryneb
Posts: 1
Joined: Sun May 01, 2016 2:23 pm

Re: Bluetooth Issues! Blue-utils & bluez-simeple-agent

Sun May 01, 2016 2:33 pm

Dear all,

here is how i get my bluetooth keyboard work on raspberry pi 2 with Raspian (version with no bluez-simple-agent).

[email protected]:~ $ sudo bluetoothctl
[NEW] Controller 00:1B:DC:0F:5A:0C scmbot [default]
[bluetooth]# power on
Changing power on succeeded
[bluetooth]# agent on
Agent registered
[bluetooth]# pairable on
Changing pairable on succeeded
[bluetooth]# scan on
Discovery started
[CHG] Controller 00:1B:DC:0F:5A:0C Discovering: yes
[NEW] Device DC:2C:26:41:B8:10 MEDION MD86853
[bluetooth]# scan off
[CHG] Device DC:2C:26:41:B8:10 RSSI is nil
Discovery stopped
[CHG] Controller 00:1B:DC:0F:5A:0C Discovering: no
[bluetooth]# pair DC:2C:26:41:B8:10
Attempting to pair with DC:2C:26:41:B8:10
[CHG] Device DC:2C:26:41:B8:10 Connected: yes
[agent] PIN code: XXXXXX
[CHG] Device DC:2C:26:41:B8:10 Modalias: usb:v04E8p7021d011B
[CHG] Device DC:2C:26:41:B8:10 UUIDs:
00001000-0000-1000-8000-00805f9b34fb
00001124-0000-1000-8000-00805f9b34fb
00001200-0000-1000-8000-00805f9b34fb
[CHG] Device DC:2C:26:41:B8:10 Paired: yes
Pairing successful
[CHG] Device DC:2C:26:41:B8:10 Connected: no
[bluetooth]# trust DC:2C:26:41:B8:10
[CHG] Device DC:2C:26:41:B8:10 Trusted: yes
Changing DC:2C:26:41:B8:10 trust succeeded
[bluetooth]# connect DC:2C:26:41:B8:10
Attempting to connect to DC:2C:26:41:B8:10
[CHG] Device DC:2C:26:41:B8:10 Connected: yes
Connection successful
[CHG] Device DC:2C:26:41:B8:10 Connected: no
[CHG] Device DC:2C:26:41:B8:10 Class: 0x000540
[CHG] Device DC:2C:26:41:B8:10 Icon: input-keyboard
[CHG] Device DC:2C:26:41:B8:10 Connected: yes
[bluetooth]# quit
Agent unregistered
[DEL] Controller 00:1B:DC:0F:5A:0C scmbot [default]
[email protected]:~ $

phelum
Posts: 64
Joined: Thu Jul 17, 2014 7:05 am
Location: Sydney, AUS

Re: Bluetooth Issues! Blue-utils & bluez-simeple-agent

Sun May 01, 2016 8:42 pm

Hi,

I couldn't get Bluez5 to do what I wanted (pair with any device using a certain PIN) so I grabbed the Bluez4 packages from Debian wheezy and installed them.

Cheers,
Steven

User avatar
Douglas6
Posts: 4472
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Bluetooth Issues! Blue-utils & bluez-simeple-agent

Sun May 01, 2016 9:35 pm

@murryneb: 'power on' and 'pairable on' are unnecessary.
@phelum: That's a pretty drastic step backwards.

phelum
Posts: 64
Joined: Thu Jul 17, 2014 7:05 am
Location: Sydney, AUS

Re: Bluetooth Issues! Blue-utils & bluez-simeple-agent

Mon May 02, 2016 8:45 am

Douglas6 wrote:@phelum: That's a pretty drastic step backwards.
I don't see why. It does what I want and I couldn't get Bluez5 to do the same. Perhaps I missed something. I want a BT system where any device can pair if it uses my specified PIN. This isn't a security issue because the only service is a console where someone can log in. This is for emergency access if other interfaces (e.g. WiFi) fail.

Do you know how I can get Bluez5 to do auto-pairing ?

Cheers,
Steven

User avatar
Douglas6
Posts: 4472
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Bluetooth Issues! Blue-utils & bluez-simeple-agent

Mon May 02, 2016 3:02 pm

Well, I guess I'd write my own pairing agent in Python, based on a BlueZ 5 agent, such as this: https://github.com/pauloborges/bluez/bl ... mple-agent.

But whatever works for you.

phelum
Posts: 64
Joined: Thu Jul 17, 2014 7:05 am
Location: Sydney, AUS

Re: Bluetooth Issues! Blue-utils & bluez-simeple-agent

Mon May 02, 2016 9:07 pm

Thanks for the idea and the link. I'll look into it.

Cheers,
Steven

UglyKidJoe
Posts: 3
Joined: Thu Aug 11, 2016 9:03 am

Re: Bluetooth Issues! Blue-utils & bluez-simeple-agent

Sun Aug 14, 2016 9:32 am

Hi all,

I've been trying for a month to get RPi's Bluetooth to connect to any of my devices. It fails to connect to any device I've tried.

Briefly:
2 new Raspberry Pi's
2 fresh Jessie installs

Successfully pairs to:
- Acer Laptop
- Acer tablet
- Bose Soundlink BT speaker
- HTC android phone

So all good with pairing, but the Pi's cannot connect to any of these devices.

If I try connect using the Bluez icon and add a device I get an error message saying 'Device added successfully, but failed to connect'. Same thing no matter what device I try connect to.

So I went to the command line and tried to connect with 'sudo bluetoothctl'

Down there I try manually connect to a device it connects and then immediately disconnects without asking for a pass key:

Code: Select all

[CHG] Device 04:C2:3E:15:40:FD Connected: yes
[CHG] Device 04:C2:3E:15:40:FD Connected: no
If I try connect manually I get this:

Code: Select all

[CRAIGS-LAPTOP]# trust 04:C2:3E:15:40:FD
Changing 04:C2:3E:15:40:FD trust succeeded
[CHG] Device 54:60:09:D7:B7:07 RSSI: -45
[CHG] Device 54:60:09:D7:B7:07 RSSI: -30
[CRAIGS-LAPTOP]# connect 04:C2:3E:15:40:FD
Attempting to connect to 04:C2:3E:15:40:FD
Failed to connect: org.bluez.Error.Failed
So I've heavily googled and searched this forum. There are posts with links to posts with links to posts etc and tried so many suggestions, but the bottom line is it just doesn't work.

What's confusing is Bluez vs bluetoothctl. Do they play together?

Maybe someone could post the commands to uninstall bluetooth entirely (Bluez and bluetooth ctl) and reinstall them. Maybe that would help?

Any advice would be greatly appreciated. It's never worked out of the box on both Pi's (from different vendors), so I'm really stumped here...

User avatar
Douglas6
Posts: 4472
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Bluetooth Issues! Blue-utils & bluez-simeple-agent

Sun Aug 14, 2016 2:35 pm

First, bluetoothctl is part of the BlueZ Bluetooth protocol stack, so yes, they play well together.
Second, you need to ask yourself what are you connecting for? Streaming audio? Serial communication? File transfer? Networking? HID? Each of these require different configurations on (at least) the Pi, before it will connect.
Also, please start a new thread with further questions unrelated to this topic.

UglyKidJoe
Posts: 3
Joined: Thu Aug 11, 2016 9:03 am

Re: Bluetooth Issues! Blue-utils & bluez-simeple-agent

Mon Sep 12, 2016 4:36 pm

@Douglas Thanks for your reply.
what are you connecting for? Streaming audio? Serial communication? File transfer? Networking? HID? Each of these require different configurations on (at least) the Pi, before it will connect.
I only want them to connect so that I can set the Pi as a trusted device on the androids so that I can switch of the lock-screens on them. The Pi is always home and always on so it seems like a sensible device to connect to.

Still no luck though :(

User avatar
Douglas6
Posts: 4472
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Bluetooth Issues! Blue-utils & bluez-simeple-agent

Mon Sep 12, 2016 5:27 pm

I think you'd need to add A2DP to the Pi in order to connect it to an Android phone and make it a 'trusted device'. Here's a good tutorial to do that: https://github.com/davidedg/NAS-mod-con ... Audio5.txt

lis720
Posts: 1
Joined: Tue Dec 05, 2017 9:14 pm

Re: Bluetooth Issues! Blue-utils & bluez-simeple-agent

Tue Dec 05, 2017 9:19 pm

Same problem
figured it out w/ this updated install command

Code: Select all

sudo apt-get install bluetooth bluez blueman
it works for me:)

User avatar
Douglas6
Posts: 4472
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Bluetooth Issues! Blue-utils & bluez-simeple-agent

Tue Dec 05, 2017 10:33 pm

Glad to hear you found something that works for you.

It's not good advice, however. BlueZ comes pre-installed on all recent Raspbian distributions, and blueman is unnecessary and could cause conflicts.

User avatar
jcyr
Posts: 62
Joined: Sun Apr 23, 2017 1:31 pm
Location: Atlanta

Re: Bluetooth Issues! Blue-utils & bluez-simeple-agent

Fri Dec 08, 2017 6:42 pm

BlueZ comes pre-installed on all recent Raspbian distributions, and blueman is unnecessary and could cause conflicts.
Indeed BlueZ does come preinstalled... with a somewhat dated version :( (5.43 last I checked)

There have been numerous bug fixes and improvements since then. Fortunately, upgrading from source to 5.47 is not too difficult but requires a Pi specific patch.
If you want your child to get the best education possible, it is actually more important to get him assigned to a great teacher than to a great school. -- Bill Gates

User avatar
Douglas6
Posts: 4472
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Bluetooth Issues! Blue-utils & bluez-simeple-agent

Fri Dec 08, 2017 6:51 pm

Are you aware of any fixes between the 5.43 and 5.47 versions that would affect a typical Raspberry Pi user?

User avatar
jcyr
Posts: 62
Joined: Sun Apr 23, 2017 1:31 pm
Location: Atlanta

Re: Bluetooth Issues! Blue-utils & bluez-simeple-agent

Fri Dec 08, 2017 7:03 pm

Typical? What exactly is the typical user, and why should I care?

I use Pi3's in headless control applications where I develop custom BLE central and device applications. One notable improvement is the introduction of mesh profile support in the latest release.
If you want your child to get the best education possible, it is actually more important to get him assigned to a great teacher than to a great school. -- Bill Gates

AlekEagle
Posts: 10
Joined: Sat Nov 04, 2017 11:29 pm

Re: Bluetooth Issues! Blue-utils & bluez-simeple-agent

Mon Dec 11, 2017 1:28 am

How can I install A2DP for raspberry pi?

User avatar
Douglas6
Posts: 4472
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Bluetooth Issues! Blue-utils & bluez-simeple-agent

Mon Dec 11, 2017 7:57 pm

You would do better to ask your (semi-)specific question in a new post, rather than tacking it onto an unrelated thread.

A2DP is implemented by a combination of BlueZ and BlueALSA, both of which are included in recent versions of Raspbian. Instructions for pairing and connecting your Bluetooth speaker can be found by searching this forum or the interweb generally.

valk791
Posts: 1
Joined: Sat Dec 30, 2017 2:10 pm

Re: Bluetooth Issues! Blue-utils & bluez-simeple-agent

Sat Dec 30, 2017 2:15 pm

Douglas6 wrote:
Sun Aug 14, 2016 2:35 pm
First, bluetoothctl is part of the BlueZ Bluetooth protocol stack, so yes, they play well together.
Second, you need to ask yourself what are you connecting for? Streaming audio? Serial communication? File transfer? Networking? HID? Each of these require different configurations on (at least) the Pi, before it will connect.
Also, please start a new thread with further questions unrelated to this topic.
Hi I have the same problem of UglyKidJoe, the devices get paired but once connected and after few second they get disconnected.
I would like to connect an OBD adapter to run pyOBD. Can you please help me? Thank you in advance.

Return to “Troubleshooting”