Bluetooth failed in NixOS/Win11 dual boot

I recently installed windows 11 as dual boot on a preexisting NixOS install and since connecting my bluetooth headphones to the windows 11 system (or since install, hadn’t tested before then) I’ve been unable to connect the bluetooth headphones to NixOS.
I’ve tried bt-dualboot and various guides relating to exporting pairing keys from windows in such a situation but none has changed the core erroneous behavior.
I’ll add more specific details about the error messages from bluetoothctl and dmesg and the other fixes I’ve already attempted but will leave this here for now in case someone is aware of a fix for this already.

edit: the bluetoothctl error is
Failed to connect: org.bluez.Error.Failed br-connection-profile-unavailable - dmesg doesn’t really provide any info unless I’m doing something with hciconfig or chntpw as I recall from hours of attempts earlier. Again, the system is NixOS/Win11 dualboot on Framework Laptop 16. The headphones are Bose QuietComfort Noise Cancelling.

In windows, the bluetooth headset cannot be removed via windows settings (remove greyed out) and the driver for my RZ616 bluetooth adapter is oem2.inf (mtkbtfilter.inf). I’ve tried disabling fast startup as per many recommendations and than had no effect.

Thanks

actually after further testing it’s with all audio in nixos:

mpv Floral_Fury.mp3 
● Audio  --aid=1  (mp3 2ch 48000 Hz 133 kbps)
[ao/alsa] Playback open error: Host is down
[ALSOFT] (EE) Failed to connect PipeWire event context (errno: 112)
[ao/openal] could not open device
[ao] Failed to initialize audio driver 'openal'
Could not open/initialize audio device -> no sound.
Audio: no audio
: 00:00:00 / 00:03:45 (0%)
Exiting... (Errors when loading file)

am currently installing rtkit as another change of configuration.nix to see what might work an will be available on this thread as nixos has arbitrarily decided to rebuild the kernel again.

I think a main problem is that pipewire.service isn’t being enabled despite services.pipewire.enable = true; and instead being masked which in nixos means not even root can unmask it so I just have to try random trash in configuration.nix until I can get functional audio back on my system.

I’m not sure what’s going on with bluetooth, but in terms of troubleshooting the rest of your audio setup:

  1. NixOS’s pipewire config doesn’t enable alsa or pulseaudio providers by default. Set services.pipewire = { alsa.enable = true; pulse.enable = true; };
  2. Pipewire should be running as a user service, not a system service. systemctl status pipewire should say “masked” but systemctl status --user pipewire should say “active (running)” (and systemctl status --user wireplumber should be running too)
  3. If pipewire is running, in theory the bluetooth connection should work. Maybe try to make a minimal audio config to make sure some other configuration didn’t break anything? I think just setting pipewire’s enable, alsa.enable, and pulse.enable to true should be enough, along with hardware.bluetooth.enable. Also check journalctl -b0 -u bluetooth.service along with journalctl -b0 --user -u wireplumber.service and journalctl -b0 --user -u pipewire.service

**

**
I currently have

  security.rtkit.enable = true;
   services.pipewire = {
     enable = true;
     alsa.enable = true;
     pulse.enable = true;
     wireplumber.enable = true;
   };

in my configuration.nix
I just completed two over 5 hours builds of chromium - this was a first for me after using nixpkgs-unstable and nixos-unstable-small for over a year.

**

**

[user@nixos:~]$ systemctl status pipewire
○ pipewire.service
     Loaded: masked (Reason: Unit pipewire.service is masked.)
     Active: inactive (dead)

[user@nixos:~]$ systemctl start pipewire --user
Failed to start pipewire.service: Unit pipewire.service not found.

[user@nixos:~]$ doas systemctl start pipewire 
Failed to start pipewire.service: Unit pipewire.service is masked.

[user@nixos:~]$ doas systemctl unmask pipewire 
Failed to unmask unit: File /etc/systemd/system/pipewire.service: Read-only file system

[user@nixos:~]$ systemctl start wireplumber
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ====
Authentication is required to start 'wireplumber.service'.
Authenticating as: user
Password: 
==== AUTHENTICATION COMPLETE ====
Failed to start wireplumber.service: Unit wireplumber.service is masked.

