Help workaround wifi that broke on update last week

I started using Nix on my MacBook Pro 13" with retina display from 2012 a few months ago and it has been an overall very nice experience!

I am on nixos-unstable channel.

Up until the snapshot of my update of nix at July 30, wifi worked fine. When I updated it again August 3, wifi was unavailable. I run KDE and I could not see any trace of the wifi adapter in the system tray, just the generic networking icon with a red error label. Luckily I could easily go back to the previous generation. But of course I would like to go back to a working state for my wifi while still upgrading the rest of the system.

My wifi is configured in configuration.nix in this way:

  boot.extraModulePackages = [ config.boot.kernelPackages.broadcom_sta ];
  boot.kernelModules = [ "wl" ];
  # and then a bit later
  networking.networkmanager.enable = true;

From googling, my problem sounds the same as that described at https://discussion.fedoraproject.org/t/broken-wifi-drivers-after-update-through-the-software-center-broadom-wifi-drivers-on-macbook/128065. It mentions that a broadcom wifi driver stopped working after the recent update to wpa_supplicant (https://w1.fi/cgit/hostap/plain/wpa_supplicant/ChangeLog.

Is there any way that I could stay at version 2.10 of wpa_supplicant and still upgrade the rest of my nix packages? Or is there any other workaround to my problem?

I think I can get my old thunderbolt-ethernet dongle working but it was a bit unstable last time I used it and not so fun having a laptop tethered to an ethernet cable.

EDIT:
These are the two generations listed in /nix/var/nix/profiles:

# wifi working:
30 jul 17.50 system-47-link -> /nix/store/wngm8xviyvz76chxa6gl381nihhzi2vi-nixos-system-nixos-24.11pre659698.52ec9ac3b123

# wifi not working:
3 aug 11.14 system-48-link -> /nix/store/b39j0jski430akdlx0hirmjvr0m5dh51-nixos-system-nixos-24.11pre660624.9f918d616c53


Yes, you could override the package to use the old version.

That said, nixpkgs stable hasn’t updated it, and probably won’t, so you could just switch to stable. A revert is in progress for unstable as well if you’re willing to wait a bit: wpa_supplicant: revert commit breaking authentication when brcmfmac is used by LeSuisse · Pull Request #333091 · NixOS/nixpkgs · GitHub

Lots of good info, thanks!

So it is possible to switch back to stable just like that? I suppose user settings for some app might get upset if app versions differ too much, though I guess that would be rare.

I thought I just searched nixpkgs github for this but apparently not – maybe I searched for “broadcom”… Thanks for pointing me to the right place! I will probably wait for that patch and if some horrible zero day shows up before, I will switch back to stable. :slight_smile:

Yeah, there can be incompatibilities. You might run into issues with applications like e.g. nextcloud, which don’t like being downgraded, and some module options may have changed.

IME things tend to be fine, but YMMV. Rolling back to unstable is pretty trivial if that doesn’t work, though.

1 Like

It has been a week so I tried nixos-rebuild switch --upgrade again today, on unstable, but after the upgrade my wifi is still not working, same as before (no wifi card recognized).

Does anyone know if the fix is in yet? Or how to check if it’s in nixos-unstable yet? I can see the checkbox is green at https://nixpkgs-tracker.ocfox.me/?pr=333091 that nixos-unstable has a green checkbox which I suspect means that the fix should be available to me. But if it is, it seems the fix didn’t work for me. :confused:

Hmm, it should definitely start working right about now, the patch has definitely made it in. Are you sure your config is reading from your channels? What does sudo nix-channel --list say?

Did you disable the drivers already built-in the kernel? boot.blacklistedKernelModules = [ "b43" "ssb" "brcmfmac" "brcmsmac" "bcma" ];

Up to a couple weeks ago even without blacklisting them WiFi was working fine for me but recently I had to blacklist them as I should have done from the start.

Sorry for late reply, I got sidetracked with other things.

Now I stressed out a bit and switched back to 24.05 and because I’m not so good with nixos, all other generations are now gone so I can’t check. (/boot/kernels fills up way too quickly with many generations and I deleted the existing generations to be able to fit in 24.05. I wish I could increase the boot partition from 200MB to 2GB but that’s a different problem.)

I think sudo nix-channel --list said
nixos https://nixos.org/channels/nixos-unstable before, but I’m not sure exactly. But it definitely was only one entry and it did say nixos-unstable in it.

My wifi works fine in 24.05, luckily.

No, I have not tried that. I will once I get the energy to get back at this again. Maybe stable is more comfortable for me.

How did you find out to disable those drivers?

I wouldn’t do that, it’s a specific feature of the brcmfmac module that wpa_supplicant doesn’t handle correctly. See Can't connect to WiFi networks · Issue #225 · tpwrules/nixos-apple-silicon · GitHub and the related mastodon thread.

… but either way, the underlying issue was fixed in a wpa_supplicant patch by now, no module blacklisting or kernel parameters should be required to get wifi to work on up-to-date unstable. If it is, we should figure out why.

Yep, that’s expected as it doesn’t have the version of wpa_supplicant that broke. It’s possible you’ll have to revisit this by the time 24.11 comes around, but by then presumably wpa_supplicant will have a full fix released.

