Wifi disconnects and is unable to reconnect with iwlwifi on Asus ROG STRIX X670E-E mobo (NetworkManager)

On my desktop, the wifi connects on boot and all is well, but then randomly disconnects and is unable to reconnect.
I am uncertain the cause.
I use NetworkManager.

If anyone has any ideas or insight, please help. :sweat_smile:

Using a near identical configuration.nix, I have 2-3 other systems without this issue. Different hardware though.

Diagnostics

The following diagnostic commands are run after the wifi had disconnected.

neofetch --stdout

OS: NixOS 22.11.1777.cdead16a444 (Raccoon) x86_64
Host: ASUSTeK COMPUTER INC. ROG STRIX X670E-E GAMING WIFI
Kernel: 5.15.89
Uptime: 43 mins
Packages: 748 (nix-system)
Shell: bash 5.1.16
WM: i3
CPU: AMD Ryzen 9 7950X (32) @ 4.500GHz
Memory: 3289MiB / 127962Mi

NixOS multiuser: yes
Not using flakes.

lshw snippet related to motherboard

  version: Rev 1.xx
    *-core
       description: Motherboard
       product: ROG STRIX X670E-E GAMING WIFI
       vendor: ASUSTeK COMPUTER INC.
       version: Rev 1.xx
     *-firmware
          description: BIOS
          vendor: American Megatrends Inc.
          version: 0805
          date: 11/04/2022
          size: 64KiB
          capacity: 32MiB
          capabilities: pci upgrade shadowing cdboot bootselect socketedrom edd int13floppynec int13floppytoshiba int13floppy360 int13floppy1200 int13floppy720 int13floppy2880 int5printscreen int14serial int17printer int10video acpi usb biosbootspecification uefi

I updated the bios to the latests provided for this motherboard on ASUS’ website, version 0805 as of 2022/11/15, from

lshw snippet related to wireless

*-network DISABLED
    description: Wireless interface
    logical name: wlp9s0
    version: 1a
    width: 64 bits
    clock: 33MHz
    capabilities: pm msi pciexpress msix cap_list ethernet physical wireless
    configuration: broadcast=yes driver=iwlwifi driverversion=5.15.89 firmware=66.f1c864e0.0 ty-a0-gf-a0-66.uc ip=[ip address] latency=0 link=no multicast=yes wireless=IEEE 802.11

lspci | grep "Network\|Ethernet"

09:00.0 Network controller: Intel Corporation Wi-Fi 6 AX210/AX211/AX411 160MHz (rev 1a)
0a:00.0 Ethernet controller: Intel Corporation Ethernet Controller I225-V (rev 03)

modinfo iwlwifi

filename:       /run/booted-system/kernel-modules/lib/modules/5.15.89/kernel/drivers/net/wireless/intel/iwlwifi/iwlwifi.ko.xz
license:        GPL
author:         Intel Corporation <linuxwifi@intel.com>
description:    Intel(R) Wireless WiFi driver for Linux

< ... skipping firmware list : ~46 entries. ty-a0-gf-a0-66.ucode is included. ... >
< ... skipping aliases : ~406 entries ... >

