This guide provides updated instructions for pairing Bluetooth devices (such as keyboards or mice) in a dual-boot environment with Linux Ubuntu and Windows 10/11, incorporating community feedback and suggestions.
- Pair your Bluetooth device in Linux. This is crucial to ensure the LinkKey remains consistent.
- Note: Do not re-pair the device in Linux after completing the pairing in Windows.
- Pair the Bluetooth device in Windows. Note the MAC address of the device for later steps.
- Install the
chntpw
package to read Windows registry keys:sudo apt-get install chntpw
- Mount your Windows system drive and navigate to the System32 config folder:
cd /[MountedDrive]/Windows/System32/config
- Execute the following command in the config folder:
chntpw -e SYSTEM
- In the
chntpw
console, navigate to the Bluetooth registry keys:cd \ControlSet001\Services\BTHPORT\Parameters\Keys
- Use
ls
to list unique IDs and find your device's MAC address. - Retrieve the pairing key (hex code) associated with your device.
- Edit the corresponding file in your Linux drive:
sudo nano /var/lib/bluetooth/[Unique ID]/[Mac Address]/info
- Replace the
Key
value in the[LinkKey]
section with the pairing key from Windows. - If the
[LinkKey]
section is missing, add it manually.
- Save the changes and restart the Bluetooth service:
sudo service bluetooth restart
- Simplification with
reged
: Usereged
to export Bluetooth pairing keys directly into a file for easier identification and copying. - Bluetooth LE Devices: For Bluetooth LE devices, the data storage might differ. Users should research specific steps for these devices.
- Windows 11 Compatibility: This method is also compatible with Windows 11.
- Multiple Bluetooth Receivers: If you have multiple Bluetooth receivers, ensure you identify and use the correct pairing key.
- Changing Bluetooth MAC Address in Linux: If necessary, you can change the Bluetooth MAC address in Linux using the following commands:
sudo hciconfig hci0 down sudo bluemoon -A sudo hciconfig hci0 up sudo systemctl restart bluetooth.service
- Adding Missing [LinkKey] Section: If the [LinkKey] section is missing in the
info
file, you should add it manually.
Special thanks to the community members who provided valuable insights and suggestions, including nnnnicholas, kna0085, lguangyu, KeyofBlueS, bjoern-vh, Nielius, IgorRodriguez, princeofguilty, and others.
Please consider donate a little in this humble bitcoin wallet: bc1qrd3mexqu43qn0597d248725kdp3tr28252q64p
Windows 11 / Ubuntu 24.04
Mouse with Bluetooth 5.0 LE
I end up doing the reverse of this method to get it to work.
I tried copying the Long Term Key values from Windows to Linux, but that didn't work
but doing the reverse worked!
Here’s how you can do it:
First, Remove the current pairing of your mouse in Linux and pair it again.
Then, Note down the new MAC address and Long Term Key values, which you can find in \var\lib\bluetooth\...\{mac-address}\info
Now, reboot into Windows.
To modify the Bluetooth registry keys in Windows, you'll first need permission. Follow these steps:
1. Open the Registry Editor and navigate to ...\ControlSet001\Services\BTHPORT\Parameters\Keys
2. Right-click on the Keys folder, select 'Permissions', and add your Windows user. Grant it 'Full Control' permissions.
3. Relaunch Registry Editor
Next, rename the MAC address key of your mouse to match the one used in Linux (\var\lib\bluetooth\...\{mac-address})
(Keep the formatting as it is in Windows)
...\ControlSet001\Services\BTHPORT\Parameters\Keys\...\{mac-address}
...\ControlSet001\Services\BTHPORT\Parameters\Devices\{mac-address}
Then, navigate to ...\Keys\...\{mac-address}
and modify the LTK, ERand, and EDIV key values to match the corresponding Long Term Key values
After making these changes, restart your computer.
That’s it! Your setup should now be complete.
This method may not work with all devices, I'm having an issue with a Bluetooth 5.2 HeadPhone
When I pair it with Windows I can't find any key for the HeadPhone in ...\Parameters\Keys\...\
even with permission.