Bluetooth troubles

Hardware wise I’m using an intel 13700k. Running tmpfs root & home with zfs mounted to /keep

I’ve read all of the troubleshooting information I can find & seem to be having no luck.
Every now & then on reboot I will not see No Default Controller when running any commands with bluetoothctl but this is a rarity.

Here is what I have so far. I have little understanding of bluetooth settings as I’ve always had a dongle of some sort & have just been throwing snippets at the problem to no avail in all honesty. Any advice would be great if anyone has bumped into a similar issue.

    #environment.systemPackages = with pkgs; [bluez5-experimental bluez-tools];
    services.blueman.enable = true;
    environment.systemPackages = with pkgs; [bluez bluez-tools];
    hardware.bluetooth = {
      enable = true;
      powerOnBoot = true;
      #package = pkgs.bluez5-experimental;
      package = pkgs.bluez;
      settings.Policy.AutoEnable = "true";
      settings.General = {
          Enable = "Source,Sink,Media,Socket";
          Name = "Hello";
          ControllerMode = "dual";
          FastConnectable = "true";
          Experimental = "true";
          KernelExperimental = "true";
      };
    };
    systemd.services."bluetooth".serviceConfig = {
      StateDirectory="";
      ReadWritePaths="/keep/var/lib/bluetooth/";
      ConfigurationDirectoryMode = "0755";
    };
    fileSystems."/var/lib/bluetooth" = {
      device = "/keep/var/lib/bluetooth";
      options = [ "bind" "noauto" "x-systemd.automount" ];
      noCheck = true;
    };
    systemd.tmpfiles.rules = [
      "d /var/lib/bluetooth 700 root root - -"
  ];

What does dmesg say if you rmmod/modprobe (reload) bluetooth module?

I have since restarted the bluetooth service but on boot I see that the service is dead / inactive.

~> dmesg | grep -i bluetooth                                                         01/28/24 16:16:49 PM
[13158.249490] Bluetooth: Core ver 2.22
[13158.249506] NET: Registered PF_BLUETOOTH protocol family
[13158.249507] Bluetooth: HCI device and connection manager initialized
[13158.249510] Bluetooth: HCI socket layer initialized
[13158.249511] Bluetooth: L2CAP socket layer initialized
[13158.249512] Bluetooth: SCO socket layer initialized
[13170.554520] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[13170.554526] Bluetooth: BNEP socket layer initialized

I am seeing these errors when checking the status though.

Jan 28 15:34:19 itx systemd[1]: Started Bluetooth service.
Jan 28 15:34:19 itx bluetoothd[20565]: Starting SDP server
Jan 28 15:34:19 itx bluetoothd[20565]: src/plugin.c:plugin_init() System does not support csip plugin
Jan 28 15:34:19 itx bluetoothd[20565]: profiles/audio/micp.c:micp_init() D-Bus experimental not enabled
Jan 28 15:34:19 itx bluetoothd[20565]: src/plugin.c:plugin_init() System does not support micp plugin
Jan 28 15:34:19 itx bluetoothd[20565]: src/plugin.c:plugin_init() System does not support vcp plugin
Jan 28 15:34:19 itx bluetoothd[20565]: src/plugin.c:plugin_init() System does not support mcp plugin
Jan 28 15:34:19 itx bluetoothd[20565]: src/plugin.c:plugin_init() System does not support bass plugin
Jan 28 15:34:19 itx bluetoothd[20565]: src/plugin.c:plugin_init() System does not support bap plugin
Jan 28 15:34:19 itx bluetoothd[20565]: Bluetooth management interface 1.22 initialized

Every now & then on reboot I will not see No Default Controller when running any commands with bluetoothctl but this is a rarity.

So basically your problem is that your bluetooth controller doesn’t come up at boot?

In that case, what does bluetoothctl show give you?

Also which hardware is your bluetooth controller? Are you using a dongle still or something built in your wifi card? Or whatever else?

Yes I don’t think it’s being recognized at boot. I have an Intel Wi-Fi 6E AX200 & I’m wired in at the moment as bluetoothctl is not finding anything.

/keep/etc/nixos> bluetoothctl                                                        01/28/24 16:34:34 PM
Agent registered
[bluetooth]# show
No default controller available

after running journalctl -xe | grep bluetooth I am seeing

Jan 28 16:27:49 itx bluetoothd[65295]: src/main.c:check_options() Unknown key Enable for group General in /etc/bluetooth/main.conf

this remains the case after removing the Enable = "Source … from the config.

So it’s an Intel one, these are typically quite decent. Do you have wifi available when you don’t have bluetooth? Is the iwlwifi module loaded?

Judging from looking at Arch Linux forums, you might not be the only one having experienced something like this.

Yep wifi’s working fine.

~> lsmod | grep iwlwifi                                                                                                                                     1 01/28/24 17:22:37 PM
iwlwifi               540672  1 iwlmvm
cfg80211             1335296  3 iwlmvm,iwlwifi,mac80211
firmware_class         53248  9 snd_hda_intel,xhci_pci_renesas,snd_sof,drm_display_helper,nvidia,iwlwifi,i915,cfg80211,drm

I’ll try updating bios & firmware & see if that helps out any.
I’ll maybe try switching to the zen kernel if that doesn’t help things
& then come back with more info at that stage either way I guess.

Updating the bios doesn’t seem to have helped though I have spotted this.

/keep/etc/nixos> systemctl status dbus
                                                                               -1 01/28/24 18:41:53 PM
● dbus.service - D-Bus System Message Bus
     Loaded: loaded (/etc/systemd/system/dbus.service; linked; preset: enabled)
    Drop-In: /nix/store/gzdahjd75z2wbmqd2g7lpard63g3i61a-system-units/dbus.service.d
             └─overrides.conf
     Active: active (running) since Sun 2024-01-28 18:15:23 UTC; 26min ago
TriggeredBy: ● dbus.socket
       Docs: man:dbus-daemon(1)
    Process: 46020 ExecReload=/nix/store/497j5kqfxb6kacpqsbpwgha004p9x6pj-dbus-1.14.10/bin/dbus-send --print-reply --system --type=method_call --dest=org.freedesktop.DBus / org.freedesktop.DBus.ReloadConfig (code=exited, status=0/SUCCESS)
   Main PID: 1938 (dbus-daemon)
         IP: 0B in, 0B out
         IO: 3.1M read, 0B written
      Tasks: 1 (limit: 38176)
     Memory: 4.1M
        CPU: 382ms
     CGroup: /system.slice/dbus.service
             └─1938 /nix/store/497j5kqfxb6kacpqsbpwgha004p9x6pj-dbus-1.14.10/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only

Jan 28 18:34:36 itx dbus-daemon[1938]: [system] Activating via systemd: service name='org.freedesktop.hostname1' unit='dbus-org.freedesktop.hostname1.service' requested by ':1.107' (uid=0 pid=48741 comm="/nix/store/5wvydxhgg4k1bsr79g1skp1k4vz4hckd-bluez-" label="kernel")
Jan 28 18:34:36 itx dbus-daemon[1938]: [system] Successfully activated service 'org.freedesktop.hostname1'
Jan 28 18:35:56 itx dbus-daemon[1938]: [system] Rejected send message, 0 matched rules; type="error", sender=":1.62" (uid=1000 pid=28552 comm="/nix/store/l34a98f2330nqxa2mc75fwb50snmpr8l-wirepl" label="kernel") interface="(unset)" member="(unset)" error name="org.bluez.Profile1.Error.NotImplemented" requested_reply="0" destination=":1.107" (uid=0 pid=48741 comm="/nix/store/5wvydxhgg4k1bsr79g1skp1k4vz4hckd-bluez-" label="kernel")
Jan 28 18:35:56 itx dbus-daemon[1938]: [system] Rejected send message, 0 matched rules; type="error", sender=":1.62" (uid=1000 pid=28552 comm="/nix/store/l34a98f2330nqxa2mc75fwb50snmpr8l-wirepl" label="kernel") interface="(unset)" member="(unset)" error name="org.bluez.Profile1.Error.NotImplemented" requested_reply="0" destination=":1.107" (uid=0 pid=48741 comm="/nix/store/5wvydxhgg4k1bsr79g1skp1k4vz4hckd-bluez-" label="kernel")
Jan 28 18:35:56 itx dbus-daemon[1938]: [system] Activating via systemd: service name='org.bluez' unit='dbus-org.bluez.service' requested by ':1.62' (uid=1000 pid=28552 comm="/nix/store/l34a98f2330nqxa2mc75fwb50snmpr8l-wirepl" label="kernel")
Jan 28 18:35:56 itx dbus-daemon[1938]: [system] Successfully activated service 'org.bluez'
Jan 28 18:35:56 itx dbus-daemon[1938]: [system] Activating via systemd: service name='org.freedesktop.hostname1' unit='dbus-org.freedesktop.hostname1.service' requested by ':1.117' (uid=0 pid=49005 comm="/nix/store/5wvydxhgg4k1bsr79g1skp1k4vz4hckd-bluez-" label="kernel")
Jan 28 18:35:56 itx dbus-daemon[1938]: [system] Successfully activated service 'org.freedesktop.hostname1'
Jan 28 18:39:26 itx dbus-daemon[1938]: [system] Activating via systemd: service name='org.freedesktop.timedate1' unit='dbus-org.freedesktop.timedate1.service' requested by ':1.125' (uid=1000 pid=49322 comm="/nix/store/cki0ds3if17x2nnnfjddpjg99g7wypj1-firefo" label="kernel")
Jan 28 18:39:26 itx dbus-daemon[1938]: [system] Successfully activated service 'org.freedesktop.timedate1'

I have to say: I hate bluetooth configuration :smile:

A question aside… why do you need all this configuration?

      settings.Policy.AutoEnable = "true";
      settings.General = {
          Enable = "Source,Sink,Media,Socket";
          Name = "Hello";
          ControllerMode = "dual";
          FastConnectable = "true";
          Experimental = "true";
          KernelExperimental = "true";
      };

I am also wondering if there might be some issue with your general setup. This one: “Running tmpfs root & home with zfs mounted to /keep”.

In order to exclude that: Did you try running another Linux distro and attempt using your bluetooth controller?

I threw together a bunch of hacks in desperation.

I’m pretty sure this was the ticket.
xdg.autostart.enable = true;

Current set-up for reference

{pkgs, ...}:{os=
{
   hardware.bluetooth = {
      enable = true;
      powerOnBoot = true;
      package = pkgs.bluez5-experimental;
      settings.Policy.AutoEnable = "true";
      settings.General.Enable = "Source,Sink,Media,Socket";
   };
   services.blueman.enable = true;
   environment.systemPackages = with pkgs; [
        bluez5-experimental 
        bluez-tools
        bluez-alsa
        bluetuith # can transfer files via OBEX
      ];
};}

persistence related >>


  fileSystems."/var/lib/bluetooth" = {
    device = "/keep/var/lib/bluetooth";
    options = [ "bind" "noauto" "x-systemd.automount" ];
    noCheck = true;
  };
environment.persistence."/keep" = {
    directories = [
      "/var/lib/bluetooth"

If you managed to get bluetooth working, can you post your whole configuration.nix? I’m running into a similar issue where wifi is working fine (always has – pretty painless), but no combination of fixes and tricks that I’ve found elsewhere seems to do the trick for bluetooth. I’m not sure whether it’s my configuration.nix, or maybe some other hardware/firmware issue that I don’t know how to diagnose.

As an aside, do you know whether a full reboot is required to get these changes working, or if nixos-rebuild switch is enough?

what issue are you seeing? Seems like the original issue was they weren’t even seeing their bluetooth controller. For the record I use bluetooth on NixOS and it works well. What does hciconfig --all produce?

rjpc ~ % hciconfig --all
hci0:   Type: Primary  Bus: USB
        BD Address: 10:7X:6F:28:1D:90  ACL MTU: 1021:6  SCO MTU: 255:12
        UP RUNNING PSCAN 
        RX bytes:512387 acl:25002 sco:0 events:3111 errors:0
        TX bytes:968035 acl:1746 sco:0 commands:339 errors:0
        Features: 0xff 0xff 0xff 0xfe 0xdb 0xfd 0x7b 0x87
        Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 
        Link policy: RSWITCH HOLD SNIFF PARK 
        Link mode: PERIPHERAL ACCEPT 
        Name: 'bluetooth controller'
        Class: 0x6c0104
        Service Classes: Rendering, Capturing, Audio, Telephony
        Device Class: Computer, Desktop workstation
        HCI Version: 5.1 (0xa)  Revision: 0xdfc6
        LMP Version: 5.1 (0xa)  Subversion: 0xd922
        Manufacturer: Realtek Semiconductor Corporation (93)

Yep, that’s the same issue I was having. bluetoothctl show responds “No default controller available”

When I run hciconfig --all it doesn’t print anything.

is it onboard the motherboard (check the BIOs for an option to enable the controller) is it a dongle? Perhaps you don’t have the right driver? What chipset does it use? what does dmesg say? what about the system journal?

I had a similar error when trying to “free” my laptop from proprietary blobs.

See if using hardware.enableAllFirmware = true; with a reboot makes a difference.

Using hardware.enableAllFirmware = true; plus a reboot did the trick!

I’m going to try to answer the questions rjpcasked just in case it helps someone else in the future maybe.
Not a dongle, builtin. The firmware I have that worked is intel/ibt-17-16-1.sfi which I just pulled from the dmesg output. Not sure how to get the rest tbh.

Thanks y’all!

2 Likes

Great! Glad to hear it was simple. I’ve had hardware.enableRedistributableFirmware = true; set for years too but I’m sure that’s covered by AllFirmware :person_shrugging:

1 Like