How do I pair my bluetooth device?

Asked by Alexander Rødseth on 2007-06-18

I'm having problems pairing up my mobile bluetooth device under Ubuntu. This worked previously, and as I recall after much time spent browsing, there's a bug somewhere in the chain of bluetooth utilities (bluez-pin). However, I assume that a workaround exists, hence this question.

Here are the packages I have installed:
ii bluetooth 3.9-0ubuntu4 Bluetooth stack utilities
ii gnome-bluetooth 0.8.0-0ubuntu4 GNOME Bluetooth tools.
ii kdebluetooth 0.99+1.0beta2-2+3v1ubuntu0 KDE Bluetooth Framework
ii kdebluetooth-irmcsync 0.99+1.0beta2-2+3v1ubuntu0 IrMCSync Konnector for kitchensync
ii libbluetooth2 3.9-0ubuntu1 Library to use the BlueZ Linux Bluetooth stack
ii libmultisync-plugin-irmc-bl 0.82-8build1 Adds Bluetooth support to the IrMC plugin
ii bluez-cups 3.9-0ubuntu4 Bluetooth printer driver for CUPS
ii bluez-gnome 0.6-1ubuntu3 Bluetooth utilities for GNOME
ii bluez-pcmcia-support 3.9-0ubuntu4 PCMCIA support files for BlueZ 2.0 Bluetooth
ii bluez-pin 0.30-2.1ubuntu3 Bluetooth PIN helper with D-BUS support
ii bluez-utils 3.9-0ubuntu4 Bluetooth tools and daemons
ii python-bluez 0.9.1-1 Python wrappers around BlueZ for rapid bluet

Here is my /etc/bluetooth/hcid.conf:
# HCI daemon configuration file.

# HCId options
options {
 # Automatically initialize new devices
 autoinit yes;

 # Security Manager mode
 # none - Security manager disabled
 # auto - Use local PIN for incoming connections
 # user - Always ask user for a PIN
 security auto;

 # Pairing mode
 # none - Pairing disabled
 # multi - Allow pairing with already paired devices
 # once - Pair once and deny successive attempts
 pairing multi;

 # Default PIN code for incoming connections
 #passkey "1234";

 pin_helper /usr/bin/bluez-pin


# Default settings for HCI devices
device {
 # Local device name
 # %d - device id
 # %h - host name
 name "%h-%d";

 # Local device class
 class 0x3e0100;

 # Default packet type
 #pkt_type DH1,DM1,HV1;

 # Inquiry and Page scan
 iscan enable; pscan enable;
 #discovto 0;

 # Default link mode
 # none - no specific policy
 # accept - always accept incoming connections
 # master - become master on incoming connections,
 # deny role switch on outgoing connections
 lm accept;

 # Default link policy
 # none - no specific policy
 # rswitch - allow role switch
 # hold - allow hold mode
 # sniff - allow sniff mode
 # park - allow park mode
 lp rswitch,hold,sniff,park;

I have tried having a /etc/bluetooth/pin as well.

When I plug in my usb bluetooth-dongle, it works as expected (dmesg):
[ 6426.201695] Bluetooth: HCI USB driver ver 2.9
[ 6426.260335] usbcore: registered new interface driver hci_usb

The "hcitool scan" commands work perfectly fine, and my bluetooth-device shows up with address and name.

So, how do I pair it? I've tried "bluez-pin" following the address of my device, but I'm having problems understanding the command-line syntax and possibly if and how I should use --dbus. If possible, I would prefer a window showing up asking me for the pin-code. I've tried the "xhost +"-trick as mentioned in connection with this problem on the web, but it doesn't work for me.

Any help is appreciated!

Question information

English Edit question
Ubuntu bluez Edit question
No assignee Edit question
Solved by:
Alexander Rødseth
Last query:
Last reply:
Best Alexander Rødseth (alexanro) said : #1

I found a way:
1. Do a "hcitool scan" to get the address of the device you wish to pair
2. Start "trayer" and then "bluetooth-applet"
3. Do a "hidd --connect 00:00:00:00:00:00" where you use the address you found instead
4. The bluetooth-applet will ask you for the pin and the mobile device pairs up correctly!

Good luck, hope this helps someone else. :-)

Alexander Rødseth (alexanro) said : #2

This page might help as well:

/etc/bluetooth/hcid.conf is worth spending some time on if you're still stuck

if i am trying to install a blue tooth software means it shows error. what to do?
here is the error...
~# sudo apt-get install gnome-bluetooth obexserver bluez-utils
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package obexserver

Alexander Rødseth (alexanro) said : #4

Hi, what happens if you just don't install obexserver? It's been a few years since my answer, so many things may have changed, but I don't see a mention of obexserver in the text above.

what are all the packages needed to connect bluetooth with ubuntu.

On 6/30/11, Alexander Rødseth <email address hidden> wrote:
> Question #8379 on bluez in Ubuntu changed:
> Alexander Rødseth posted a new comment:
> Hi, what happens if you just don't install obexserver? It's been a few
> years since my answer, so many things may have changed, but I don't see
> a mention of obexserver in the text above.
> --
> You received this question notification because you are a direct
> subscriber of the question.