Quick Fix for Problems Using Bluetooth and Blueman from the Raspberry Pi Raspbian Desktop (Wheezy)

pi_Blueman

Editor’s note: The instructions in this blog post are for the Wheezy version of Raspian and not for Jessie, the newest version as of February 26, 2016.

Bluetooth and Raspberry Pi are a natural combination, allowing your Pi to communicate wirelessly with devices like our Bluetooth home automation switch. However, recent versions of Raspian have had permission issues that won’t let ordinary users open Blueman, the desktop Bluetooth program, without being root. Fortunately, the solution is easy: just add the current user to the bluetooth group. Here are the details:

The Problem

You install Raspbian on your Pi, boot up and log in as “pi” or another normal user. You install Blueman, the graphical interface to Bluetooth for the Pi, according to the instructions here, and plug in your Bluetooth adapter. You select Bluetooth Manager from Menu > Preferences and the icon appears on your desktop. But when you click on it, or right-click and select Setup New Device, the rotating “busy” symbol appears next to the cursor for moment, but the Blueman window fails to open.

The Solution

This happens because when Raspian installs Blueman and the other Bluetooth software, it does not automatically add ordinary users to the bluetooth group. This group gives users permissions to access D-Bus, which Bluetooth uses for communication in Raspian. This causes a Permission Denied error whenever a Bluetooth process initiated by the unprivileged user attempts to access Blueman. The solution is easy. Just add the user that will use Bluetooth to the bluetooth group:

1. Open a terminal window.
2. Type the following at the prompt
sudo usermod -G bluetooth -a <username>

Replace <username> with your actual username, usually pi.

Add user to Bluetooth group

You can check it by typing:

cat /etc/group | grep bluetooth

You should see your username at the end of the group:

bluetooth:x:111:pi

Check if current user is in Bluetooth group

Check if current user is in Bluetooth group

Type sudo reboot to restart your Pi, then log in again. You should now be able to access Bluetooth using Blueman.

I hope this guide is useful. If you have any other questions, please comment here or contact us at support@plugable.com.

