OPINIONATED OMARCHY
TROUBLESHOOTING CORPUS
790
RECORDS
790
AUDITED
0
UNCHECKED
2388
SOURCES
LIVE
network low common DISPUTE

Stop re-pairing Bluetooth devices every time you switch between Linux and Windows

omarchyarchendeavouroscachyosmanjarolaptopdesktop
CORRECTED An auditor found the fix wrong or incomplete and rewrote it.
AUDIT NOTE

Checked both cited pages and both resolve and support the record. I fetched the Arch Bluetooth page as raw wikitext and read the whole "Dual boot pairing", "Preparing Bluetooth 5.1 Keys" and "Saving the configuration" sections, plus the "Default transport 3.0 vs 5.x" section, and the Dual boot with Windows page, whose "Bluetooth pairing" section states the shared adapter MAC and divergent link keys exactly as the cause does. Confirmed on this machine at bluez 5.87-2: /usr/share/doc/bluez/dbus-apis/settings-storage.txt documents the /var/lib/bluetooth/<adapter>/<device>/info layout and the [LinkKey], [LongTermKey] and [PeripheralLongTermKey] groups, and BlueZ 5.87's own src/adapter.c (fetched from kernel.org at tag 5.87) reads [LinkKey] Key, [IdentityResolvingKey] Key, then [PeripheralLongTermKey] with [SlaveLongTermKey] as the fallback, so all three stanzas the record names are still live and writing the LTK into both long term key groups is right. chntpw is extra/chntpw 140201-5 (Arch package JSON) and is not installed here, so I extracted the package into /tmp and read its MANUAL.txt: -e, hex <valuepath> and the b : REG_QWORD type the BLE output shows are all real, and reged -x exists too. Confirmed here that chntpw -e tries read-write and prints openHive(...) failed: Permission denied, trying read-only, which is why the corrected fix copies the hive out and mounts -o ro instead of the record's bare read-write mount, a command that contradicted the record's own danger field. Confirmed here that pacman -S --needed chntpw is not blocked: /usr/bin/omarchy-update-pacman-guard aborts only when a sync and a sysupgrade flag both appear. Four real defects, so corrected: the fix mounted NTFS read-write, it never mentions that a BitLocker volume cannot be read this way at all (the wiki says so and current Windows enables device encryption on many installs), it says nothing about handling extracted link keys as secrets, and it ignores two Omarchy 4 behaviours I read in /usr/share/omarchy/bin/omarchy-bluetooth-power, install/hardware/bluetooth.sh, migrations/1786380259.sh and shell/plugins/panels/bluetooth/Panel.qml, namely that Bluetooth power lives in a persisted rfkill soft block so a restarted bluetooth.service can come back with no controller, and that the panel's forget key and omarchy-bluetooth-device forget both delete the device directory and the imported key with it. Where it touches the sibling record bluetooth-panel-turned-off-while-adapter-powered: that one is the Quickshell panel caching Powered: false while BlueZ says true, this one only tells the reader to check the rfkill block after the service restart, and the two do not overlap further. Also confirmed that Omarchy writes /etc/bluetooth/main.conf only in that one time AutoEnable migration, so the ControllerMode = bredr advice is safe, that [General] is line 1 of the shipped file with #ControllerMode = dual at line 52, that GLib merges duplicate [General] groups (tested with the system GLib), that ntfs3 ships with kernel 7.1.9 while ntfs-3g is absent so a bare mount is correct, and that bt-dualboot, bt-dualboot-ng and bluetooth-dualboot all still exist, the first two in the AUR. v4.0.2...v4.0.3 touches no Bluetooth file and v4.0.3 is the newest tag. NOT exercised: there is no dual-boot Windows install here and no test device, so I never extracted a real key, never mounted an NTFS partition, never edited /var/lib/bluetooth, never stopped bluetooth.service and never paired or unpaired anything. Severity low and frequency common are left alone: the consequence is one unusable peripheral with an obvious workaround, and the hazards live in the fix rather than in the problem.

The cause above was not rewritten and may still contain the error described. The fix below is the corrected version.
RISK

Editing files under /var/lib/bluetooth while bluetooth.service is running gets the change silently overwritten when the daemon flushes state, so stop the service first and keep a copy (sudo cp -a /var/lib/bluetooth /var/lib/bluetooth.bak). Mounting the Windows partition read-write while Fast Startup or hibernation is active can corrupt the NTFS filesystem: run powercfg /h off in Windows, do a full shutdown, and mount read only (sudo mount -o ro ...), because reading the hive needs nothing more. A wrong, truncated or lower case key leaves the device unusable from Linux, and editing the Windows side instead can leave it unusable from both operating systems, with bluetoothctl remove <MAC> and a fresh pairing in each OS as the only way back. The extracted keys are long term secrets that let anything holding them impersonate your adapter to that device, so never paste them into an issue, a paste site or a chat, and delete the hive copy and any .reg export when you are done. bluetoothctl remove, the Omarchy shell panel's forget key and omarchy-bluetooth-device forget all delete the device directory, so one keystroke throws an imported key away.

Symptom

A Bluetooth mouse, keyboard, headset or controller works fine until you boot the other OS. After pairing it in Windows it will no longer connect in Linux, and after re-pairing it in Linux it stops working in Windows. bluetoothctl connect <MAC> reports Failed to connect: org.bluez.Error.Failed or the device connects and immediately drops. Removing and re-pairing works, until the next reboot into the other OS.

Cause

Both installations share one Bluetooth adapter and therefore one adapter MAC address, but each generates its own link key during pairing. The device remembers only the most recent key for that MAC, so whichever OS paired last owns the device and the other is locked out. Nothing is broken. The two key stores have simply diverged.

Fix

