Bluetooth pairing on dual boot Windows & Linux
March 3rd, 2024
I run both Windows and Linux on my desktop and sharing Bluetooth devices between them is really annoying. Every time I switch operating system I have to re-pair devices I want to use.
Why does this happen?
When pairing a Bluetooth device, a unique set of pairing keys are generated and exchanged between the device and computer. Since dual-boot setups use the same hardware, each operating system generates unique keys for the same MAC address and thus overwrites the previously stored key on the Bluetooth device.This guide documents how to copy the pairing keys from Windows and use them in Linux. For me that’s Pop!_OS , but this should work on any Debian-based OS.
Pairing Devices
First, pair your devices with Linux. This will generate the necessary records of the devices which we will update with the Windows keys.
Then switch to Windows and re-pair your devices. Now you’re ready to copy the pairing keys from Windows to Linux.
Extracing the keys from Windows
- Download and extract Microsoft’s PsTools
- Open a Command Prompt as Administrator
- Launch the Registry Editor with
psexec64 -is regedit
- Navigate to
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\BTHPORT\Parameters\Keys
- Each Bluetooth controller will be listed, containing entries for each pair bluetooth device listed by MAC address, with the pairing key stored as the ‘data’
- Export this key or copy down the value - this is the value we need in Linux
Adding the keys to Linux
- Start a root shell with
sudo -s
- Navigate to your Bluetooth controller directory:
cd /var/lib/bluetooth/00:00:00:00:00:00/
- List devices with
ls
- Edit the file corresponding to your device, e.g.
vim AA:AA:AA:AA:AA:AA/info
, and update the pairing key with the value exported from Windows - Restart the Bluetooth service with
systemctl restart bluetooth
Now you can seamlessly share Bluetooth devices between Windows and Linux in your dual-boot setup.