When dual booting Windows 7/10 and Linux Mint/Ubuntu, you may find yourself having to re-pair your Bluetooth devices again and again. This will happen every time you switch OS.
Now, how do you prevent this?
I'm answering my own question with the following guide, which has been tested on Ubuntu 14.4 and Linux Mint 17.2, 17.3 and now Linux Mint 18.x.
Best Answer
Why does this happen?
Basically, when you pair your device, your Bluetooth service generates a unique set of pairing keys. First, your computer stores the Bluetooth device's MAC address and pairing key. Second, your Bluetooth device stores your computer's MAC address and the matching key. This usually works fine, but the MAC address for your Bluetooth port will be the same on both Linux and Windows (it is set on the hardware level). Thus, when you re-pair the device in Windows or Linux and it generates a new key, that key overwrites the previously stored key on the Bluetooth device. Windows overwrites the Linux key and vice versa.
Bluetooth LE Devices: These may pair differently. I haven't investigated myself, but this may help Dual Boot Bluetooth LE (low energy) device pairing
How to fix
Using the instructions below, we'll first pair your Bluetooth devices with Ubuntu/Linux Mint, and then we'll pair Windows. Then we'll go back into our Linux system and copy the Windows-generated pairing key(s) into our Linux system.
Use
psexec -s -i regedit.exe
from Windows (harder)cmd
, then right-click the CMD and click "Run as Administrator".)psexec -s -i regedit.exe
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\BTHPORT\Parameters\Keys
. If there is noCurrentControlSet
, tryControlSet001
.Use
chntpw
from your Linux distro (easier). Start in a terminal then:sudo apt-get install chntpw
Mount your Windows system drive
cd /[WindowsSystemDrive]/Windows/System32/config
chntpw -e SYSTEM
opens a consoleRun these commands in that console:
Make a note of which Bluetooth device MAC address matches which pairing key. The Mint/Ubuntu one won't need the spaces in-between. Ignore the
:00000
.sudo edit /var/lib/bluetooth/[MAC address of Bluetooth]/linkkeys
- [the MAC address of Bluetooth] should be the only folder in that Bluetooth folder.This file should look something like this:
Change the Linux pairing key to the Windows one, minus the spaces.
Switch to root:
su -
cd to your Bluetooth config location
/var/lib/bluetooth/[bth port MAC addresses]
Here you'll find folders for each device you've paired with. The folder names being the Bluetooth devices' MAC addresses and contain a single file
info
. In these files, you'll see the link key you need to replace with your Windows ones, like so:Ubuntu, Mint, Arch:
Alternatively, reboot your machine into Linux.