Pair the device in **Linux first**, then reboot into Windows and pair it there. Then copy the Windows key back into BlueZ. Switch the device itself off before extracting anything so it cannot reconnect part way through.

**Extract the key from Linux (no Windows tooling needed).** Mount the Windows system drive **read only** and work on a copy of the registry hive, so nothing can write to NTFS:


sudo pacman -S --needed chntpw
lsblk -f                                      # find the NTFS partition holding Windows
sudo mkdir -p /mnt/win
sudo mount -o ro /dev/nvme0n1p3 /mnt/win      # in-kernel ntfs3, no -t needed
sudo cp /mnt/win/Windows/System32/config/SYSTEM ~/SYSTEM.hive
sudo chown "$USER" ~/SYSTEM.hive
chntpw -e ~/SYSTEM.hive

chntpw -e opens a hive read-write and only warns (openHive(...) failed: Permission denied, trying read-only) before falling back, so handing it a copy is what guarantees the Windows hive is never touched. If Windows is encrypted with BitLocker the hive cannot be read from Linux at all, and the Windows-side route below is the only way.

Inside chntpw:


> cd CurrentControlSet\Services\BTHPORT\Parameters\Keys
> ls                       # one subkey per adapter, named by its MAC
> cd <adapter-mac>
> ls                       # one entry per paired device
> hex <device-mac>         # non-BLE: 16 bytes, this is the link key

If you see ControlSet001 instead of CurrentControlSet, use that. If instead of a single 16-byte REG_BINARY you see a subkey containing LTK, KeyLength, ERand, EDIV, IRK, AuthReq, the device is Bluetooth 5.1 / BLE and needs the extra transformations documented on the Arch Bluetooth page under "Preparing Bluetooth 5.1 Keys". Read those values with hex <value_name>.

**Extract from Windows instead**, if you prefer or if BitLocker is in the way: the Keys hive is only readable by SYSTEM, so run regedit under that account with Sysinternals PsExec (.\PsExec64.exe -s -i regedit.exe), navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\BTHPORT\Parameters\Keys, and export the adapter's key as a .reg file.

**Write the key into BlueZ.** Stop the daemon first so it does not overwrite your edit, and back the state directory up:


sudo systemctl stop bluetooth.service
sudo cp -a /var/lib/bluetooth /var/lib/bluetooth.bak
sudo nano /var/lib/bluetooth/<ADAPTER-MAC>/<DEVICE-MAC>/info

For a classic (non-BLE) device, replace the key under [LinkKey] and leave the Type and PINLength lines alone:


[LinkKey]
Key=0123456789ABCDEF0123456789ABCDEF

Uppercase hex, no spaces, no separators. For a BLE device, substitute the corresponding values under [IdentityResolvingKey], [PeripheralLongTermKey] and [SlaveLongTermKey]. Write the long term key into both of those groups: BlueZ 5.87 reads [PeripheralLongTermKey] first and falls back to [SlaveLongTermKey], and it writes both itself.


sudo systemctl start bluetooth.service
bluetoothctl connect <DEVICE-MAC>

**On Omarchy 4 the adapter can come back unpowered, which looks like a key failure and is not.** Omarchy keeps the Bluetooth on and off state in the rfkill soft block rather than in BlueZ, and systemd-rfkill restores that block on the next boot, so if Bluetooth was ever switched off from the shell panel BlueZ refuses to power the adapter and bluetoothctl reports no default controller:


omarchy-bluetooth-power is-on || omarchy-bluetooth-power on

Do not reach for bluetoothctl remove, the shell panel's x key or omarchy-bluetooth-device forget <MAC> afterwards. All three delete /var/lib/bluetooth/<ADAPTER-MAC>/<DEVICE-MAC>/, taking the key you just imported with it.

**Clean up the key material.** A link key is a long term secret for that device:


rm -f ~/SYSTEM.hive ~/bt-keys.reg
sudo umount /mnt/win

On the btrfs root Omarchy installs, shred cannot promise the old blocks are gone, so treat any key that left the machine as burnt and re-pair the device instead.

Some devices, notably the Logitech MX Master line and Logitech Lightspeed receivers, increment the last octet of their own MAC on each new pairing. If so, rename the directory under /var/lib/bluetooth/<ADAPTER-MAC>/ to the incremented address that Windows recorded before restarting the daemon.

**If you want to avoid the BLE complications entirely**, force the adapter to classic transport. The shipped /etc/bluetooth/main.conf already carries the line commented out inside its [General] group, so edit it in place:


# /etc/bluetooth/main.conf
[General]
ControllerMode = bredr

Omarchy does not manage that file. Its only write is a one time migration that reverts the AutoEnable=false line Omarchy used to set, so a ControllerMode edit survives an omarchy update.

**To automate the whole thing**, bt-dualboot (AUR bt-dualboot) scripts the extraction and import and does not support BLE, a newer fork is packaged as AUR bt-dualboot-ng, and bluetooth-dualboot walks you through the commands without editing files itself.

**Between two Linux installs** this is much simpler: just make /var/lib/bluetooth/<ADAPTER-MAC>/ identical on both, by copying or symlinking.

Verify

Reboot into Windows, use the device, reboot back into Linux, and connect without re-pairing. Check the edit actually survived the daemon restart first, because an edit made while bluetooth.service was running is the usual failure:


sudo grep -A1 '^\[LinkKey\]' /var/lib/bluetooth/<ADAPTER-MAC>/<DEVICE-MAC>/info
bluetoothctl info <DEVICE-MAC>

bluetoothctl info <DEVICE-MAC> shows Paired: yes and Connected: yes in both directions across several reboots. On Omarchy, check omarchy-bluetooth-power is-on before blaming the key: with the rfkill soft block set, bluetoothctl reports no default controller instead.

Sources

bluetooth-pairing-lost-every-windows-dualboot