Skip to content

Instantly share code, notes, and snippets.

@sugat009
Created June 7, 2025 11:37
Show Gist options
  • Save sugat009/7a9788350d3738e58bb51a2094af1bb1 to your computer and use it in GitHub Desktop.
Save sugat009/7a9788350d3738e58bb51a2094af1bb1 to your computer and use it in GitHub Desktop.
Fix having to re-connect bluetooth devices after switching OS in dual boot setup, Windows 11 and Manjaro

Issue

If you are here, you probably already know the issue.

Cause

When you pair your devices with an operating system (OS), a unique "link key" is generated and stored on both the devices and the OS. The catch is that both Windows and Linux see your laptop's internal Bluetooth adapter as the same hardware, and thus, the same MAC address. When you switch OSes and reconnect, the new OS generates a different link key, which overwrites the previous one on your devices. This invalidates the pairing for the other OS, forcing you to "forget" and re-pair.

My PC
  • OS: Manjaro 25 and Windows 11
  • Device: Lenovo Legion 5 Pro i

Solution: Syncing Bluetooth Pairing Keys

This is the simplest solution that worked for me. It did not require installing extraordinary packages. I will not guarantee that this will work for you. The most effective way to deal with this is to make both Windows and Linux use the same Bluetooth pairing key for your devices. This involves:

  1. Pairing your device with one OS.
  2. Extracting the pairing key from that OS.
  3. Importing that key into the other OS.

Steps (I found importing keys from Windows to Linux is easier):

  1. In Linux
    1. Pair your device with Linux
    2. That's it. The pairing will come in handy later. Remember, do not try to forget and re-pair later when you reboot to Linux in step 3.
  2. In Windows
    1. Pair your device with Windows.
    2. Find your Bluetooth Adapter's MAC Address: In Windows, open Command Prompt (Admin) and type getmac /V /FO LIST. Look for your Bluetooth adapter's MAC address (it's usually listed with "Bluetooth Device" or similar). Note this down.
    3. Find your Devices' MAC Address: In Windows, go to "Settings" > "Bluetooth & devices" > "Devices". Find your device, click on them, and look for their MAC address. Note this down.
    4. Install PsExec on Windows. This tool allows you to run regedit with SYSTEM privileges, which is necessary to access the Bluetooth keys. Put this file in C://windows/system32.
    5. Open Command Prompt as Administrator.
    6. Run psexec -s -i regedit.exe. This will open the Registry Editor with SYSTEM privileges.
    7. Navigate to the Bluetooth keys in the Registry Editor: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\BTHPORT\Parameters\Keys\ Under this key, you'll see folders named after the MAC addresses of your Bluetooth adapters. Find the one corresponding to your laptop's internal Bluetooth adapter.
    8. Find your Bluetooth Adapter's Key: Under Keys, you should see a subkey named after your Bluetooth adapter's MAC address (the one you noted earlier, without colons, e.g., AA11BB22CC33).
    9. Find your Devices' Link Key: Inside your Bluetooth adapter's key, you'll find entries for paired devices. Look for an entry whose name corresponds to your devices' MAC address (again, without colons, e.g., 112233445566). The "Value Data" of this entry is the link key. Copy this hexadecimal value. Copying is hard. I just typed it out character by character. It will be a long string of numbers and letters.
  3. In Linux Again
    1. Find your Bluetooth Adapter's MAC Address in Linux: Open a terminal and run bluetoothctl. Then type list. You'll see your Bluetooth adapter's MAC address. Note it down. In Manjaro, I installed this using yay install bluez-utils
    2. Find your Devices' MAC Address in Linux: In bluetoothctl, type devices. You'll see a list of paired devices with their MAC addresses. Note your devices' MAC address.
    3. Navigate to the Bluetooth configuration directory: Open a terminal.
      1. Navigate to /var/lib/bluetooth/.
      2. You'll find a directory named after your Bluetooth adapter's MAC address (e.g., AA:11:BB:22:CC:33). cd into that directory.
      3. Inside, you'll find a directory named after your devices' MAC address (e.g., 11:22:33:44:55:66). cd into that directory.
    4. Edit the info file: Open the info file in your favorite text editor with sudo permissions.
      1. Look for a section like [LinkKey] and a line like Key=YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY.
      2. Replace YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY with the link key you copied from Windows. Ensure there are no spaces. The format of the key in Linux might be reversed or slightly different in terms of capitalization compared to Windows, so be careful to match the length and content exactly. In my case, the spaces needed to be removed and every alphabetical letter needed to be capitalized.
    5. Restart the Bluetooth service: sudo systemctl restart bluetooth
  4. Check if it worked for you.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment