Crash when client connects

I'm not sure where to start. I have OpenWrt running in a ProxMox VM. I have a MediaTek MT7921AU usb WiFi adapter. The physical adapter is passed directly through to the VM. My phone and my table can connect with no issue. The entire VM reboots about 30 seconds after I connect my laptop. Are there any logs that survive a reboot? I'm at a loss on how to troubleshoot this issue.

Thanks in advance.

Yeah, proxmox has few megs if them.

"Passing through" fast USB devices into virtual machines does not work, as USB has no real (virtio) pass-through option (contrary to PCIe on hosts with an IOMMU). While this semi-emulation kind of works with slow-paced devices (e.g. NFC readers), it utterly fails with any USB devices (e.g. wireless cards) that depend on fast data transfers and timely (semi-realtime) responses. In some cases it may be possible to pass-through the whole USB host controller (on the PCIe) level through into the VM, while this approach would work, it may come with rather huge collateral damage (as all USB ports of this controller will then be passed through into the VM and are no longer available to the host).

tl;dr: you can't pass through USB WLAN cards into virtual machines, trying to do so will fail - spectacularly (crashes) or more subtly (weird failures, instability, etc.).

This is nothing that could be fixed at the OpenWrt side, it's a technical limitations of how USB works (and to a lesser extent the hypervisor).

1 Like

Wow, I would have never figured that out. Passing the entire USB controller seems to have fixed the issue. Don't know if I'll use this as my permanent solution or not.

Well I spoke too soon, I'm still getting the random reboots even with the entire USB controller passed through.

Does the host support IOMMU, and is it enabled in the host and in the hypervisor?

It looks like IOMMU is enabled, this was on the host.

root@TS-Prox01:~# dmesg | grep -e DMAR -e IOMMU
[    0.011278] ACPI: DMAR 0x00000000725CB000 000088 (v02 INTEL  EDK2     00000002      01000013)
[    0.011320] ACPI: Reserving DMAR table memory at [mem 0x725cb000-0x725cb087]
[    0.031625] DMAR: IOMMU enabled
[    0.082122] DMAR: Host address width 39
[    0.082123] DMAR: DRHD base: 0x000000fed90000 flags: 0x0
[    0.082133] DMAR: dmar0: reg_base_addr fed90000 ver 4:0 cap 1c0000c40660462 ecap 29a00f0505e
[    0.082136] DMAR: DRHD base: 0x000000fed91000 flags: 0x1
[    0.082140] DMAR: dmar1: reg_base_addr fed91000 ver 5:0 cap d2008c40660462 ecap f050da
[    0.082143] DMAR: RMRR base: 0x0000007c000000 end: 0x000000803fffff
[    0.082145] DMAR-IR: IOAPIC id 2 under DRHD base  0xfed91000 IOMMU 1
[    0.082147] DMAR-IR: HPET id 0 under DRHD base 0xfed91000
[    0.082148] DMAR-IR: Queued invalidation will be enabled to support x2apic and Intr-remapping.
[    0.083912] DMAR-IR: Enabled IRQ remapping in x2apic mode
[    0.359970] pci 0000:00:02.0: DMAR: Skip IOMMU disabling for graphics
[    0.454938] DMAR: No ATSR found
[    0.454939] DMAR: No SATC found
[    0.454940] DMAR: IOMMU feature fl1gp_support inconsistent
[    0.454941] DMAR: IOMMU feature pgsel_inv inconsistent
[    0.454942] DMAR: IOMMU feature nwfs inconsistent
[    0.454943] DMAR: IOMMU feature dit inconsistent
[    0.454944] DMAR: IOMMU feature sc_support inconsistent
[    0.454944] DMAR: IOMMU feature dev_iotlb_support inconsistent
[    0.454945] DMAR: dmar0: Using Queued invalidation
[    0.454949] DMAR: dmar1: Using Queued invalidation
[    0.456805] DMAR: Intel(R) Virtualization Technology for Directed I/O

What's really weird is it's only when my laptop connects. I can have other devices connected all day without issue. I moved the syslogs to a persistent drive but couldn't find anything useful in them. Is that any additional logging I can turn to that might shed some light on what's happening?

This sounds like an issue with the driver for the wifi adapter. I would suggest to try another wifi adapter (check that the driver is available on OpenWrt before buying one).

Also see this comment.

I got the MediaTek Mt7921AU specifically because of its Linux compatibility based on this list. I suspect you are correct about drive issues, both my laptop and ProxMox have had updates since this process started and when I decided to try it again today it just worked, I'm currently typing this connected over WiFi to that card. I wish I had a more definitive explanation but I've been connected for the past 10 minutes, previously I'd get about 30 seconds before OpenWRT rebooted. I'll take the win and move on. I appreciate everyone's input.

1 Like

Everything was rock solid yesterday. Around 3AM OpenWRT rebooted for some reason, and now when I connect I get the same rebooting after 30 seconds. It still only happens when I connect my laptop, other devices can connect just fine. At this point I have no idea what's going on.

Still sounds like a driver issue to me.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.