Open ertw opened 4 years ago
I had to add this to my config for wifi to work:
boot.extraModprobeConfig = ''
options cfg80211 ieee80211_regdom="${regDom}"
'';
hardware.firmware = [ pkgs.wireless-regdb ];
where regDom is your 2 letter country code (US for the United States).
Update: I did try @matthewbauer's suggestion, and I'm not sure whether it helped or not. Now I am sometimes getting connected to wifi, and sometimes not. In the case where it fails to connect to wifi, I see the same NEW_INTERFACE failed: Device or resource busy
in systemctl status.
I am also still unable to boot into the latest 5.4 kernel (I reported a separate bug for this), so maybe this is an issue that is been fixed, and is only affecting 4.19?
Is there some way I can configure the systemd unit to always restart? Something like, attempt to start every 5 seconds forever seems like what I'd want regardless in an embedded device where connectivity is critical.
I think you can do:
systemd.services.iwd.serviceConfig.Restart = "always";
I also have this in my settings, but can't remember if it made a difference:
networking.dhcpcd.extraConfig = "timeout 0";
Okay, systemd.services.iwd.serviceConfig.Restart = "always";
does seem to solve my problem- the device is now connecting reliably to wifi and I can SSH into it without needing a display.
I'd like to leave this issue open for now though, as there is something causing both iwd
and wpa_supplicant
to crash on initial startup. Ideally we could discover what this is, and correctly solve for it rather than just restarting the service.
Here is what I believe to be the minimal config for working WLAN on the Raspberry Pi 3 B+:
{ config, pkgs, lib, ... }:
{
systemd.services.iwd.serviceConfig.Restart = "always";
hardware = {
enableRedistributableFirmware = true;
firmware = [ pkgs.wireless-regdb ];
};
networking = {
useDHCP = false;
interfaces.wlan0.useDHCP = true;
networkmanager.wifi.backend = "iwd";
wireless.iwd.enable = true;
};
boot = {
extraModprobeConfig = ''
options cfg80211 ieee80211_regdom="US"
'';
};
system = {
stateVersion = "19.09";
};
}
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/raspberry-pi-aarch64-connect-to-wifi-automatically/6162/2
To add to this, the Arch Linux iwd entry specifically calls out issues with the systemd unit failing on startup, which sounds like what I've been running into.
My Raspberry Pi 4B was failing to load the wlan0 device. The fix is to add hardware.enableRedistributableFirmware = true;
. The full working config is in https://github.com/Robertof/nixos-docker-sd-image-builder/issues/10#issuecomment-646901392
Shall we close this issue?
I marked this as stale due to inactivity. → More info
This issue seems to be still present. wlan0
doesn't even show up on the Pi 3. The only workaround is to use an older version of firmware-linux.
@bachp were you able to connect to do it? My wlan0
also won't show up.
I got it working by following the instructions in https://github.com/NixOS/nixpkgs/issues/115652#issue-826834436. But there doesn't seem to be a real solution yet.
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/raspberry-pi-3-wireless-interface/17576/1
@ertw Your typo is carried to the internet example
options cf680211 ieee80211_regdom="US"
it should be cfg80211
instead of cf680211
.
Took me a tremedous long time to figure out.
Without fixing this typo, the output below is 00
and I cannot associate with any network
root@nixos ~# cat /sys/module/cfg80211/parameters/ieee80211_regdom
US
Describe the bug I would like to have my Rasberry Pi connect to wifi without requiring user interaction. I have attempted to configure it using both
wpa_supplicant
andiwd
, and both services are in a failed state on initial login. I have tried wpa_supplicant both with & withoutconnman
, and with & without declaratively specifying the connection details of the SSID.Restarting the service (
systemctl restart wpa_supplicant.service
orsystemctl restart iwd.service
) causes the wireless to immediately connect, andsystemctl status
shows the service in a healthy state.When I run
journalctl -u iwd
, I see the following error listed:NEW_INTERFACE failed: Device or resource busy
To Reproduce Steps to reproduce the behavior:
network.wireless.enable = true;
ornetwork.wireless.iwd.enable = true;
Expected behavior The pi should connect to wifi, and the wireless service (iwd or wpa_supplicant) should not crash.
Metadata Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.Maintainer information: