10

I am dual booting Ubuntu and Windows 8. I have a Microsoft bluetooth mouse. It is working properly in both OSes but I have to pair every time when I switch OS.

Is there any way to use the bluetooth mouse without needing to pair each time?

5

This answer works for bluetoothd v5.35 - I assume that it will also work with earlier releases of bluetoothd v5.

  1. Pair with the device in linux
  2. Reboot
  3. Pair with the device in windows
  4. Extract the link key as described by thezeroth
  5. Turn off the BlueTooth device and reboot into linux

Make sure to have your device turned off when booting linux.

Otherwise it will try to connect to the device repeatedly with the old (and now invalid) link key. This might trigger anti brute-forcing measures rendering the device unreachable.

Go to the subfolder that is named after the device's address. You should find a file named 'info' there. Open that.

sudo nano /var/lib/bluetooth/XX:XX:XX:XX:XX:XX/YY:YY:YY:YY:YY:YY/info

In the [LinkKey] section set the Key. Example:

Key=3E717C5B8735C1984B71636D7B941DEE

Now check the [General] section and set

Trusted=false

Save, and restart bluetoothd:

sudo service bluetooth restart

When you turn on the device, a popup should appear, asking if you want to authorize the connecting bluetooth device. Of course you do!

If you extracted the link key from Mac OS you'll need to reverse the byte order of the key. Mac OS saves it in reverse endianness.

1

you should configure both windows and ubuntu to use the same key (password) when connecting with your mouse.

pair it with your ubuntu, then restart to windows, pair it and get the key windows using to connect to the mouse, see my answer here to learn how:

https://superuser.com/questions/229930/finding-bluetooth-link-key-in-windows-7-to-double-pair-a-device-on-dualboot-com

then reboot to ubuntu open terminal:

sudo -i
cd /var/lib/bluetooth/
ls

note your bluetooth adaptor MAC address

cd [put adaptor mac address here]
nano linkkeys

change the key in front of MAC address of your mouse to the key windows is using

press Ctrl+X and y and Enter to save and then reboot. now your mouse should work on both OS.

  • @KasiyA root required to edit linkkeys – thezeroth Nov 26 '14 at 9:58
  • Why not you don't use sudo nano /var/lib/Bluetooth/put_adaptor_mac address_here/linkkeys instead of switching to root user. 'hm yes my bad edit. – αғsнιη Nov 26 '14 at 10:40
  • @KasiyA I ran into some issues when i did it the way u r suggesting on my particular setup, i agree that in theory it can be done without sudo -i, but as we are doing a reboot at the end, that shouldn't cause any problem. I'm just providing the exact solution that worked for me and avoiding giving answers that i guess would work. – thezeroth Nov 29 '14 at 12:28
1

You might have been able to find a solution by now. Nevertheless, this should help:

Quoted from http://ubuntuforums.org/showthread.php?t=1479056 (with some formatting added)

Hi, I got it to work with mine, by copying the bluetooth link key. Here is what I did:


Find the bluetooth address of the PC/dongle (let's say AA:11:11:11:11:11).Find the bluetooth address of the keyboard (let's say BB:22:22:22:22:22).Pair the device normally, under Linux (via the Gnome panel).
There should be a file called /var/lib/bluetooth/AA:11:11:11:11:11/linkkeys, which contains a line like this:

BB:22:22:22:22:22 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 0 6

Here, xxxx is 16 bytes written continuously in hexadecimal, that's the link key.

Pair the device normally, under Windows (this will change the key). Get the key from Windows. In my case, it was in this registry entry:

SYSTEM\ControlSet002\services\BTHPORT\Parameters\Keys\aa1111111111\bb2222222222


Unfortunately, RegEdit says "access is denied" when I get to Keys, even when logged on as administrator. (I suppose it might be in another ControlSet in some cases.)


Reboot under Linux, install chntpw. The version packaged with Lucid v0.99.5 doesn't seem to support registry in 64-bit. The latest version in the Debian repo (v0.99.6-2 as of writing) worked for me.

