xcp-ng / xcp

Entry point for issues and wiki. Also contains some scripts and sources.
https://xcp-ng.org
1.32k stars 74 forks source link

Starting a VM with USB passthrough results in Internal Server Error #108

Closed AdrianFretwell closed 2 years ago

AdrianFretwell commented 5 years ago

After attaching a USB device to a VM using the procedure detailed here https://github.com/xcp-ng/xcp/wiki/USB-Pass-Through. I see the following error when trying to start the VM:

[root@ahf-test1 ~]# xe vm-start uuid=03c084c3-6165-25a8-d983-3cd5b11816a0

The server failed to handle your request, due to an internal error.  The given message may give details useful for debugging the problem.
message: xenopsd internal error: Call to usb reset failed: Forkhelpers.Spawn_internal_error("usage: usb_reset.py attach [-h] -d DOMID -p PID [-r RESET_ONLY] device\nusb_reset.py attach: error: argument -r: expected one argument\n", "", _)

It looks like /opt/xensource/libexec/usb_reset.py is being passed the -r argument but no value for it. I assume RESET_ONLY is a constant.

I have found a work around for this but it is not a solution.

I have modified /opt/xensource/libexec/usb_reset.py to add a default for the -r argument if non is supplied: Before:

    attach.add_argument("-r", dest="reset_only", type=int,
                        help="reset device only, for privileged mode")

After:

    attach.add_argument("-r", dest="reset_only", nargs='?', const=1, type=int,
                        help="reset device only, for privileged mode")

The underlying problem must be with whatever code calls usb_reset.py, but I can't work out where it is called from when a VM with USB is started.

Kind regards, Adrian.

olivierlambert commented 5 years ago

Thanks a lot for your feedback!

stormi commented 5 years ago

For future reference, forum thread about USB passthrough issues: https://xcp-ng.org/forum/topic/266/usb-passthrough-test-reports-in-7-5rc1

dynodix commented 5 years ago

Saved my day, altough I m testing USB performance using USB DVBT keys.

stormi commented 4 years ago

Is this bug still present in XCP-ng 8.2? We could probably contribute a fix upstream if it is.

jeremfg commented 3 years ago

I'm having this issue in XCP-ng 8,2

However, it only happens once I try to pass through a GPU. If I have only USB, all is fine, but as soon as I also attempt to passthrough a PCI-E GPU the USB starts throwing this error. As if this was a combination of both type of passthrough used simultaneously that is causing the issue.

Further account of this behavior (in version 8.1) here => https://forum.level1techs.com/t/xcp-pci-passthrough-usb-passthrough-does-not-work-together/162110

stormi commented 3 years ago

Thanks for your report. This does not seem to be the same issue as that from the original poster though. Could you open a new one?

jbmorgado commented 3 years ago

I am still facing the same issue. USB dongle passthrough attempts give this same error. (And I am also passing through a GPU as mentioned)

stormi commented 3 years ago

Updated packages addressing this issue are available for testing on XCP-ng 8.2: https://xcp-ng.org/forum/post/41480

stormi commented 2 years ago

The update with the fix is now released to every XCP-ng 8.2 user: https://xcp-ng.org/blog/2021/12/08/december-2021-xcp-ng-updates/