KVM Plugin - Remove USB Device from VM not possible

  • I am using a windows vm and attached actually three usb devices to vm. When I try di remove one usb device from vm an error message is thrown from virsh on command line.


    Failed to remove USB device.

    error: Failed to detach device from /tmp/virsh_usbn4uXED

    error: XML Fehler: Invalid value for attribute 'id' in element 'vendor': '0x'. Expected integer value

    virsh detach-device --domain Server-HP --file '/tmp/virsh_usbn4uXED' --persistent --config


    OMV\Exception: Failed to remove USB device.

    error: Failed to detach device from /tmp/virsh_usbn4uXED

    error: XML Fehler: Invalid value for attribute 'id' in element 'vendor': '0x'. Expected integer value

    virsh detach-device --domain Server-HP --file '/tmp/virsh_usbn4uXED' --persistent --config in /usr/share/openmediavault/engined/rpc/kvm.inc:2543

    Stack trace:

    #0 /usr/share/openmediavault/engined/rpc/kvm.inc(1798): OMVRpcServiceKvm->virshCommand(Array, 'Failed to remov...')

    #1 [internal function]: OMVRpcServiceKvm->removeUsb(Array, Array)

    #2 /usr/share/php/openmediavault/rpc/serviceabstract.inc(123): call_user_func_array(Array, Array)

    #3 /usr/share/php/openmediavault/rpc/rpc.inc(86): OMV\Rpc\ServiceAbstract->callMethod('removeUsb', Array, Array)

    #4 /usr/sbin/omv-engined(537): OMV\Rpc\Rpc::call('Kvm', 'removeUsb', Array, Array, 1)

    #5 {main}


    Seems some problem on plugin creating command line skript.


    Is it generally possible to remove usb device on running kvm vm? Actually I shutdown VM but removing is still not possible. May be manually removing from vm xml file will be successfull.

  • Is it generally possible to remove usb device on running kvm vm?

    Yes. Did you add the usb device with the plugin? It is evidently parsing the usb device incorrectly. Can you post the VM's xml?

    omv 6.0.42-2 Shaitan | 64 bit | 5.19 proxmox kernel | plugins :: omvextrasorg 6.1.1 | kvm 6.1.23 | mergerfs 6.3.3 | zfs 6.0.11
    omv-extras.org plugins source code and issue tracker - github


    Please try ctrl-shift-R and read this before posting a question.
    Please don't PM for support... Too many PMs!

  • Yes. Did you add the usb device with the plugin? It is evidently parsing the usb device incorrectly. Can you post the VM's xml?

    Yes actually all three devices are added via kvm plugin gui. As I needed the vm I manually removed from XML File the entry for this usb device and I could start my vm again.


    I will test again and send you the VM xml and try to reproduce the issue.

  • Attached you will find my XML File from the VM. Tested once again and online removal of usb device is not possible. Seems that the constucted xml file has some missing data for the complete pci string for the usb device:


    Code
    <hostdev mode="subsystem" type="usb" managed="yes"><source><vendor id="0x"/><product id="0x"/></source></hostdev>



    Failed to remove USB device.

    error: Failed to detach device from /tmp/virsh_usb6TsZpF

    error: XML Fehler: Invalid value for attribute 'id' in element 'vendor': '0x'. Expected integer value

    virsh detach-device --domain Server-HP --file '/tmp/virsh_usb6TsZpF' --persistent --config --live


    OMV\Exception: Failed to remove USB device.

    error: Failed to detach device from /tmp/virsh_usb6TsZpF

    error: XML Fehler: Invalid value for attribute 'id' in element 'vendor': '0x'. Expected integer value

    virsh detach-device --domain Server-HP --file '/tmp/virsh_usb6TsZpF' --persistent --config --live in /usr/share/openmediavault/engined/rpc/kvm.inc:2543

    Stack trace:

    #0 /usr/share/openmediavault/engined/rpc/kvm.inc(1798): OMVRpcServiceKvm->virshCommand(Array, 'Failed to remov...')

    #1 [internal function]: OMVRpcServiceKvm->removeUsb(Array, Array)

    #2 /usr/share/php/openmediavault/rpc/serviceabstract.inc(123): call_user_func_array(Array, Array)

    #3 /usr/share/php/openmediavault/rpc/rpc.inc(86): OMV\Rpc\ServiceAbstract->callMethod('removeUsb', Array, Array)

    #4 /usr/sbin/omv-engined(537): OMV\Rpc\Rpc::call('Kvm', 'removeUsb', Array, Array, 1)

    #5 {main}

  • It is failing to parse the vendor id. I'm guessing something is weird with your usb device. What is the output of: sudo lsusb

    omv 6.0.42-2 Shaitan | 64 bit | 5.19 proxmox kernel | plugins :: omvextrasorg 6.1.1 | kvm 6.1.23 | mergerfs 6.3.3 | zfs 6.0.11
    omv-extras.org plugins source code and issue tracker - github


    Please try ctrl-shift-R and read this before posting a question.
    Please don't PM for support... Too many PMs!

  • Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

    Bus 001 Device 011: ID 041e:3125 Creative Technology, Ltd Creative Bluetooth Audio W2

    Bus 001 Device 004: ID 0922:0020 Dymo-CoStar Corp. LabelWriter 450

    Bus 001 Device 003: ID 051d:0002 American Power Conversion Uninterruptible Power Supply

    Bus 001 Device 021: ID 05e3:0732 Genesys Logic, Inc. All-in-One Cardreader

    Bus 001 Device 020: ID 05ac:12a8 Apple, Inc. iPhone 5/5C/5S/6/SE

    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

  • What do the entries in your dropdown when removing the USB devices look like?

    omv 6.0.42-2 Shaitan | 64 bit | 5.19 proxmox kernel | plugins :: omvextrasorg 6.1.1 | kvm 6.1.23 | mergerfs 6.3.3 | zfs 6.0.11
    omv-extras.org plugins source code and issue tracker - github


    Please try ctrl-shift-R and read this before posting a question.
    Please don't PM for support... Too many PMs!

  • Unfortunately, that all looks right. What is the output of: sudo tail /var/log/omv-virsh-command.log

    omv 6.0.42-2 Shaitan | 64 bit | 5.19 proxmox kernel | plugins :: omvextrasorg 6.1.1 | kvm 6.1.23 | mergerfs 6.3.3 | zfs 6.0.11
    omv-extras.org plugins source code and issue tracker - github


    Please try ctrl-shift-R and read this before posting a question.
    Please don't PM for support... Too many PMs!

  • That is the error message I wrote already above


  • I will have to try this on my server when I get home. Hopefully I reproduce this.

    omv 6.0.42-2 Shaitan | 64 bit | 5.19 proxmox kernel | plugins :: omvextrasorg 6.1.1 | kvm 6.1.23 | mergerfs 6.3.3 | zfs 6.0.11
    omv-extras.org plugins source code and issue tracker - github


    Please try ctrl-shift-R and read this before posting a question.
    Please don't PM for support... Too many PMs!

  • Ok thankx, actually I can't remove any USB Device from running VM via KVM GUI Plugin. Tried with all three devices. Error stays the same. Manually editing XML Files still the only solution.

  • Not sure what broke then. You could use virt-manager or virsh too. The plugin uses virsh but somehow the vendor id is not making it from the dropdown to the virsh call.

    omv 6.0.42-2 Shaitan | 64 bit | 5.19 proxmox kernel | plugins :: omvextrasorg 6.1.1 | kvm 6.1.23 | mergerfs 6.3.3 | zfs 6.0.11
    omv-extras.org plugins source code and issue tracker - github


    Please try ctrl-shift-R and read this before posting a question.
    Please don't PM for support... Too many PMs!

  • Removing usb devices should work in 6.1.22 in the repo now.

    omv 6.0.42-2 Shaitan | 64 bit | 5.19 proxmox kernel | plugins :: omvextrasorg 6.1.1 | kvm 6.1.23 | mergerfs 6.3.3 | zfs 6.0.11
    omv-extras.org plugins source code and issue tracker - github


    Please try ctrl-shift-R and read this before posting a question.
    Please don't PM for support... Too many PMs!

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!