WiFi driver freezes system/prevent shutdown/panics kernel

My system is ASUS TUF GAMING A15 (FA506IC). Its network controller is MT7921.
nix (Nix) 2.28.3

Issues

After connecting to WiFi with either wpa_supplicant/iwd/networkmanager, my system will either just lose connection and waybar freezes or kernel panics with just capslock blinking.
While shutting down or rebooting, any WiFi related services will prevent the system from shutting down, sometimes saying mt7921 driver own failed. Maybe kernel panics too. If I wait long enough, the screen turns black with no sign of the thing ever turning off. I have to force shutdown every time.

I’m not sure what kernel version exactly is this happening on but I’ve tried a few of 6.x versions available in nixpkgs and I found problems in all of them that I’ve tried.

I’ve tried searching up the problem and found related issues in bug tracker for other distribution but they’re seems to be a bit different each time. They seems to solved it usually by downgrading linux version which doesn’t seems to work for me.

I’ve been dealing with problem for awhile now. I think my WiFi works after I reinstalled NixOS but the problem came back after I did a nixos-rebuild.

So with all the problem, I think this is probably caused by a bug in some kernel module. Any ideas?

Can you share your logs?

If your suspicion is correct there is not much you can do besides maybe reporting the bug upstream, but if it’s persisted for this long it sounds like that module is practically abandoned. That, or it may also just be hardware failure…

This thread over on the arch forums suggests that having booted windows at some point in this laptop’s past may also cause stuff like this, and seems at least mostly plausible: WIFI device keeps failing with: mt7921e driver own failed / Kernel & Hardware / Arch Linux Forums

Here’s the journalctl output: https://0x0.st/83Y3.txt

I have hibernated in the past and did nixos-rebuild at some point but I don’t have any issues with wifi then. I’ve make sure to turn off fast boot before removing window and wipe the disk.

I remembered that I actually found a patch in the mailing list related to this problem before but I unfortunately can no longer find it for some reason. It seems to be something not releasing the driver causing deadlock.

There’s this in the kernel bugzilla, could boil down to BIOS power settings: 216589 – mt7921e: probe fails with error -5 - driver own failed

I find it unlikely that a kernel bug this severe would stick around for this long, so yeah, I’d also suspect a hardware issue here. If fiddling with BIOS doesn’t change anything, return the laptop.