Ubuntu – How to avoid having to pair the bluetooth mouse all the time

bluetoothdual-bootmouse

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?

Best Answer

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.