#998468 libvirt0: qmeu KVM: USB Passthrough partially stopped working in Bullseye

Package:
libvirt0
Source:
libvirt
Description:
library for interfacing with different virtualization systems
Submitter:
Damian Philipp
Date:
2022-11-25 22:51:07 UTC
Severity:
important
#998468#5
Date:
2021-11-04 16:54:42 UTC
From:
To:
Dear Maintainer,

I use a Debian Host to run KVM-based virtual machines, configured with virt-manager.
I run a VM with HASS.io (Home Assistant, a smart home software). Attached to the host is a USB Zigbee modem (Conbee II, in case it is important) which is passed through as individual device to the VM.
In Debian Buster, this setup was working reliably. After a dist-upgrade of the host to Debian Bullsee, this setup is now reliably broken.

virt-manager still shows the device as passed through to the VM. However, the VM does not appear to no longer have access to the USB device. Inside the VM, I run the zigbee2mqtt Plugin. The logs from the Plugin state:

[17:42:45] INFO: Handing over control to Zigbee2mqtt Core ...
CREATED DECONZ ADAPTER
Zigbee2MQTT:error 2021-11-04 17:42:52: Error while starting zigbee-herdsman
Zigbee2MQTT:error 2021-11-04 17:42:52: Failed to start zigbee
Zigbee2MQTT:error 2021-11-04 17:42:52: Check https://www.zigbee2mqtt.io/information/FAQ.html#help-zigbee2mqtt-fails-to-start for possible solutions
Zigbee2MQTT:error 2021-11-04 17:42:52: Exiting...
Zigbee2MQTT:error 2021-11-04 17:42:52: Error: Error while opening serialport 'Error: Error: No such file or directory, cannot open /dev/ttyACM0'
    at SerialPort.<anonymous> (/app/node_modules/zigbee-herdsman/src/adapter/deconz/driver/driver.ts:182:28)
    at SerialPort._error (/app/node_modules/zigbee-herdsman/node_modules/@serialport/stream/lib/index.js:198:14)
    at /app/node_modules/zigbee-herdsman/node_modules/@serialport/stream/lib/index.js:242:12
[17:42:52] INFO: Handing over control to Zigbee2mqtt Core ...

In short, /dev/ttyACM0 is not available. I can confirm that this device node is indeed missing by logging into the console of the VM and poking around in its /dev directory.

More interesting than the log from the VM is probably the following log from the host. Whenever the VM tries to access the USB device, dmesg is spammed (~30 messages per second) with the following message:

[162164.169864] usb 1-5: usbfs: process 1788 (qemu-system-x86) did not claim interface 1 before use

The spam stops immediately when I shutdown the software inside the VM that tries to access the USB device.


In an attempt to narrow down the problem, I used another VM running an Ubuntu 21.04 Live ISO. I attached a USB Flash drive to the Ubuntu VM to verify wheter USB passthrough was completely broken - reading from the flash drive worked. I then attached the USB Zigbee Modem to the Ubuntu VM instead of the HASS.io VM. I saw the aforementioned dmesg message exactly once - likely occuring as the Ubuntu VM tried to enumerate the USB device, as it does not otherwise know what to do with the device.
Furthermore, I observed that virt-manager shows different information for both of the USB devices. For the flash drive, it shows "002:002 Sony Corp. Storage Media", whereas for the Zigbee modem it shows "USB 1cf1:0030" instead. lsusb does show a device information that matches the name and manufacturer of the Zigbee modem, though.

I do not really know where the problem originates. Given that it surfaced exactly when I dist-upgraded Debian, I'm pinning it on Debian (and libvirt, more specifically) for now.

Can you please tell me how to fix passthrough of my USB device or how to further narrow down the problem?

Damian

#998468#10
Date:
2022-05-17 15:37:08 UTC
From:
To:
I experienced this exact same issue when I tried to upgrade my home server
in April 2022.

Also trying to pass a Conbee II to a HomeAssistant VM, same issues, same
dmesg spam.

I ended up rolling back to Buster because I had no time to investigate
further.

#998468#15
Date:
2022-11-25 21:25:01 UTC
From:
To:
I also have a Debian bullseye laptop running as a qemu/libvirt host,
running the home assistant guest VM, where I passed through the Conbee
II usb adapter. Is there a solution to this yet?

#998468#20
Date:
2022-11-25 22:49:27 UTC
From:
To:
I have not found a solution to this issue.

However there is a workaround that involves passing the serial device to
the guest VM instead of the USB device:

https://community.home-assistant.io/t/cannot-passthrough-conbee-ii-with-kvm-host-debian-guest-haos/465496/5

In this specific case I was able to use the zigbee controller with HA.

The underlying problem (passthrough not working properly) however still
remains.

Greets,
Lee