NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.99k stars 14.01k forks source link

Long wifi interface name crashes wpa_supplicant #154616

Closed ivanbrennan closed 2 years ago

ivanbrennan commented 2 years ago

Describe the bug

A long wifi interface name (in my case wlp0s20f3) causes wpa_supplicant to crash. This is due to a bug in wpa_supplicant that has since been fixed (commit), but the fix has not yet been released (version 2.9 does not contain the fix, as seen here).

The fix is small and I think adding it to the patches in the wpa_supplicant nix expression would address this issue.

I encountered this when trying to connect to wifi during a NixOS install from the minimal ISO. The workarounds I found were to either use a wired connection or use a different ISO that provided NetworkManager.

Steps To Reproduce

There's probably an easier way to repro, but these are the steps that I used to reproduce the behavior:

  1. Get a machine whose wifi interface has a sufficiently long name, such as wlp0s20f3.
  2. Create a bootable USB from the minimal ISO: https://channels.nixos.org/nixos-21.11/latest-nixos-minimal-x86_64-linux.iso
  3. Follow directions for Networking in the installer, specifically those for the minimal installer,

    To configure the wifi, first start wpa_supplicant with sudo systemctl start wpa_supplicant, then run wpa_cli ...

  4. The messages from wpa_cli will make it appear to have worked, however, subsequently testing connectivity will prove otherwise, and checking logs (journalctl -f -u wpa_supplicant) will reveal failure.

Expected behavior

wpa_supplicant provides a working wifi connection.

Additional context

Looking for the root cause led me to a similar report, requesting that the fix be included in wpa_supplicant on Debian, and a discussion on GitLab that explained the issue.

tl;dr If you have an interface name that is quite long (in my case wlp0s20f2), adding the "p2p-dev-" will make it bigger than the allowed length of 15, which causes wpa_supplicant to segfault.

Notify maintainers

@MarcWeber @Ma27

Metadata

The result of running nix-shell -p nix-info --run "nix-info -m" from a bootable USB with the minimal ISO (https://channels.nixos.org/nixos-21.11/latest-nixos-minimal-x86_64-linux.iso):

[nixos@nixos:~]$ nix-shell -p nix-info --run "nix-info -m"
- system: `"x86_64-linux"`
- host os: `Linux 5.10.90, NixOS, 21.11 (Porcupine)`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.3.16`
- channels(root): `"nixos-21.11.335130.386234e2a61"`
- nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
arcuru commented 2 years ago

It looks like wpa_supplicant was updated to version 2.10 in https://github.com/NixOS/nixpkgs/commit/738ff6b30cf2232d12cbc1c4f4d029b76a2a099e, which contains the fix.

ivanbrennan commented 2 years ago

Fixed by https://github.com/NixOS/nixpkgs/commit/738ff6b30cf2232d12cbc1c4f4d029b76a2a099e