Wifi not working: module iwlwifi loaded but wlan0 not present

I have good experience with Linux but I have recently installed Qubes OS, so I may have committed some naiveté. Until two days ago, the wifi interface worked perfectly, as did everything else, and I was thrilled to have even gotten a windows 10 qube working for work purposes.

I have read several dozen posts with similar problems, not only in this forum but also related to debian and archlinux. No one has solved the problem for me.

I don’t know how to interpret the kernel message “iwlwifi 0000:00:06.0: retry init count 2”.

Does anyone have any advice on how to proceed with diagnosis?

Regards
Emanuele

Qubes OS 4.1
kernel 5.15.89-1.fc32
default template debian-11

From sys-net qube terminal:

user@sys-net:~$ sudo lspci |grep Wire
00:06.0 Network controller: Intel Corporation Wireless 8265 / 8275 (rev 78)

user@sys-net:~$ ls /lib/firmware/iwlwifi-8265-*
/lib/firmware/iwlwifi-8265-22.ucode  /lib/firmware/iwlwifi-8265-36.ucode

user@sys-net:~$ sudo lsmod | grep iwlwifi
iwlwifi               401408  1 iwlmvm
cfg80211             1069056  3 iwlmvm,iwlwifi,mac80211

user@sys-net:~$ sudo dmesg | grep wifi
[    7.958329] iwlwifi 0000:00:06.0: loaded firmware version 36.ad812ee0.0 8265-36.ucode op_mode iwlmvm
[    8.521220] iwlwifi 0000:00:06.0: Detected Intel(R) Dual Band Wireless AC 8265, REV=0x230
[    9.484109] iwlwifi 0000:00:06.0: retry init count 0
[    9.484163] iwlwifi 0000:00:06.0: Detected Intel(R) Dual Band Wireless AC 8265, REV=0x230
[   10.988553] iwlwifi 0000:00:06.0: retry init count 1
[   10.988601] iwlwifi 0000:00:06.0: Detected Intel(R) Dual Band Wireless AC 8265, REV=0x230
[   12.268810] iwlwifi 0000:00:06.0: retry init count 2

user@sys-net:~$ sudo iwconfig 
lo        no wireless extensions.

ens7      no wireless extensions.

vif5.0    no wireless extensions.

Did you change vm kernel by any chance?
Is sys-net disposable?
Have you tried changing its template to Fedora?
Are you willing to try with kernel-latest (and Debian)?
Have you tried detaching and re-attaching the pci device with qvm-pci? (Shut down sys-net before you do this)

Just something to get you going.

I tried with both the two kernels available by the setup:
kernel 5.15.52-1.fc32
kernel 5.15.89-1.fc32
getting no change.

No

I did it, getting no change.

What do you mean by “kernel-latest”? How do you suggest I do it?

I did it, getting no change.

UPDATED: the two kernels available by the setup:
kernel 5.15.52-1.fc32
kernel 5.15.89-1.fc32

Perhaps you might’ve made some unintentional modifications.

Try creating a new AppVM (we’ll only use this for testing), make sure it’s a service VM, don’t assign it any netvm.

Shut down sys-net and only then attach the network PCI device to this newly created VM. Then try using it as netvm for your other VMs.

If Debian doesn’t work, try creating a new one but with Fedora (by creating a new one with a different template we can rule out some modifications made on the template itself).

If this doesn’t work, try with the suggestion below:

In dom0, install kernel-latest-qubes-vm. This will make available the 6.1.11 kernel version for VMs. You can then check if using it makes a difference.

I found instructions here.
Last kernel installed getting no change.

user@sys-net:~$ uname -a
Linux sys-net 6.1.7-1.fc32.qubes.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jan 20 20:56:29 CET 2023 x86_64 GNU/Linux
user@sys-net:~$ nmcli device
DEVICE  TYPE      STATE      CONNECTION         
ens7    ethernet  connected  Wired connection 1 
lo      loopback  unmanaged  --                 
user@sys-net:~$ lspci
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
00:02.0 Unassigned class [ff80]: XenSource, Inc. Xen Platform Device (rev 01)
00:04.0 VGA compatible controller: Device 1234:1111 (rev 02)
00:05.0 USB controller: Intel Corporation 82801DB/DBM (ICH4/ICH4-M) USB2 EHCI Controller (rev 10)
00:06.0 Network controller: Intel Corporation Wireless 8265 / 8275 (rev 78)
00:07.0 Ethernet controller: Intel Corporation Ethernet Connection (4) I219-LM (rev 21)
user@sys-net:~$

I already did a test with a new AppVM named sys-net-2, based on Fedora template, as you described, getting no change.

Today I moved to the office, without shutting down Qubes OS, just closing the laptop lid. In this case my power manager config does not hibernate, just lock screen.

I opened Qubes OS at the office and ta-da!
Magically now wifi is working again.

user@sys-net:~$ nmcli device
DEVICE        TYPE      STATE         CONNECTION       
wls6          wifi      connected     IntesiGroupGuest 
p2p-dev-wls6  wifi-p2p  disconnected  --               
ens7          ethernet  unavailable   --               
vif42.0       ethernet  unmanaged     --               
lo            loopback  unmanaged     --               

Now I must exclude a problem in the sys-net AppVM configuration because currently it is working fine.

Is it possible that the lid closing/opening action interacts with the wifi driver, not removing the device (it was detected by lspci) but turning it off/on in some way? If this is possible, I can just speculate a bug in the firmware and an intermittent occurrence of it.

Intermittent faults are the worst issues I ever encountered in my career, and this seems to be one of them. But I have no more ideas.

UPDATE: When WiFi stops working suspend and resume is an effective workaround.

UPDATE: suspend and resume ON BATTERY works fine, on AC Power didn’t work.