Skip to main content

Sync Bluetooth for dualboot Linux and Windows

English | 简体中文

User-friendly tool that makes Bluetooth devices work on both Windows and Linux without re-pairing. See Dualboot Bluetooth issue.

Fork of x2es/bt-dualboot — maintained on the dev branch with Clean Architecture refactoring (v2.0.0+). PyPI package: bt-dualboot-ng · CLI command: bt-dualboot

Highlights

Install · CLI reference · Developer guide


Usage: shortest way

Assuming devices are already paired in Windows, boot into Linux and pair them there too. Syncing is two steps:

1. Mount Windows partition

The tool probes and uses a mounted Windows partition automatically. Otherwise use -w / --win. The partition must be mounted with write access.

2. Sync all devices available for sync

$ bt-dualboot -a -b

Elevating privileges via sudo...
Syncing...
==========
 [C2:9E:1D:E2:3D:A5] Keyboard K380
...done

Notes:

  • Auto sudo — elevates via sudo when root is needed. Use --no-elevate to disable.
  • --backup / --no-backup — sync requires one of these explicitly (-b or -n).
  • Use -d / --dry-run to preview any command’s effects.
  • Short options: -a (sync-all), -s (sync), -d (dry-run), -w (win mount), -l (list), -b (backup), -n (no-backup).

Usage: choose device manually

1. List devices

$ bt-dualboot -l

Works both in Linux and Windows
===============================
 [A4:BF:C6:D0:E5:FF] WH-1000XM4

Needs sync
==========

Following devices available for sync with `--sync-all` or `--sync MAC` options.

 [C2:9E:1D:E2:3D:A5] Keyboard K380

Have to be paired in Windows
============================

Following devices unavailable for sync unless you boot Windows and pair them

 [E9:1D:FE:2A:C3:C8] JBL GO

Missing pairing key
===================

Following devices do not have a pairing key and cannot be synced

 [AA:BB:CC:DD:EE:FF] Some Device

(Sections with no devices are omitted, except “Needs sync”, which shows a hint when empty.)

2. Sync devices by MAC

$ bt-dualboot -s C2:9E:1D:E2:3D:A5 -b

synced C2:9E:1D:E2:3D:A5 successfully

See bt-dualboot -h and the sections below for details.


Prerequisites

  • Python 3.13+
  • chntpw package (provides reged):
Ubuntu $ sudo apt install chntpw

See https://pogostick.net/~pnh/ntpasswd/


Install

$ uv tool install bt-dualboot-ng

or with pipx:

$ pipx install bt-dualboot-ng

The tool elevates to root via sudo when needed. Use --no-elevate to disable auto-elevation.

Supported OS

Tested with Linux Mint 19.3, 20.3 (Ubuntu 18.04 bionic, 20.04 focal), Windows 10.

Supported:

  • Potentially any Linux-based system that keeps Bluetooth configuration in a format similar to Ubuntu
  • Windows 10+

More OSes will be tested in later releases; macOS support may be added. If you succeed or fail on an OS not listed here, please share at https://github.com/awsl1414/bt-dualboot/issues.


Advanced usage

Backup options

Windows Registry updates use chntpw/reged without changing the hive file size (reged -N -E). chntpw is unofficial, so a backup is still recommended. You must choose a backup strategy explicitly (-b / --backup or -n / --no-backup).

$ bt-dualboot -a
usage: ....
bt-dualboot: error: Neither backup option given!

    Windows Registry Hive file will be updated!
    chntpw/reged tool is non-official and hackish Hive file editing tool.
    It is recommended to do backup prior writing into Hive file.

    Use:
      -b [path], --backup [path]    [default: /var/backup/bt-dualboot]
      -n, --no-backup               process without backup

    WARNING:
        Windows Registry Hive file may contain sensitive data. You shouldn't keep this file
        on a storage which may be accessed by others. Consider to remove backup files as soon
        as possible after ensure Windows boots and works correctly.

Restoring from backup

If Windows fails to boot after a sync, restore the backup:

1. Boot into Linux and find your backup file

$ ls /var/backup/bt-dualboot/
SYSTEM-2026-06-07--14-30-00

2. Mount your Windows partition

$ sudo mount /dev/sdXn /mnt/windows

Use lsblk -f to find the correct partition if unsure.

3. Replace the Windows registry hive

$ sudo cp /mnt/windows/Windows/System32/config/SYSTEM /mnt/windows/Windows/System32/config/SYSTEM.broken
$ sudo cp /var/backup/bt-dualboot/SYSTEM-2026-06-07--14-30-00 /mnt/windows/Windows/System32/config/SYSTEM