depends:        cfg80211
retpoline:      Y
intree:         Y
name:           iwlwifi
vermagic:       5.15.89 SMP mod_unload
parm:           swcrypto:using crypto in software (default 0 [hardware]) (int)
parm:           11n_disable:disable 11n functionality, bitmap: 1: full, 2: disable agg TX, 4: disable agg RX, 8 enable agg TX (uint)
parm:           amsdu_size:amsdu size 0: 12K for multi Rx queue devices, 2K for AX210 devices, 4K for other devices 1:4K 2:8K 3:12K (16K buffers) 4: 2K (default 0) (int)
parm:           fw_restart:restart firmware in case of error (default true) (bool)
parm:           nvm_file:NVM file name (charp)
parm:           uapsd_disable:disable U-APSD functionality bitmap 1: BSS 2: P2P Client (default: 3) (uint)
parm:           enable_ini:Enable debug INI TLV FW debug infrastructure (default: true (bool)
parm:           bt_coex_active:enable wifi/bt co-exist (default: enable) (bool)
parm:           led_mode:0=system default, 1=On(RF On)/Off(RF Off), 2=blinking, 3=Off (default: 0) (int)
parm:           power_save:enable WiFi power management (default: disable) (bool)
parm:           power_level:default power save level (range from 1 - 5, default: 1) (int)
parm:           disable_11ac:Disable VHT capabilities (default: false) (bool)
parm:           remove_when_gone:Remove dev from PCIe bus if it is deemed inaccessible (default: false) (bool)
parm:           disable_11ax:Disable HE capabilities (default: false) (bool)

lsmod | grep iwl

Module                  Size  Used by
iwlmvm                409600  0
mac80211             1003520  1 iwlmvm
iwlwifi               430080  1 iwlmvm
cfg80211             1044480  3 iwlmvm,iwlwifi,mac80211
led_class              20480  3 input_leds,iwlmvm,asus_wmi

Confirming config.hardware.enableRedistributableFirmware is true

# nix repl --file '<nixpkgs/nixos>'
Welcome to Nix 2.11.1. Type :? for help.

Loading installable ''...
Added 6 variables.
nix-repl> config.hardware.enableRedistributableFirmware
true

A githib gist of the cleaned up dmesg | grep "iwl\|wlp": dmesg output when grepped for "iwl\|wlp" to observe issues in NixOS with iwlwifi on Asus ROG Strix mobo randomly disconnects from wifi and is unable to reconnect. Initial connection on boot is fine. · GitHub

What I have tried

I saw elsewhere that perhaps it is using older firmware, so I nix-garbage-collected to remove the older iwlwifi firmware, yesterday. Then it worked all day into evening, but has failed the next day (today) after shutdown in evening and startup in morning. Connection lasted for a bit, but then disconnected and stayed disconnected.

What I have yet to try

  • Experiment with loading the module with certain params, such as those in: en:users:drivers:iwlwifi [Linux Wireless]
  • examining the wifi modules, hardware, and firmware used on my working systems for comparison
  • rolling back to 22.05 stable and seeing if it works.

Possibly Related NixOS Discourse Posts

Possibly this issue (see workaround in comments).

1 Like

Thanks for linking the possibly related issue.

I attempted the addition of

    extraModprobeConfig = ''
      options iwlwifi disable_11ax=Y amsdu_size=3
      options iwlmvm power_scheme=1
    '';

However, on next boot, the wifi disconnected rather soon and remained unconnected.

I am now using only the workaround provided in your linked source:

    extraModprobeConfig = ''
      options iwlwifi disable_11ax=Y
    '';

I attempted to use iperf to generate a network load as you mentioned to reproduce in the linked bug report. I never used iperf before and am following: Using iPerf to Test Network Speed and Bandwidth | Windows OS Hub

in one terminal I run iperf -s and another I run iperf -c [localhost ip addr] -P 8 -t 30 -w 32768 -i 5 -f g. The test completes, but I am uncertain how to generate a significant load atm.

For now, as I resume work, we’ll see if the wifi issues persist with the workaround alone.

Need to run iperf -s on a separate machine (preferably it is wired, but ofc local machine is not) than the one under test, because need to test the WiFi interface, not localhost. All the args after -c hostname aren’t really needed either, the defaults are fine.

I have tried individually:

extraModprobeConfig = ''
      options iwlwifi disable_11ax=Y
    '';

and

extraModprobeConfig = ''
      options iwlwifi amsdu_size=3
    '';

both resulted in eventual wifi disconnect and failure to reconnect.

I am now trying

    extraModprobeConfig = ''
      options iwlmvm power_scheme=1
    '';

on its own, and will edit or post here the result. I hope I don’t run out of relevant parameters for iwlwifi and wilmvm that would fix this. I do see the entire param listing and options from modinfo for each, so i can keep exploring exhaustively for now as I just let this run idle.

Perhaps it is to do with the power schemes, both iwlwifi and iwlmvm have params for it, and my issue seems correlated with when the machine is left idle or very minimal use of internet (streaming music over spotify web browser).

:[

I have yet to test appropriately with your recommended setup for iperf. I do have a machine right here, and they have an Ethernet between them. Just time commitment and idk what I’m doing there.

[Edit 1:] This machine is dual booted with windows 10 and windows 10 connects fine to the wifi.

[Edit 2:] iwlmvm power_scheme=1 lasted since last post to this morning, suspended system over night. resumed fine. eventually wifi disconnected and remained so. I worked on this machine all of yesterday. Now trying all power saving off params just to ensure this case is covered, as power savings should be entirely off on a desktop machine anyways.

    extraModprobeConfig = ''
      options iwlwifi power_save=N
      options iwlmvm power_scheme=1
      options iwldvm force_cam=Y
    '';

The issue persists regardless of the settings I have tried so far. I have tried more combinations and will share them here when back on that system.