Wi-Fi constantly disconnects for 15-20s (mt7921e/bgscan issue) — One-liner mitigation stack

Description of the problem

Wi-Fi constantly disconnects for 15-20 seconds. This happens because wpa_supplicant uses bgscan (background scanning) by default. The driver (mt7921e in my case) struggles with background scanning and ASPM power management(im not sure about it), causing the connection to lag or drop completely whenever the system looks for other networks in the background.

Fix

What worked for me is to disable ASPM for the driver, switch NetworkManager backend from wpa_supplicant to iwd, and store network credentials directly within the native iwd storage to ensure autonomous background re-connections without relying on user-space graphical keyrings.

sudo bash -c "mkdir -p /etc/modprobe.d /etc/NetworkManager/conf.d /etc/iwd /var/lib/iwd && echo 'options mt7921e disable_aspm=1 disable_aspm_l1=1' > /etc/modprobe.d/mt7921e.conf && echo -e '[device]\nwifi.backend=iwd' > /etc/NetworkManager/conf.d/iwd.conf && echo -e '[Scan]\nDisablePeriodicScan=true\nDisableHE=true\n\n[General]\nEnableNetworkConfiguration=true' > /etc/iwd/main.conf && echo -e '[Security]\nPassphrase=YOUR_WIFI_PASSWORD' > '/var/lib/iwd/YOUR_WIFI_SSID.psk' && chmod 600 '/var/lib/iwd/YOUR_WIFI_SSID.psk' && chmod 644 /etc/modprobe.d/mt7921e.conf /etc/NetworkManager/conf.d/iwd.conf /etc/iwd/main.conf && systemctl stop NetworkManager iwd && modprobe -r mt7921e && modprobe mt7921e && systemctl enable --now iwd && systemctl start NetworkManager && echo '==== FIX DEPLOYED & DRIVER RELOADED SUCCESSFULLY ===='"
Disclaimer: The troubleshooting and solution code were generated by AI, so please approach this solution with skepticism.
1 Like