If you have dual boot on your computer and use both – Windows and Linux – you have probably connected and reconnected your Bluetooth mouse & keyboard (or other Bluetooth devices) every time you reboot into the other operating system.
The problem of Bluetooth device being unpaired is due to the fact that everytime you re-pair it, the operating system will do a key exchange and will generate a key for your device, then write it into a file. Also, the Bluetooth device will store your computer’s MAC address. When you boot into the other operating system, the OS will overwrite previous stored key and so on…
The easiest way of not having to pair your device again and again is to follow the next steps…
First, pair your device with Linux, then reboot into Windows and pair the device. Reboot again and boot into Linux.
chntpw (a small utility to overwrite Windows passwords):
# apt-get install chntpw
Mount your Windows system drive/partition, then run:
# cd /mnt/yourusername/Windows/System32/config
/mnt/yourusername is the path where your Windows system is mounted.
# chntpw -e SYSTEM
You will now be at a terminal prompt “>”
# chntpw -e SYSTEM chntpw version 1.00 140201, (c) Petter N Hagen Hive name (from header): ROOT KEY at offset: 0x001020 * Subkey indexing type is: 686c File size 22020096  bytes, containing 4673 pages (+ 1 headerpage) Used for data: 324380/21525016 blocks/bytes, unused: 162/75208 blocks/bytes. Simple registry editor. ? for help. > cd ControlSet001\Services\BTHPORT\Parameters\Keys
You may use
CurrentControlSet and if the key is not found, try with
ControlSet001. In my case, the latter worked.
(…)\Services\BTHPORT\Parameters\Keys> ls Node has 1 subkeys and 0 values key name <1a2b3c4d5e6f> (…)\Services\BTHPORT\Parameters\Keys> cd 1a2b3c4d5e6f (…)\BTHPORT\Parameters\Keys\1a2b3c4d5e6f> ls Node has 0 subkeys and 1 value size type value name [value if type DWORD] 16 3 REG_BINARY <6f5e4d3c2b1a> (…)\BTHPORT\Parameters\Keys\1a2b3c4d5e6f> hex 6f5e4d3c2b1a Value of type REG_BINARY (3), data length 16 [0x10] :00000 XX YY AA BB CC DD EE FF XX YY ZZ AA BB CC DD EE ...x1..a.2..`. (…)\BTHPORT\Parameters\Keys\1a2b3c4d5e6f> q Hives that have changed: # Name None!
Once you have quit
chntpw, write down the
REG_BINARY value, skipping the leading “
:00000” and the last string “
:00000 XX YY AA BB CC DD EE FF XX YY ZZ AA BB CC DD EE …x1..a.2..`.
Also, remove the spaces, so the string would look something like this:
Please note this is a sample string and your string will look different.
Now go to edit the Bluetooth device config file:
# cd /var/lib/bluetooth/<bluetooth port MAC address>
Here you will find directories for each bluetooth devices. Change directory to the one corresponding your device’s hardware address.
Inside the device’s directory you will find a single file, called ‘
# nano info
Search for the
[LinkKey] section and replace
Key value with the one you wrote down from
Save the file and restart Bluetooth service:
# systemctl restart bluetooth
Now, reboot into Windows and check if the device works, without having to pair it again.