Coder Social home page Coder Social logo

hotplugger's People

Contributors

64kramsystem avatar darkguy2008 avatar iceburgino avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

hotplugger's Issues

No Devices Connect

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

Logs seem good but no USB on Debian guest?

Versions

QEMU emulator version 5.0.0 (Debian 1:5.0-5ubuntu6~ppa00)
Host: Ubuntu 20.04
Guest: Debian 11

Description

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.

Steps to Reproduce

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
  • config.yaml:
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.

  • 99-zzz-local.rules:
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"
  • Edit /etc/libvirt/qemu/debian.xml
export EDITOR=nano
sudo virsh edit debian

debian.xml.txt

  • 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.

Actual result:

  • Boot Debian and once logged connect the USB key to the port and after observe that the host sees it fine but there is no sign of it on Debian. Do this a second time to show the udev log without error after the reboot.

hotplugger.log
udev.log
libvirt_debian.log

Expected result:

USB visible on Debian guest.

Reproduces how often:

Always.

Can you please tell me how I can resolve this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.