darkguy2008 / hotplugger Goto Github PK
View Code? Open in Web Editor NEWVirtIO (VFIO) USB Port passthrough helper
License: Apache License 2.0
VirtIO (VFIO) USB Port passthrough helper
License: Apache License 2.0
Hello,
I am not sure where else to ask, so I'm just opening an issue here.
Problem:
TL;DR upon following all instructions, no devices connect to my Windows 10 VM. I have tried with a USB kvm switch as well as a USB3.0 thumb drive with the same results.
Detail:
I am trying to switch a mouse and keyboard with a USB KVM switch. I realize this may be mildly more complicated than the intended purpose here, but since the switch is basically just a hub, I figured adding all the ports that show up in the monitor script should work.
Heck, even just a single device hot-plugging would be good, but I can't get that either.
It seems to be failing to remove the USB devices, but I imagine that maybe be because they never attach in the first place. Like I mentioned above, result is the same with just a single USB drive.
Windows sees the xhci controllers added by the command line, but has absolutely no reaction upon connecting or disconnecting USB devices from the ports I've added to the config. The QMP socket file shows up and the scripts don't seem to have any issues with it. I'm just confused since there doesn't seem to be any indication of any issues anywhere except for the disconnect failures. The devices in question always just end up connecting to the host.
OS:
I'm on Ubuntu 20.04 with KVM/QEMU 5.0.
Steps to reproduce:
Simply follow all instructions, and attempt to connect a USB device via hotplug.
Logs are attached. Thank you for your help!
udev.log
hotplugger.log
win10.xml.txt
config.yml.txt
QEMU emulator version 5.0.0 (Debian 1:5.0-5ubuntu6~ppa00)
Host: Ubuntu 20.04
Guest: Debian 11
USB not visible on guest. I cannot see anything obvious from the logs but because I do not have much virtualisation experience I assume I missed a step in the configuration that is preventing the USB drive from appearing on debian.
I was receiving errors for xhci not being found before I read #3 and inserted the same lines is using before the qemu arguments from the readme:
<qemu:commandline>
...
<qemu:arg value="-device"/>
<qemu:arg value="nec-usb-xhci,id=xhci0"/>
<qemu:arg value="-device"/>
<qemu:arg value="nec-usb-xhci,id=xhci1"/>
</qemu:commandline>
</domain>
The readme does mention the XML is a work in progress but can you please confirm whether it is correct to add these lines and if anything else is required for a basic setup using virt-manager? Initially this resulted in the same device not found error I can see from the log VladislavF uploaded but some combination of purging everything related to qemu-kvm, libvirt, virtsh, virt-manager, and reinstalling from the default repo, backports (as qemu is v4.x on 20.04), and a third party repo lead me to many new errors but after many iterations now with none that are obvious to me and in fact from the logs to me at least it looks good. Unfortunately the issue remains, no USB visible on Debian although it seems like I am close!
I cannot say exactly what stopped me receiving that error but I can outline the general steps to setup after the latest purge so that hopefully you can easily spot what I am missing and it may also help someone else.
Add ppa:jacob/virtualisation for qemu v5 without the headache of compiling dependencies.
sudo apt install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils virt-manager
If encountering the 'a storage path must be specified' bug workaround this by moving the installer ISO to the location you want to use for storage, start again selecting it there, and then you should be able to create a volume for storage.
Install Debian 11 without changing or adding anything else virt manager.
My monitor output using a USB 2 and USB 3 keys was:
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb3/3-2
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb4/4-2
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb4/4-2/4-2:1.0
virtual_machines:
debian:
socket: /tmp/my-vm-sock
delay: 1
hubs:
- xhci0.0
- xhci1.0
ports:
- /devices/pci0000:00/0000:00:14.0/usb3/3-2
- /devices/pci0000:00/0000:00:14.0/usb4/4-2
Leave the USB key disconnected.
SUBSYSTEM=="usb", ACTION=="add", RUN+="/bin/bash -c 'python3 /home/anonymousaard/hotplugger/hotplugger.py >> /tmp/hotplugger.log' 2>&1"
SUBSYSTEM=="usb", ACTION=="remove", RUN+="/bin/bash -c 'python3 /home/anonymousaard/hotplugger/hotplugger.py >> /tmp/hotplugger.log' 2>&1"
export EDITOR=nano
sudo virsh edit debian
Edit qemu.conf as per the readme to workaround the apparmor issue.
Complete the troubleshooting steps deleting hotplugger/tmp, rebooting the system, rebooting udev, and viewing the udev's logfile.
hotplugger.log
udev.log
libvirt_debian.log
USB visible on Debian guest.
Always.
Can you please tell me how I can resolve this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.