![QEMU USB 直通不起作用](https://linux22.com/image/661413/QEMU%20USB%20%E7%9B%B4%E9%80%9A%E4%B8%8D%E8%B5%B7%E4%BD%9C%E7%94%A8.png)
我在 Ubuntu Server 14.04 上无法让 USB 直通与 Windows 8.1 客户操作系统配合使用。我首先使用 Ubuntu 文档 (https://help.ubuntu.com/community/KVM)。USB 设备 (Datev mIdentity) 已被访客识别,但我无法获得任何访问权限。这与之前报告的错误相同 (https://bugs.launchpad.net/qemu/+bug/1033727)
主机上的 lsusb 输出:
# lssub
[239775.341958] usb 3-4: hub failed to enable device, error -22
[239775.508845] usb 3-4: reset full-speed USB device number 11 using xhci_hcd
[239775.508893] xhci_hcd 0000:00:14.0: Setup ERROR: setup context command for slot 10.
[239775.509931] usb 3-4: hub failed to enable device, error -22
[239775.676980] usb 3-4: reset full-speed USB device number 11 using xhci_hcd
[239775.695110] xhci_hcd 0000:00:14.0: xHCI xhci_drop_endpoint called with disabled ep ffff8800cee83100
[239775.695114] xhci_hcd 0000:00:14.0: xHCI xhci_drop_endpoint called with disabled ep ffff8800cee83148
[239775.695115] xhci_hcd 0000:00:14.0: xHCI xhci_drop_endpoint called with disabled ep ffff8800cee83190
[239775.695517] usb 3-4: usbfs: process 23897 (pcscd) did not claim interface 0 before use
[239786.195869] usb 3-4: usbfs: interface 0 claimed by usbfs while 'qemu-system-x86' sets config #1
在 /var/log/libvirt/qemu/VM.log 中我发现以下行:
libusb_set_configuration: -6 [BUSY]
经过大量阅读后,我设置了一个 udev 规则来授予 libvirt-group 访问权限,在 vm 的 xml 定义中定义了设备,并检查了 appamor 是否被阻止。一切看起来都很好,但仍然出现相同的错误。
然后我从源代码构建 qemu,并设置了 --enable-libusb 标志。仍然出现同样的错误。
QEMU 版本:
# /usr/bin/qemu-system-x86_64 -version
QEMU emulator version 2.0.0 (Debian 2.0.0+dfsg-2ubuntu1.13), Copyright (c) 2003-2008 Fabrice Bellard
libsub版本:
# dpkg -l | grep libusb
ii libgusb2:amd64 0.1.6-5 amd64 GLib wrapper around libusb1
ii libusb-0.1-4:amd64 2:0.1.12-23.3ubuntu1 amd64 userspace USB programming library
ii libusb-1.0-0:amd64 2:1.0.17-1ubuntu2 amd64 userspace USB programming library
ii libusb-dev 2:0.1.12-23.3ubuntu1 amd64 userspace USB programming library development files
ii libusbredirparser1:amd64 0.6-2ubuntu1 amd64 Parser for the usbredir protocol (runtime)
libvirt 版本:
# dpkg -l | grep libvirt
ii libvirt-bin 1.2.2-0ubuntu13.1.10 amd64 programs for the libvirt library
ii libvirt0 1.2.2-0ubuntu13.1.10 amd64 library for interfacing with different virtualization systems
ii python-libvirt 1.2.2-0ubuntu2 amd64 libvirt Python bindings
目前我还不知道发生了什么。我很感激任何帮助。非常感谢!
答案1
[239786.195869] usb 3-4: usbfs: interface 0 claimed by usbfs while 'qemu-system-x86' sets config #1
usbfs 驱动和 qemu-system-x86 存在冲突,需要按照以下步骤解决:
echo "blacklist usbfs" > /etc/modprobe.d/usbfs-conflict.conf
更新 initramfs 以避免在启动时加载模块。它将在安装根文件系统之前更新启动过程中使用的配置文件。
sudo update-initramfs -u
重新启动 QEMU 并重试。