1080*80 ad

Minisforum AI X1 Pro Linux: Dual Boot Bluetooth Troubleshooting

How to Fix Bluetooth Pairing Issues in a Windows and Linux Dual-Boot

If you’ve ever felt the frustration of your Bluetooth mouse, keyboard, or headphones working perfectly in Windows but refusing to connect after you boot into Linux, you’re not alone. This is a classic and vexing issue for dual-boot users. The good news is that there’s a permanent fix, and this guide will walk you through exactly how to solve it.

The problem isn’t a bug in Linux or a fault with your hardware. Instead, it’s a conflict in how your operating systems handle security keys for paired devices.

Understanding the Dual-Boot Bluetooth Problem

Here’s what’s happening under the hood: When you pair a Bluetooth device with an operating system, they exchange a unique security key, often called a Long Term Key (LTK). This key is stored by both your computer and your Bluetooth device, allowing them to reconnect automatically in the future.

The issue arises in a dual-boot environment:

  1. You pair your device in Windows, which generates and stores Key A. Your device now has Key A in its memory.
  2. You reboot into Linux and pair the same device. Linux, being a separate OS, is unaware of Key A. It generates a brand new Key B and stores it.
  3. Your Bluetooth device, to complete the new pairing, overwrites Key A with the new Key B.
  4. When you reboot back into Windows, your computer presents Key A, but your device only knows Key B. The result is a connection failure.

The solution is to manually copy the Bluetooth pairing key from your Windows installation and apply it to your Linux configuration. This makes both operating systems present the same key, tricking your Bluetooth device into thinking it’s always connecting to the same machine.


Step-by-Step Guide to Syncing Bluetooth Keys

This process involves accessing a protected Windows system file from Linux. While it may seem complex, following these steps carefully will resolve the issue.

Step 1: Pair in Windows and Prepare Linux

Before you begin, ensure your setup is ready.

  • First, pair your Bluetooth device(s) in Windows. This is crucial because we need to extract the key that Windows generates. Make sure the device connects and works correctly.
  • Next, boot into your Linux distribution.
  • You will need a tool to read the Windows Registry from Linux. We recommend chntpw, a lightweight and effective utility. You can install it on most Debian/Ubuntu-based systems with the following command:
    bash
    sudo apt update
    sudo apt install chntpw

Step 2: Locate and Mount Your Windows Partition

You need to access the Windows SYSTEM registry file. First, identify your Windows partition. You can use a tool like GParted or the lsblk command in the terminal to find it. It will typically be a large NTFS partition.

Once you find it, create a mount point and mount the partition.

# Create a directory to mount Windows
sudo mkdir /mnt/windows

# Mount your Windows partition (replace /dev/nvme0n1p3 with your actual partition)
sudo mount /dev/nvme0n1p3 /mnt/windows

Important: You must have read-write permissions to follow the next steps. If you encounter errors, you may need to disable Fast Startup in Windows, as it can leave the filesystem in a locked state.

Step 3: Extract the Bluetooth Key from the Windows Registry

Now we’ll use chntpw to navigate the registry hive and find our key.

  1. Navigate to the directory containing the Windows registry files:

    cd /mnt/windows/Windows/System32/config
    
  2. Run chntpw on the SYSTEM file to enter the registry editor:

    sudo chntpw -e SYSTEM
    
  3. You are now in a command-line registry editor. Use ls to list contents and cd to change directories. The path to the Bluetooth keys can vary slightly, but it is generally:
    ControlSet001\Services\BTHPORT\Parameters\Keys

    Navigate there one step at a time:

    > cd ControlSet001\Services\BTHPORT\Parameters\Keys
    
  4. Inside this directory, you’ll see a folder named after the MAC address of your computer’s Bluetooth adapter. cd into it.

    > cd <your_adapter_mac_address>
    
  5. Inside this folder, you will see entries for each paired device, named by their MAC address. You can list them with ls. For each device you want to fix, you need its key. Use the hex command to display the value.

    > hex <your_device_mac_address>

This will output a block of data. The value you need is the Long Term Key (LTK). It is a 32-character hexadecimal string. Carefully copy this key and save it in a text file.

Step 4: Apply the Key in Linux

The final step is to replace the key Linux generated with the one you just copied from Windows.

  1. Navigate to the Linux Bluetooth configuration directory:

    cd /var/lib/bluetooth/<your_adapter_mac_address>/<your_device_mac_address>
    

    Note: The MAC addresses should be the same ones you saw in the Windows registry.

  2. Inside this directory, there is an info file. Open it with root privileges using a text editor like nano:

    sudo nano info
    
  3. Look for the [LongTermKey] section. You will see a Key= line followed by a 32-character string.

  4. Delete the existing key and replace it with the key you extracted from Windows. Ensure there are no extra spaces. The format should look like this:
    Key=ABCDEF1234567890ABCDEF1234567890

  5. Save the file (in nano, press Ctrl+O, Enter, then Ctrl+X).

Step 5: Restart and Test

To apply the changes, you must restart the Bluetooth service.

sudo systemctl restart bluetooth

Now, try connecting your Bluetooth device. It should connect instantly without needing to be re-paired. From now on, your device will work seamlessly whether you boot into Windows or Linux. Repeat Steps 3 and 4 for any other Bluetooth devices you need to fix.

Source: https://www.linuxlinks.com/minisforum-ai-x1-pro-running-linux-dual-booting-bluetooth-issues/

900*80 ad

      1080*80 ad