How can I avoid having to pair my bluetooth mouse all the time?

I am dual booting Ubuntu and Windows 8. I have a Microsoft bluetooth mouse. It is working properly in both OSes but I have to pair every time when I switch OS.

Is there any way to use the bluetooth mouse without needing to pair each time?


This answer works for bluetoothd v5.35 - I assume that it will also work with earlier releases of bluetoothd v5.

  1. Pair with the device in linux
  2. Reboot
  3. Pair with the device in windows
  4. Extract the link key as described by thezeroth
  5. Turn off the BlueTooth device and reboot into linux

Make sure to have your device turned off when booting linux.

Otherwise it will try to connect to the device repeatedly with the old (and now invalid) link key. This might trigger anti brute-forcing measures rendering the device unreachable.

Go to the subfolder that is named after the device's address. You should find a file named 'info' there. Open that.

sudo nano /var/lib/bluetooth/XX:XX:XX:XX:XX:XX/YY:YY:YY:YY:YY:YY/info

In the [LinkKey] section set the Key. Example:

Key=3E717C5B8735C1984B71636D7B941DEE

Now check the [General] section and set

Trusted=false

Save, and restart bluetoothd:

sudo service bluetooth restart

When you turn on the device, a popup should appear, asking if you want to authorize the connecting bluetooth device. Of course you do!

If you extracted the link key from Mac OS you'll need to reverse the byte order of the key. Mac OS saves it in reverse endianness.


you should configure both windows and ubuntu to use the same key (password) when connecting with your mouse.

pair it with your ubuntu, then restart to windows, pair it and get the key windows using to connect to the mouse, see my answer here to learn how:

https://superuser.com/questions/229930/finding-bluetooth-link-key-in-windows-7-to-double-pair-a-device-on-dualboot-com

then reboot to ubuntu open terminal:

sudo -i
cd /var/lib/bluetooth/
ls

note your bluetooth adaptor MAC address

cd [put adaptor mac address here]
nano linkkeys

change the key in front of MAC address of your mouse to the key windows is using

press Ctrl+X and y and Enter to save and then reboot. now your mouse should work on both OS.


You might have been able to find a solution by now. Nevertheless, this should help:

Quoted from http://ubuntuforums.org/showthread.php?t=1479056 (with some formatting added)

Hi, I got it to work with mine, by copying the bluetooth link key. Here is what I did:


Find the bluetooth address of the PC/dongle (let's say AA:11:11:11:11:11).Find the bluetooth address of the keyboard (let's say BB:22:22:22:22:22).Pair the device normally, under Linux (via the Gnome panel).
There should be a file called /var/lib/bluetooth/AA:11:11:11:11:11/linkkeys, which contains a line like this:

BB:22:22:22:22:22 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 0 6

Here, xxxx is 16 bytes written continuously in hexadecimal, that's the link key.

Pair the device normally, under Windows (this will change the key). Get the key from Windows. In my case, it was in this registry entry:

SYSTEM\ControlSet002\services\BTHPORT\Parameters\Keys\aa1111111111\bb2222222222


Unfortunately, RegEdit says "access is denied" when I get to Keys, even when logged on as administrator. (I suppose it might be in another ControlSet in some cases.)


Reboot under Linux, install chntpw. The version packaged with Lucid v0.99.5 doesn't seem to support registry in 64-bit. The latest version in the Debian repo (v0.99.6-2 as of writing) worked for me.

To avoid unwanted modifications of the Windows registry from Linux, I've copied the SYSTEM file somewhere else, from: /path/to/Windows/System32/config/SYSTEM
I've then opened it with chntpw (browse registry with ls/cd; help with ?):

chntpw -e SYSTEM
ls
cd ControlSet002\services\BTHPORT\Parameters\Keys
ls
cd aa1111111111
ls
hex bb2222222222

This produces something like this:

:00000 xx xx xx xx xx xx xx

Here, xx xx xx is another 16 bytes, in hexadecimal, represented the link key set up in Windows.

Finally, I copied that (and removed the spaces) to replace the value already in /var/lib/bluetooth/AA:11:11:11:11:11/linkkeys.

I had to disconnect and reconnect (via the Gnome applet), but I had to do that sometimes anyway. (It doesn't seem to work before being logged on either, but that the same, it was happening even with being paired under Linux only. That's probably a different problem.)

It worked for me. It's probably a bit complex for people who are not comfortable editing config files. I think it's safer to work on a copy of the SYSTEM registry file too, just in case something goes wrong.