[user@nixos:~]$ systemctl start --user wireplumber
Failed to start wireplumber.service: Unit pipewire.service not found.

[user@nixos:~]$ doas systemctl unmask wireplumber
Failed to unmask unit: File /etc/systemd/system/wireplumber.service: Read-only file system

**

**

[user@nixos:~]$ journalctl -b0 -u bluetooth.service
Oct 30 13:35:34 nixos systemd[1]: Starting Bluetooth service...
Oct 30 13:35:34 nixos bluetoothd[938]: Bluetooth daemon 5.83
Oct 30 13:35:34 nixos bluetoothd[938]: Starting SDP server
Oct 30 13:35:34 nixos systemd[1]: Started Bluetooth service.
Oct 30 13:35:34 nixos bluetoothd[938]: Bluetooth management interface 1.23 initialized
Oct 30 13:35:34 nixos bluetoothd[938]: Battery Provider Manager created

[user@nixos:~]$ journalctl -b0 -u wireplumber.service
-- No entries --

[user@nixos:~]$ journalctl -b0 --user -u pipewire.service
Oct 30 13:44:28 nixos systemd[1458]: pipewire.service: Failed to open /home/user/.config/systemd/user/pipewire.service: No such file or directory

currently running nixos-rebuild switch after setting nixos-unstable-small and nixpkgs-unstable to nixos-25.05-small and nixpkgs-25.05-darwin with nix-channel.
If this works I might stop using rolling edge unstable for a little while.
I can’t completely recall if I had bluetooth in between booting back into nixos after windows 11 dual boot install for a bit before running nixos-rebuild switch or not so it might work.

Does /etc/systemd/user/pipewire.service not exist? On my system it’s a symlink pointing to /nix/store/nsb1ji6fa6vdpx8bpawc4f9876zi72zr-pipewire-1.4.7/lib/systemd/user/pipewire.service

I’m not sure what’s going on with your channels (why are you using a darwin channel on a nixos system?) but I suspect that has something to do with your issues.

On my system, /etc/systemd/user is a symlink pointing to /etc/static/systemd/user which is a symlink pointing to /nix/store/<hash>-user-units which contains pipewire.service

edit: also I just use ‘darwin’ channels as you call them from channels.nixos.org as downgrade options for full system rollbacks like I used to to when an update of >100 packages happened to break the system in archlinux.

lrwxrwxrwx 9 root root   98 Dec 31  1969 /etc/systemd/user/pipewire-pulse.service -> /nix/store/8afxxifpdjdxqldvzh2rg6frf8w2nb3r-pipewire-1.4.9/lib/systemd/user/pipewire-pulse.service
lrwxrwxrwx 9 root root   97 Dec 31  1969 /etc/systemd/user/pipewire-pulse.socket -> /nix/store/8afxxifpdjdxqldvzh2rg6frf8w2nb3r-pipewire-1.4.9/lib/systemd/user/pipewire-pulse.socket
lrwxrwxrwx 9 root root   92 Dec 31  1969 /etc/systemd/user/pipewire.service -> /nix/store/8afxxifpdjdxqldvzh2rg6frf8w2nb3r-pipewire-1.4.9/lib/systemd/user/pipewire.service
lrwxrwxrwx 9 root root   91 Dec 31  1969 /etc/systemd/user/pipewire.socket -> /nix/store/8afxxifpdjdxqldvzh2rg6frf8w2nb3r-pipewire-1.4.9/lib/systemd/user/pipewire.socket

/etc/systemd/user/pipewire-pulse.service.d:
total 4
lrwxrwxrwx 3 root root 94 Dec 31  1969 overrides.conf -> /nix/store/jss7l2pi63cv7rv80bncjn5l7hfpqspb-unit-pipewire-pulse.service/pipewire-pulse.service

/etc/systemd/user/pipewire-pulse.socket.d:
total 4
lrwxrwxrwx 3 root root 92 Dec 31  1969 overrides.conf -> /nix/store/hxpd5kmg3snqzpsg5zzyd80ipc72q0mq-unit-pipewire-pulse.socket/pipewire-pulse.socket

/etc/systemd/user/pipewire.service.d:
total 4
lrwxrwxrwx 3 root root 82 Dec 31  1969 overrides.conf -> /nix/store/1l9cczbc2gg0hivdfrsydi40y0zzklb1-unit-pipewire.service/pipewire.service