4. Reboot into Windows

If Windows still does not boot, use Windows Automatic Repair / System Restore.

Windows mount point

By default the tool finds and uses mounted Windows partitions. If several are found, you are prompted to select one or more (single, comma-separated, ranges, or all). Use -w / --win to set a mount point directly.

Use --list-win-mounts to list recognized Windows partitions.

$ bt-dualboot --list-win-mounts

Windows locations:
==================
 /media/user/win_foo
 /media/user/win_bar

$ bt-dualboot -w /media/user/win_foo -l

When multiple Windows partitions are mounted:

$ bt-dualboot -a -b

Multiple Windows locations found:
  [1] /media/user/win_foo
  [2] /media/user/win_bar

Select (e.g. 1 or 1,3 or all): 1

In non-interactive or --bot mode, multiple mounts require -w MOUNT (the tool prints the list and exits).

Troubleshooting: Windows partition write access

If the Windows partition is mounted read-only, remount it read-write:

$ sudo mount -o remount,rw /mnt/win/path

Machine processing

--bot enables more parsable output for scripts (currently supported for -l).


Dualboot Bluetooth issue

Every time a Bluetooth device is paired in one dual-boot OS, it stops working in the other. Both OSes use the same adapter MAC; each pairing generates new keys, so the key stored in the other OS becomes obsolete.

The solution is to sync saved pairing keys. Manual approaches: https://unix.stackexchange.com/a/255510/411221

This tool follows the approach from this comment: copy pairing keys from Linux into the Windows registry, avoiding multiple reboots.


Advantages and alternatives

bt-dualboot:

  • Does not require multiple reboots
  • Simple install
  • Single CLI; no extra scripts
  • Discovers mounted Windows partitions automatically
  • Safe registry update without changing hive file size (rewrite only)
  • Backup before update
  • No import/export files or encoding hassles
  • --dry-run before real changes

Alternatives

Automatic bidirectional sync (service / EFI share):

Linux → Windows registry (same direction as bt-dualboot):

Windows → Linux:

macOS:


CLI reference

$ bt-dualboot -h
usage: bt-dualboot [-h] [--version] [-l] [--list-win-mounts] [--bot] [-d] [-w MOUNT] [-s MAC [MAC ...]] [-a] [-n] [-b [path]]
                   [--no-elevate]

Sync bluetooth keys from Linux to Windows (v2.1.1)

options:
  -h, --help            show this help message and exit
  --version             print version
  --no-elevate          do not auto-elevate to root via sudo

List resources:
  -l, --list            [root required] list bluetooth devices
  --list-win-mounts     list mounted Windows locations
  --bot                 parsable output for robots (supported: -l)

Sync keys:
  -d, --dry-run         print actions to do without invocation
  -w, --win MOUNT       Windows mount point (advanced usage)
  -s, --sync MAC [MAC ...]
                        [root required] sync specified device
  -a, --sync-all        [root required] sync all paired devices

Backup Windows Registry:
  -n, --no-backup       process without backup
  -b, --backup [path]   path to backup directory, default: /var/backup/bt-dualboot

Metadata

Release files for bt-dualboot-ng 2.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bt-dualboot-ng 2.1.2
File Size Uploaded Provenance Actions
bt_dualboot_ng-2.1.2.tar.gz 2.0 MB Without provenance Details for bt_dualboot_ng-2.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bt-dualboot-ng 2.1.2
File Interpreter ABI Platform Actions
bt_dualboot_ng-2.1.2-py3-none-any.whl Python 3 none any Details for bt_dualboot_ng-2.1.2-py3-none-any.whl

Total release size: 2.1 MB

Release files / bt_dualboot_ng-2.1.2.tar.gz

Download URL bt_dualboot_ng-2.1.2.tar.gz
Size 2.0 MB
Tags Source
SHA-256 checksum
How to use checksums
bd866e5b2263e919f6c23e5f7b4de36720356f607638d5d2d1d754f5ab72e31d
BLAKE2b-256 checksum
How to use checksums
832af05096b724a9207068b8db0a740f94b7cca6b4745bbf5ead81102deeb4ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / bt_dualboot_ng-2.1.2-py3-none-any.whl

Download URL bt_dualboot_ng-2.1.2-py3-none-any.whl
Size 28.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dd0fa7d8dd7bc4cf53f3c1181d43fd4b3ffa9b8dbb80bea00ab719659ccc0db5
BLAKE2b-256 checksum
How to use checksums
856ec887762c1ab8bf303a3ffbd64c9e1724591d3cac7f725f9afbaa70ce5096
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for bt-dualboot-ng 2.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page