Return to Level1Techs.com

USB failing to reset on guest shutdown ubuntu 20.04 host win10 guest

Hey all, new on the forums though I’ve been watching level1 on youtube for a while.

Have been running GPU passthrough on my main system for almost a year. I recently did a reinstall because I wasn’t satisfied with how I had initially set things up in combination with purchasing aa pcie4 nvme drive. Everything is back up and running, but my last issue is that USB devices are not picked up again by the host when the win10 guest is shut down.

I’m wondering if anyone else has had this problem? I’ve been poking around a bit, and strangely, the host os doesn’t even reacquire these usb devices after physically unplugging them (we’re talking about a hyperX keyboard and a razer deathadder essential mouse).

It seems like the ports that are being passed through to the guest, which I’m doing with a script that issues the following command:

virsh attach-device domain --file /home/user/scripts/keyboard.xml> --current

I have a script to detach, which worked on the previous installation, but simply shutting down the guest without the script also resulted in the usb devices being picked up by the host os again without problems then as well.

I am a little stumped on where to start looking for this. It appears as if virsh is somehow reserving the adresses altogether and holds onto them even when the actual devices are unplugged and the guest is shut down.

If anyone has any ideas I’d love to hear it. i’ll update the topic as I think of new things to try. As I’m typing this I realize I haven’t tried plugging one of the devices into a different USB port when the problem occurs.

Any thoughts would be appreciated.

edit:
problem occurs with any guest, win10, ubuntu, etc.

Allright, I’ve finally solved this. It required adding:

kvm_amd.npt=1 kvm_amd.avic=1

to /etc/default/grub in GRUB_CMDLINE_LINUX_DEFAULT

USB is released normally now and can be switched freely between host and guest.

Possibly of use since to some since the ubuntu 20.04 guide by Matthias Hueber which I’m apparently not allowed to link to by this forum software no longer includes those grub options, which it did to in the ubuntu 18.04 version (which I’m also apparently not allowed to link to.

The above turned out to be an intermittent fix. It occasionally returned control to the host on guest shutdown but not consistently.

Problem was eventually solved by removing two nvidia related packages that are not directly linked to the driver package on the host. One of the was nvidia-drm, I can’t for the life of me remember the other. After removing those, USB control started functioning as expected.