32 comments on “Quick Fix for Problems Using Bluetooth and Blueman from the Raspberry Pi Raspbian Desktop (Wheezy)”

  1. wned2012

    You’ve hit on the exact problem I’m having. Unfortunately, when I make the modification you explain, I end up with an unusable desktop – the title bar flashes on-and-off, and there are no options when it does appear, so I have to unplug my board. I’m using an R Pi2 with Raspian. I’ve tried this twice, and am not looking forward to re-installing the entire OS all over again. If you have any guesses as to why this is happening, that would be really cool.

    • David Roberts

      Thanks for posting! The flashing taskbar problem appears to be related to the UI changes that were introduced right around the time this Bluetooth permissions issue first appeared. A work-around is to return to the default LDXE desktop. Here is how to do it from the desktop with the flashing bar.

      1. Right-click on the desktop.
      2. Select Desktop Preferences
      3. Click the Advanced tab
      4. Select Show menus provided by window managers when desktop is clicked.”
      5. Click Close
      6. Right-click the desktop again.
      7. A new menu should appear. Select Terminal Emulator.
      8. At the prompt issue these commands:
      sudo apt-get remove raspberrypi-ui-mods
      sudo reboot

      The Pi should start with the default desktop and a working Blueman.

      Please comment if you have any problems with this

    • fap

      I have the same nasty behaviour. And not the single one. Anyway, RP2 is just a toy so treat it accordingly.

  2. Ivan Wampfler

    I find that if after log in, I precede “startx” with “sudo”, all is well. I am using an Raspberry Pi2 with Raspian.

    • David Roberts

      This will work, but then your are starting up the LDXE desktop as root, which isn’t a good idea. Try sudo usermod -G -a bluetooth after you start the desktop normally. Then you should be able to use Blueman always after that.

  3. Steve

    I just did this. I’m now rebuilding my pi. Thanks! /sarcasm

    DO NOT TYPE sudo usermod -G bluetooth

    TYPE sudo usermod -G -a bluetooth

    That way you don’t overwrite all the groups was a member of with just bluetooth

    Gahh! Serves me right for not reading the man page before trusting this :/

    • David Roberts

      Hi Steve, Thank you for your comment. You are right. I will update the post to include the -a switch. Thanks for catching that!

      It also turns out that wiping out the other groups is what caused the UI problems after making the change, so I have removed that information.

      Here is a list of the default groups for pi, including the added bluetooth group:

      adm:x:4:pi
      dialout:x:20:pi
      cdrom:x:24:pi
      sudo:x:27:pi
      audio:x:29:pi
      video:x:44:pi
      plugdev:x:46:pi
      games:x:60:pi
      users:x:100:pi
      netdev:x:106:pi
      input:x:999:pi
      spi:x:998:pi
      i2c:x:997:pi
      gpio:x:996:pi
      bluetooth:x:111:pi

      This command will restore them for pi:

      sudo usermod -G adm,dialout,cdrom,sudo,audio,video,plugdev,games,users,netdev,input,spi,i2c,gpio,bluetooth -a pi

      This command restores the original UI:

      sudo apt-get install raspberrypi-ui-mods

  4. Graham

    I had the same problem and typing:

    sudo usermod -G bluetooth -a pi

    sorted out the Bluetooth Manager UI not loading.

    However, I still have the problem of not seeing nearby devices in the Bluetooth Devices list.

    Any suggestions?

    The bluetooth dongle is detected:

    pi@raspberrypi ~ $ lsusb

    Bus 001 Device 008: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)

    and the status appears to be fine:

    pi@raspberrypi ~ $ /etc/init.d/bluetooth status
    [ ok ] bluetooth is running.

    However, when I do a scan it comes back with nothing:

    pi@raspberrypi ~ $ hcitool scan
    Scanning …
    pi@raspberrypi ~

    All I see in the Devices list is a lot of “unknown”s with greyed out keys next to them.

  5. Olivier

    i try every thing but nothing is working, i still can’t see the icon. Can someone help please i relly need this for a projet at school. thank

    • David Roberts

      Thank you for posting. If you are using a Plugable Bluetooth adapter, please contact us directly at support@plugable.com, and I can help you figure out what the problem is.

  6. Shairul

    i had been trying,but got error for the connectivity inbetween bluetooth and the raspberry. unable to tx and rx for both devices.any suggestion?

    • David Roberts

      Thanks for asking. Are you running Raspbian Wheezy or Jessie? Bluetooth has changed quite a bit with Jessie. If you have a Plugable adapter, please contact us at support@plugable.com, and I can help with this.

  7. powersongs

    Every time I install the Bluetooth service and (Bluez) and Blueman, I reboot and the gui just starts to a black screen. Every time! I tried this numerous ways. I install Jessie, then run apt-get and do the update and upgrade, then install the bluetooth packages mentioned about via the gui or command line and after a reboot and launching startx, the screen looks like it’s launching the gui and just goes black and inactive. It won’t respond to alt-ctrl-backspace or alt-ctrl-F1. If I don’t install bluetooth services the gui runs perfectly. I’ve even done a fresh image of Jessie and did no updating and just installed the bluetooth services and then run the update. Same result. I even tried removing the bluetooth dongle and rebooted. Again, same result. I have the Raspberry Pi (1) ver B and using the Raspbian Jessie image from raspberrypi.org. Anyone have a clue?

  8. powersongs

    That first sentence was supposed to read, “Every time I install the Bluetooth service(Bluez) and Blueman, …”

    • David Roberts

      Hi Powersongs,

      I haven’t tried yet to reproduce the issue you are seeing, but I did want to mention that this blog post was written for Wheezy, and Jessie is different. It already has Bluez installed and the Blueman issue mentioned in this post is no longer a problem.

      If you aren’t already, I recommend starting with the sudo apt-get update and sudo apt-get install, then try only installing Blueman (sudo apt-get install blueman). If you do this on a fresh version of Jessie, and it still fails, something else may be wrong.

      Are you installing any other software than Blueman?

      Thanks,

      David

  9. Pingback: Setting up serial ports on BT | notesonlinuxblog

  10. Andy

    Powersongs, i’m having the same problem. I’ve re-flash my micro SD card at least 3 times from a fresh install of latest version of Raspbian ( 2016-02-26 ). It seems by looking at the log file ( auth.log ) that there seems to have some kind of conflict between lightdm and pi logging in and out alternativelly. I can’t figure out how to fix this. I can’t imagine nobody encountered this problem yet but happy to see that i’m not alone in this situation. I have not yet did an apt-get upgrade, because it seems to upgrade some file that cause that problem. I’m waiting for some kind of solution. If someone can help, it would be much appreciated because it’s a pain to reinstall everything from scratch. I have Raaspberry Pi 2.

    • David Roberts

      Hi Andy,

      Starting with a fresh flash of Jessie 2/26/16 could you try doing the sudo apt-get update and the sudo apt-get upgrade then install Blueman (no need to install Bluez in Jessie, it’s already there), then try rebooting and see if you experience the same issue? I’m successfully using blueman on a Pi two with the latest Jessie without any problem. -David, Plugable Support

  11. Nicolas

    Hello David Roberts,

    I have the sam problem like Andy. I tryed your aporach but with the same result.
    I am using:

    Raspberry Pi 3b

    Raspbian Jessie
    Full desktop image based on Debian Jessie
    Version: March 2016
    Release date: 2016-03-18
    Kernel version: 4.1

    best regards Nicolas

    • David Roberts

      Hi Nicolas,

      Thank you for posting. The instructions in this post apply to Wheezy. Jessie is a different. I’ve written a blog post on getting sound working with Jessie, which also includes getting Bluetooth working:

      https://plugable.com/2016/03/14/listening-to-bluetooth-audio-on-your-raspberry-pi-3-pi-2-or-pi-zero

      The only thing to look out for is that with Raspian Jessie versions earlier than Feb. 26, 2016, you’ll need to install pi-bluetooth with this command:

      sudo apt-get install pi-bluetooth

      Also, be sure to run the raspi-config command and select the first item to expand your SD card to its full capacity:

      sudo raspi-config

      I hope this helps.

      David

  12. Giuseppe

    Hi All,

    I’ve the same problem on my RPi3. The bluetooth is power on and the status is ok but it doesn’t work.
    I don’t known why!.

    Below that I can see on my putty terminal:

    pi@RPI3:~ $ bluetoothctl
    [NEW] Controller B8:27:EB:4A:7A:90 RPI3 [default]
    [bluetooth]# power on
    Changing power on succeeded
    [bluetooth]# agent on
    Agent registered
    [bluetooth]# default-agent on
    Default agent request successful
    [bluetooth]# scan on
    Discovery started
    [CHG] Controller B8:27:EB:4A:7A:90 Discovering: yes
    [NEW] Device 00:15:4B:10:D6:2F 00-15-4B-10-D6-2F
    [CHG] Device 00:15:4B:10:D6:2F LegacyPairing: no
    [CHG] Device 00:15:4B:10:D6:2F Name: BT GPS
    [CHG] Device 00:15:4B:10:D6:2F Alias: BT GPS
    [CHG] Device 00:15:4B:10:D6:2F LegacyPairing: yes
    [bluetooth]# pair 00:15:4B:10:D6:2F
    Attempting to pair with 00:15:4B:10:D6:2F
    [CHG] Device 00:15:4B:10:D6:2F Connected: yes
    Request PIN code
    [agent] Enter PIN code: 0000
    [CHG] Device 00:15:4B:10:D6:2F UUIDs:
    00001101-0000-1000-8000-00805f9b34fb
    [CHG] Device 00:15:4B:10:D6:2F Paired: yes
    Pairing successful
    [CHG] Device 00:15:4B:10:D6:2F Connected: no
    [bluetooth]# trust 00:15:4B:10:D6:2F
    [CHG] Device 00:15:4B:10:D6:2F Trusted: yes
    Changing 00:15:4B:10:D6:2F trust succeeded
    [bluetooth]# connect 00:15:4B:10:D6:2F
    Attempting to connect to 00:15:4B:10:D6:2F
    [CHG] Device 00:15:4B:10:D6:2F Connected: yes
    Failed to connect: org.bluez.Error.NotAvailable
    [CHG] Device 00:15:4B:10:D6:2F Connected: no
    [bluetooth]#

    Thank you in advance for your help.

    Giuseppe.

    • David Roberts

      Hi Giuseppe,

      Thank you for posting your comment. It looks like Bluetooth is functional on your Pi. This connection issue looks like it could be specific to the device you are connecting. I haven’t done any testing with GPS devices so I can’t give any opinion about whether they are supported in the Pi. What happens if you try to connect a more typical device like a keyboard or mouse?

      • Giuseppe

        Thank you David,

        I’ve also tried with my phone but the connection issue still persists.

        Regards,
        Giuseppe.

  13. dharsh

    hey my bluetooth dongle stops working after running fine for couple of hours,i want top make it run all the time.How could i do this?

    thank u

    • David Roberts

      It’s hard to know the reason for this without some investigation. Do you have a Plugable adapter? If you do, please contact us directly at support@plugable.com and we can do some troubleshooting. Thanks!

  14. Ubermaster

    After a apt-get update and apt-get upgrade the bluetooth dongle stopped working. Your solution fixed the problem. Many thanks!!

  15. vijayjindalblog

    Hello sir, I have a Raspberry pi3 and I updated and upgraded my whole pi3, also I downloaded al required libraries. Downloaded BukeZ , Blueman and what not. But the Bluetooth doesn’t seem to work at all. When I go to menu on the top left and click preferences and Bluetooth configuration, I get a alert dialog saying “error connecting to BlueZ and Couldn’t start Blueman” , please help. Im not able to proceed without Bluetooth.
    Thank you.

    • David Roberts

      Hi, Thank you for posting. As we mention at the top of this post, the instructions here are only for Wheezy, an older version of Raspbian. Current versions (Jessie) should have Bluetooth audio and HID (keyboard and mouse) support out of the box and don’t need any software to be installed. This blog post gives instructions for connecting audio devices:

      https://plugable.com/2016/05/20/the-pi-and-bluetooth-find-true-love-in-the-newest-raspian-update/

      Unfortunately, Raspbian only supports Bluetooth audio and HID. It doesn’t come with support for other Bluetooth profiles. If you have a Plugable adapter, please contact us at support@plugable.com. We can help with this more specifically.

    • David Roberts

      Thank you for posting. Are you using the adapter in a Windows machine? That is where we typcially see a code 10 error, which usually means there is another Bluetooth adapter on the computer or there is a driver issue.

      These instructions here only work for Raspian Wheezy on a Raspberry Pi, which is pretty old these days. If you are using the newer version of Raspbian (Jessie), you’ll want to follow the instructions in this blog post:
      https://plugable.com/2016/05/20/the-pi-and-bluetooth-find-true-love-in-the-newest-raspian-update/

Comments are closed.