Alright, folks, here’s the thing. Dual booting Windows and Linux? Sick of having to re-pair your Bluetooth devices every time you switch OSes? Yeah, me too. Here’s how to fix it, no nonsense, straight to the point. Thanks to the ArchWiki for the inspiration, but we’re cutting the fat and getting you what you need.
1. Prerequisites
First off, you need chntpw
, a Windows NT registry editor for Linux. Install it:
sudo apt install chntpw
2. The Problem
When you pair a Bluetooth device with your computer, it creates a unique key linked to your computer’s MAC address. Pair it on Windows, get a key. Pair it on Linux, get a different key, and bam, your device is confused because it can only handle one key per MAC address.
3. The Workaround
We make both OSes use the same key. Here’s how:
- Pair the device on Linux first.
- Reboot to Windows and pair the device again.
- Reboot back to Linux and let’s get to work.
4. Access Windows Registry from Linux
Mount your Windows partition and dive into the registry:
sudo mount /dev/sdXY /mnt # Replace /dev/sdXY with your Windows partition
cd /mnt/Windows/System32/config
sudo chntpw -e SYSTEM
Navigate to the Bluetooth keys:
cd ControlSet001\Services\BTHPORT\Parameters\Keys
5. Extract the Windows Key
Find your Bluetooth adapter’s MAC address:
bluetoothctl list
# Example output: Controller 5C:80:B6:8E:78:ED weywot [default]
In the registry editor, navigate to your adapter’s key folder:
ls # List available keys (subkeys)
cd 5c80b68e78ed # Replace with your adapter's MAC address
ls # List connected devices
Get your device’s MAC address:
bluetoothctl devices
# Example output: Device 10:4F:A8:75:C8:2E h.ear (MDR-100ABN)
In the registry editor, read the key value for the device:
hex 104fa875c82e # Replace with your device's MAC address
6. Update the Linux Key
Edit the Bluetooth device’s config on Linux:
sudo su
cd /var/lib/bluetooth/5C:80:B6:8E:78:ED # Replace with your adapter's MAC address
cd 10:4F:A8:75:C8:2E # Replace with your device's MAC address
nano info
Replace the [LinkKey]
section with the key from Windows (all uppercase, no spaces):
[LinkKey]
Key=5480E3E301493AE3E48C5A7418E82554 # Replace with the key from Windows
Type=4
PINLength=0
Save and exit (ctrl + x
).
7. Pairing a Bluetooth Mouse (Logitech MX Anywhere 3)
For mice, pair it on Linux first, then on Windows, using the same device number. Verify the mouse’s MAC address and update it if necessary.
bluetoothctl devices
# Example output: Device DA:5B:4A:88:50:8C MX Anywhere 3
If the MAC address changed, fix it:
cd /var/lib/bluetooth/5C:80:B6:8E:78:ED
mv DA\:5B\:4A\:88\:50\:8B/ DA\:5B\:4A\:88\:50\:8C # Adjust as necessary
Edit the info file with the new keys:
cd DA\:5B\:4A\:88\:50\:8C
nano info
Replace the keys:
[IdentityResolvingKey]
Key=53789B41FE80DAD0C9F18CE2E40D9D94 # Replace with the IRK from Windows
[SlaveLongTermKey]
Key=AA7A73A6BFA1FE7E247031C131E3380B # Replace with the LTK from Windows
Authenticated=2
EncSize=16
EDiv=0
Save and exit (ctrl + x
). Restart Bluetooth if necessary:
sudo systemctl restart bluetooth
That’s it. Your device should now work seamlessly on both Windows and Linux. No more re-pairing nonsense.
Enjoy!