r/linuxquestions • • 21d ago

Support Having bluetooth devices stay connected when dualbooting windows/linux?

Every time i dualboot, no matter the os I have to forget my bluetooth devices (headphones, mice) before I'm able to connect them. Is there no way to like change the bluetooth id or something on linux so it thinks its a different device like my phone so i dont have to recconect my devices every time I boot into another os.

I'm on cachyOS on zephyrus g14 2020

1 Upvotes

8 comments sorted by

2

u/tanmaynargas2901 21d ago

Yeah this is the pairing key thing. each OS generates its own link key when you pair, and the device only remembers the last one. so you pair in Linux, then pair in Windows, then copy the Windows key over to Linux.

Easiest way is bt-dualboot (pip install bt-dualboot, needs chntpw). boot Linux, mount the Windows partition, run it and it pulls the keys from the Windows registry into /var/lib/bluetooth. Turn off Fast Startup in Windows first or the partition mounts read-only / dirty.

Manual way: the keys live in HKLM\SYSTEM\CurrentControlSet\Services\BTHPORT\Parameters\Keys (readable with chntpw), and on Linux they go in /var/lib/bluetooth/<adapter MAC>/<device MAC>/info under [LinkKey]. restart bluetooth after.

BLE stuff like a lot of mice is more annoying since it uses LTK/IRK instead of a single link key, and I don't think bt-dualboot handles all of that. worth trying on the headphones first.

1

u/SuAlfons 21d ago edited 21d ago

That's because your bluetooth adapter gets a new adress with each OS. It is like having two distinct sets of hardware - your devices only can stay connected, if they support multiple connections (either storing multiple valid single connections or outright parallel support of several hosts).

If they can remember your phone and your PC - maybe 2 is the max they can store?

1

u/chuggerguy Linux Mint 22.3 Zena | MATÉ 21d ago

I haven't tested this so can't vouch for it but someone just posted a tool awhile ago that might do what you want... if I'm understand correctly...

https://www.reddit.com/r/linux4noobs/s/RhJgCMkcf7

Good luck.

1

u/showbizusa25 21d ago

This is usually a Bluetooth pairing key issue with dual booting, not a hostname problem. Windows and Linux can store different keys for the same device. You can sync the pairing keys between them so you don't have to keep removing and pairing your devices. Are you using BlueZ on CachyOS?

1

u/es20490446e Develops Zenned OS 21d ago

Zenned has bluetooth-autoconnect installed by default.

I don't know of any other distro that has such thing.

1

u/qwnjhutydjj 15d ago

I I have the opposite problem. All I gotta do is turn my back and something hooked up on that damn Bluetooth messing with my Internet signal I go in to disable the Bluetooth on my phone and still gets turned back on. I don’t know why I don’t know how why is doing that but man it turns that shit back on. i’ve also been having trouble with been using a cell phone for a hotspot out in the garage and it’s a and now we’re having issues with that and we’ve been trying to disable the IPV six and it turns that shit right back on I don’t know how I don’t know how to turn it back on.yu

-1

u/Dry_Calendar_8627 21d ago

That shouldn't be the case
Unless you give both OS the same hostname (and even then), the Bluetooth peripherals should see both OS as separate computers

1

u/jlp_utah 21d ago

Bluetooth (the protocol) doesn't care what the hostname is. It goes off of the MAC address of the Bluetooth adapter. The problem is that when you pair your headphones with e.g. Windows, both the headphones and Windows remember a key that only works with the other one.

It is possible, though, to extract the key on Windows and set it to that on the Linux side, so the headphones are paired with both. I did this a long time ago, and don't recall the exact sequence of steps, but it is definitely possible. Some other commenters have mentioned procedures that should work and even some tools that may simplify it.

Main thing is to pair with Linux first, then go to Windows and pair again. Then grab the key from the Windows side, go back to Linux, and put the key in the right place (overwriting the previous key). Now both OSes will work.