/etc/systemd/user/pipewire.service.wants:
total 0
lrwxrwxrwx 5 root root 22 Dec 31  1969 wireplumber.service -> ../wireplumber.service

/etc/systemd/user/pipewire.socket.d:
total 4
lrwxrwxrwx 3 root root 80 Dec 31  1969 overrides.conf -> /nix/store/02za57bipp60cg00r06w8q3nssszdpa0-unit-pipewire.socket/pipewire.socket```

Does /home/user/.config/systemd/user/pipewire.service exist as a broken symlink? I think that’s what’s causing systemctl to be unable to find the pipewire user service. I’d have a look around in that directory and see if there are other broken symlinks while you’re at it btw. Not sure what created them, maybe something broke with home-manager or an attempt to uninstall it?

yet - there are symlinks in ~/.config/systemd/user all the following of which which appear as red text in ls:
pipewire-pulse.service, pipwire-pulse.socket, pipewire.service, pipewire.socket

Where did they point to, out of curiosity? I’m not sure what put them there, but my guess would be home-manager or something similar. I’d delete all of those (or move them to a backup folder to be safe if you want) and then systemctl --user daemon-reload maybe (or just reboot).

I’ve never installed or used home-manager and am currently letting nixos-rebuild finish again.
I just ran systemctl --user daemon-reload and doas systemctl daemon-reload after the former didn’t work, and the broken symlinks in ~/.config/systemd/user/ persist:

mpv Floral_Fury.mp3 
● Audio  --aid=1  (mp3 2ch 48000 Hz 133 kbps)
[ao/alsa] Playback open error: Host is down
[ALSOFT] (EE) Failed to connect PipeWire event context (errno: 112)
[ao/openal] could not open device
[ao] Failed to initialize audio driver 'openal'
Could not open/initialize audio device -> no sound.
Audio: no audio
: 00:00:00 / 00:03:45 (0%)
Exiting... (Errors when loading file)

Where do the symlinks point? To be clear, I think you’re going to have to clean them up manually, e.g. mkdir systemd-user-backup && mv ~/.config/systemd/user/pipewire* systemd-user-backup

If they’re getting recreated automatically by something, looking at where they point will be the first step in determining what’s creating them.

I just ran those commands and still am running nixos-rebuild which I would have thought to regenerate the files so I tried running systemctl --user daemon-reload which didn’t recreate the files so if there are no further suggestions I might just wait until the nixos-rebuild switch --upgrade downgrade is complete.

Yeah, I think your system should be in a working state now, you could try systemctl --user start wireplumber or just reboot.

1 Like

Yes - my system is working now.

it wasn’t after even after deleting the symbolic links in ~/.config/systemd/user/ mentioned above but after systemctl --user restart wireplumber, the following ran perfectly (and no files that I’d deleted were recreated ~/.config/systemd/user):

● Audio  --aid=1  (mp3 2ch 48000 Hz 133 kbps)
AO: [pipewire] 48000Hz stereo 2ch floatp
A: 00:00:04 / 00:03:45 (2%)

and this appears to have been with the nixpkgs-unstable and nixos-unstable-small packages that were already installed as the nixpkgs-25.05-darwin/nixos-25.05-small had been failing to build with some overlays I was using in a length overlays.nix file referenced in configuration.nix.
I just completed a nixos-rebuild switch back with nixpkgs-unstable and nixos-unstable-small that lasted <10 seconds after typing this and will likely reboot soon

**

Bluetooth is working now as well; so this is resolved, although I’d like to keep this thread open a bit longer to hear any input @PlasmaPower might have about what exactly wireplumber did here and how the steps taken in this thread actually allowed my system to regain audio and bluetooth function

1 Like

Basically, something (not sure what) created broken symlinks in ~/.config/systemd/user. I’m pretty confident it wasn’t wireplumber or pipewire or systemd. My guess would be, maybe you copied this from another installation, or maybe some other system management software created it. The broken symlinks prevented systemd from starting pipewire, because files in ~/.config/systemd/user take precedence over /etc/systemd/user. Once you removed the broken symlinks and restarted wireplumber, systemd was able to startup pipewire, which was the missing piece for your audio setup to work.

1 Like