To avoid unwanted modifications of the Windows registry from Linux, I've copied the SYSTEM file somewhere else, from: /path/to/Windows/System32/config/SYSTEM
I've then opened it with chntpw (browse registry with ls/cd; help with ?):

chntpw -e SYSTEM
ls
cd ControlSet002\services\BTHPORT\Parameters\Keys
ls
cd aa1111111111
ls
hex bb2222222222

This produces something like this:

:00000 xx xx xx xx xx xx xx

Here, xx xx xx is another 16 bytes, in hexadecimal, represented the link key set up in Windows.

Finally, I copied that (and removed the spaces) to replace the value already in /var/lib/bluetooth/AA:11:11:11:11:11/linkkeys.

I had to disconnect and reconnect (via the Gnome applet), but I had to do that sometimes anyway. (It doesn't seem to work before being logged on either, but that the same, it was happening even with being paired under Linux only. That's probably a different problem.)

It worked for me. It's probably a bit complex for people who are not comfortable editing config files. I think it's safer to work on a copy of the SYSTEM registry file too, just in case something goes wrong.

0

Bluetooth Mouse with Windows 10 and K/Ubuntu 17.10 Dual Boot – HP Z5000 Bluetooth Mouse

There is a long list of suggestions on this topic most are old and are complicated to follow. This is an alternative to enable the same bluetooth mouse to work on both Windows 10 and Kubuntu 17.10. It’s fairly simple. This should work in other Debian systems and perhaps for other bluetooth devices.

FIRST STEPS:

1/. First pair in Windows. Save a copy of the bluetooth keys to a USB stick then print it. This is helpful in determining the computer and device addresses for use in changing the Windows LinkKey. Using regedit (In the result left click to enable administrator rights) go to - HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\BTHPORT\Parameters\keys\computer MAC\device MAC.

2/. Reboot to Linux then pair in linux.

3/. Open Nautilus via terminal with su for full root:

4/. Using Nautilus navigate to bluetooth via file system ROOT - var – lib - bluetooth

5/. From Bluetooth open the 12 digit number (machine MAC address) opens up to device MAC address

6/. Open device MAC

7/. Opens to Info folder

8/. Open Info – displays Linux LinkKey data - either save a copy or print screen / file or print a copy to use later in this process. It makes inputting the Linux LinkKey much easier.

WINDOWS 10:

Swithch off mouse before starting Windows and do not reconnect. The finger/touch pad will be the only means to proceed.

1/. Login with normal user password

2/. Search for regedit

3/. In the result left click to enable administrator rights.

4/. Go to HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\BTHPORT\Parameters\keys\computer MAC\device MAC

The the computer and device address will at least be similar or even identical in Linux and Windows. This can be ckecked from the printed copies (if made). 5/. To gain access to the Keys files elevated privilages are needed (see https://www.howtogeek.com/262464/how-to-gain-full-permissions-to-edit-protected-registry-keys/).

6/. Click on keys and then Device Mac

This will open up a binary value editor:

1/. Input the 32 pair linux key that was obtained using Nautilus.

2/. The original LinkKey will be seen as two lines of 8 paired digits. There will be three lines visible.

3/. Place the curser at the start of the first line and input the Linux LinkKey. The curser will automnatically move to the next pair.

4/. The input will appear in capitals, however it will be automatically be converted to lowercase on completion. Windows will convert the key characters to HEX values during this process this will be seen to the right of the new LinkKey.

5/. When the new key input is complete, place the curser at the start of the original Key and delete the original two lines. This will leave three lines as originally.

6/. Close the editor which will save the changes if it’s reopened the key appear in lower cass and in Windows format (separeated by commas not colons)

7/. Collapse HKEY-L_M and exit Window registry editor.

FINALLY:

Close down Windows 10 and reboot to Windows again without turning on the mouse. Once fully booted turn on the mouse – it should now work in both Kubuntu 17.10 and Windows 10.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.