Are you aware of boot.loader.*.configurationLimit? That’ll get rid of old generations for you.

You still would have lost the original generation, of course, but this way you at least don’t need to go around manually deleting generations.

Switching generations would not restore your original channel list anyway, by the way, generations only contain the result of the nixos-rebuild command, not the inputs.

1 Like

Ok, so I tried unstable again, like this:

$ sudo nix-channel --add https://nixos.org/channels/nixos-unstable nixos
$ sudo nix-channel --list
nixos https://nixos.org/channels/nixos-unstable
$ sudo nix-channel --update
$ sudo nixos-rebuild switch --upgrade

After this, wifi did not work. I then tried rebooting into this nixos-unstable generation. Wifi did not work.

I am not sure what is interesting to look at but I ran this:

$ lspci -vq
# skipping showing devices I think are irrelevant
03:00.0 Network controller: Broadcom Inc. and subsidiaries BCM4331 802.11a/b/g/n (rev 02)
        Subsystem: Apple Inc. AirPort Extreme
        Flags: bus master, fast devsel, latency 0, IRQ 17
        Memory at a0500000 (64-bit, non-prefetchable) [size=16K]
        Capabilities: <access denied>
        Kernel driver in use: wl
        Kernel modules: bcma, wl

$ ping 8.8.8.8
ping: connect: Network is unreachable

My configuration.nix is still the same as I said in my first post:

  boot.extraModulePackages = [ config.boot.kernelPackages.broadcom_sta ];
  boot.kernelModules = [ "wl" ];
  # and then a bit later
  networking.networkmanager.enable = true;

Anything else I could run or show that would be useful to figure out why it doesn’t work?


I was not aware of configurationLimit but in this particular case I don’t think it would have helped, rather the opposite. Before switching back to stable, it was only my oldest generation that worked, the rest were attempts by me to try newer unstable to see if they worked. I would rather have deleted the newer ones. I’m sure that’s possible but I’m not yet so good at googling for nixos problems I have. One thing at a time. :slight_smile:

Could you give us the output of:

nix-shell -p nix-info --run "nix-info -m"

That exact command threw some error but I ran this:

$ nix-shell -p nix-info

[nix-shell:~]$ nix-info -m
 - system: `"x86_64-linux"`
 - host os: `Linux 6.6.45, NixOS, 24.11 (Vicuna), 24.11pre666839.c3aa7b8938b1`
 - multi-user?: `no`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.5`
 - channels(root): `"nixos"`
 - nixpkgs: `/home/x/.nix-defexpr/channels/nixpkgs`

So, the info I wanted is:

The last bit of that number is the nixpkgs commit hash from which your system was built. That commit definitely includes the wpa supplicant fix:

tlater ../Documents/Projects/Nix/nixpkgs $ git checkout c3aa7b8938b17aebd2deecf7be0636000d62a2b9
Previous HEAD position was 445718104cab Merge pull request #334841 from r-ryantm/auto-update/circt
HEAD is now at c3aa7b8938b1 Merge pull request #333614 from linj-fork/pr/bump-kanata
tlater ../Documents/Projects/Nix/nixpkgs $ git log | grep af5b477ad82f878d1e08bf0a49b6a123190f80ca
commit af5b477ad82f878d1e08bf0a49b6a123190f80ca

Looks like your issue is separate from that one.

Since stable is working for you, and you don’t seem to have much of a reason to use unstable currently, sticking with that is probably your best bet if you don’t want to continue debugging.

If you do want to debug this, is there anything useful in dmesg or journalctl --boot? Have you tried using a newer kernel?

I am fine with waiting until next stable, I’m just worried that this problem might still be there, so I could just as well do some debugging now.

Sadly, I don’t find anything different in dmesg (also searched for “bc”, “802.11” and “wifi” but that didn’t result in anything more interesting. Both unstable and stable shows

eth0: Broadcom BCM4331 802.11 Hybrid Wireless Controller 6.30.223.271 (r587334)
...
wl 0000:03:00.0 wlp3s0: renamed from eth0

Also compared the dmesgs side by side but it is hard to diff that much data manually.

I will check journalctl --boot as well, don’t have more time right now.

1 Like

Same here, I’m worried that it won’t ever be fixed for devices like mine: Broadcom BCM43a0 802.11 Hybrid Wireless Controller 6.30.223.271 (r587334)

Getting: wlp6s0: CTRL-EVENT-SCAN-FAILED ret=-22

Tried the boot.kernelParams = [ "brcmfmac.feature_disable=0x82000" ];

Last working hash is: github:nixos/nixpkgs/58db6204aca1cd69edb6d1e39b7b56e6e6cd6a0a

Hash after that was the upgrade to wifi 7 wpa supplicant.

(post deleted by author)

Ok, so I accidentally posted some information that I don’t want in this forum. I tried to delete my post but the full history is still there. How can I delete it? Super annoying.

If I can’t delete my post completely, including its edits/history, will my posts be be deleted for real if I delete my account?

EDIT: Can’t find any way to do it. It seems possible in discourse to hide revisions but it doesn’t seem to be enabled here on discourse.nixos.org

How can I contact admin of this forum?

You’ll have to find one of the admin/moderators.

1 Like

I can’t find any way to contact them there, sadly.