VM won't start when added a usb host device to a KVM vm

When I add a usb host device to a KVM vm (WinXP) on openSUSES 13.1 x86_64 (recently upgraded from 12.3). I get the following error when I try to start the virtual machine.

Error starting domain: internal error: process exited while connecting to monitor: qemu-system-x86_64: -device usb-host,hostbus=2,hostaddr=3,id=hostdev0: Parameter 'driver' expects device type


Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 100, in cb_wrapper
    callback(asyncjob, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 122, in tmpcb
    callback(*args, **kwargs)
  File "/usr/share/virt-manager/virtManager/domain.py", line 1218, in startup
    self._backend.create()
  File "/usr/lib64/python2.7/site-packages/libvirt.py", line 866, in create
    if ret == -1: raise libvirtError ('virDomainCreate() failed', dom=self)
libvirtError: internal error: process exited while connecting to monitor: qemu-system-x86_64: -device usb-host,hostbus=2,hostaddr=3,id=hostdev0: Parameter 'driver' expects device type

I’m doing this from the Virtual Machine Manager.

Is this a bug, or am I doing something wrong?

You’ll need to better describe how you attempted to add the USB device.
Although the following SDB is for SUSE Enterprise SP3, it applies completely to current openSUSE as well.

It should describe a number of things related to using USB devices, perhaps the two main methods of virtualized I/O and USB Pass-through.

https://www.suse.com/documentation/sles11/singlehtml/book_kvm/book_kvm.html

If you still have problems, post again.

HTH,
TSU

I used the Virtual Machine Manager. On de details page for the vm I clicked “+ Add hardware”. Selected USB host device. And on the right I selected the Host Device I wanted to add. And then “Finish”. After that the usb device is visible in the hardware list of the vm, with it’s ID number. But when I try to start the changed vm, all I get is the error…

I want to add a USB Pass-through device from the host to the vm, but this description doesn’t help much…

For starters,
Need to know what kind of USB device this is.

Then, what you either tried or didn’t and any error messages returned after each of your tries.

TSU

Does that matter when you try to pass-through the device to the guest?

But it’s wibu-key:

usb 2-1.2: new full-speed USB device number 5 using ehci-pci
usb 2-1.2: New USB device found, idVendor=064f, idProduct=0bd7
usb 2-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
usb 2-1.2: Product: WIBU-BOX/U
usb 2-1.2: Manufacturer: WIBU-SYSTEMS AG, [www.wibu.com](http://www.wibu.com)

Then, what you either tried or didn’t and any error messages returned after each of your tries.

What I tried and the error message I get is specified in detail in a previous message…

OK,
Pls verify that a wibu-key is used for multi-factor authentication.

I don’t have much experience looking at using USB keys for multi-factor authentication, but IMO it likely is one of the types of devices that has to be given exclusive access to the Guest, you cannot just configure it as any generic USB device(which appears to be what you likely did from your original post).

So, if you’re having problems setting it up using the reference I posted, pls post your exact steps, or if you can’t figure out the reference any other Q you may have.
I assume that you know you will have to configure the Guest according to use the certificates on the wibu-key which further involves steps I haven’t personally done.

TSU

What is multi-factor authentication?

I don’t have much experience looking at using USB keys for multi-factor authentication, but IMO it likely is one of the types of devices that has to be given exclusive access to the Guest, you cannot just configure it as any generic USB device(which appears to be what you likely did from your original post).

There is no configuration for usb devices in the Virtual Machine Manager. You can only select them, to add them to your virtual machine. And that should be enough. The host just has to pass through any communcation to and from the device from the virtual machine verbatim. That’s what “pass through” suggests anyway!

What the error message suggests IMHO: “libvirtError: internal error: process exited while connecting to monitor: qemu-system-x86_64: -device usb-host,hostbus=2,hostaddr=3,id=hostdev0: Parameter ‘driver’ expects device type”. That there is a problem/bug in the interfacing python code between the Virtual Machine Manager, and libvirt…?

In the document I referenced,

USB Host Device Pass-through A physical USB device may be passed from the VM Host Server to the VM Guest. Given the very wide variety of USB devices available, it is anticipated that some devices may not work properly.

That said,
I recommend
Section 7.3.1 following instructions for configuring <system> access to a Regular User
Section 13.3.3 talks about what I described earlier. <Read this closely>
If emulation is to work, my guess is that your device needs to be configured as a serial device, but that is only a guess
13.3.3.2. USB Pass-Through I tend to believe that emulation as a whole <will not work> because of the type of device it is. If so, then IMO <this is what you need to do>

Optionally, if a USB controller is not available (or just create one anyway if you want)
Section 9.5 and/or 9.6

So, what is “multi-factor authentication?”
Googling should provide you an answer, but my definition is using more than one type of credentials to authenticate. So, in this case I’m guessing your USB key provide certificates and in combination with your entering Username/Password provides 2 ways for you to be authenticated to do something. Or, of course, the key’s certs by themselves might be sufficient for the Authenticator, whatever it is.

HTH,
TSU

Hi TSU,

Before I’m going to follow your recommendations, I want to make sure we are on the right track here. And I like you to comment on the following to tests I did:

First I connected an external usb HDD to the host machine (that’s working fine and is being detected properly by the host). When I add it to the VM and try to start it, I get the same error:

Error starting domain: internal error: process exited while connecting to monitor: qemu-system-x86_64: -device usb-host,hostbus=2,hostaddr=6,id=hostdev0: Parameter 'driver' expects device type


Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 100, in cb_wrapper
    callback(asyncjob, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 122, in tmpcb
    callback(*args, **kwargs)
  File "/usr/share/virt-manager/virtManager/domain.py", line 1221, in startup
    self._backend.create()
  File "/usr/lib64/python2.7/site-packages/libvirt.py", line 866, in create
    if ret == -1: raise libvirtError ('virDomainCreate() failed', dom=self)
libvirtError: internal error: process exited while connecting to monitor: qemu-system-x86_64: -device usb-host,hostbus=2,hostaddr=6,id=hostdev0: Parameter 'driver' expects device type

Only the ‘hostaddr’ (of course) differs from the error I get, when doing the same with the usb key.

Another test on a Windows 7 host machine with the usb key, and a virtual Windows XP under VirtualBox as hypervisor: It just works: “click” to add the usb key to the VM, and it is detected and working properly in the virtual XP machine. No special configuration needed at all!

To make things more clear I also made two screen grabs. The first shows how I’m adding the external usb HDD to the vm. The second shows where I’m trying to start the vm, and the error message that’s displayed.

http://paste.opensuse.org/view/raw/6885948

http://paste.opensuse.org/view/raw/95778765

Well,
Specifically regarding a USB Storage Device (may not apply to other types of USB devices)

The proper approach isn’t to try to configure a Guest to connect directly to a USB device,

You should instead verify the USB storage device is visible and accessible by the Host (Normally this is not an issue).
Then you let the Host provide the emulation and connectivity to the Guest by configuring in the Guest VM Settings. This is easy to do if you’re using vm manager…

Instead of trying to configure a USB device, you simply “Add…” a normal storage device (disk) (NOT a USB device).
Then, when the Guest boots up, the Guest UDEV subsystem should see the system disk and automatically configure it to be accessed like any ordinary disk. The Guest sees the disk as simply a disk and unless it’s interrogated further isn’t recognized as connecting by USB, SATA or any other type of connection.

Note that the details of a USB connection is completely removed from the Guest, it’s all done on the Host.

HTH,
TSU

My point was not to connect the external usb disk to the vm. But to show that the error message is exactly the same as for the usb key. :wink:
Isn’t that pointing to a bug in the python code!? Because it seems the function to add a usb device directly to a vm as a pass through device seems utterly useless, if it just gives you this error for anything you try to add this way!

No, you can’t assume when attempting to connect two very different class devices. It’s an apples and oranges thing, they are too different.

I’d refer you again to my post from the KVM SDB and try to attach the device by commandline, and even then some devices aren’t supported. So, actually before going down this road at all it’d probably be worthwhile to contact the manufcturers of your USB key and ask them directly whether they know their key is supported at all in a virtualized environment and specifically KVM.

TSU

Could it be I’m hitting this: http://lists.opensuse.org/opensuse-virtual/2014-02/msg00000.html problem?

“USB redirection does not work at all using Qemu-KVM 1.7.0 from Virtualization repository”

IMO that mail list item suffers from the same problems I outlined above although he did seem to try some additional important things (the Spice protocol).

  • Comparing different class USB devices
  • No errors to work with.
  • But, he did do something right, he identified the vendor and product IDs and tried to work with them.

As I suggested, your first step really should be to approach the Vendor of your device and ask them if they know of <any> instance their device has been used with <any> virtualization technology. If you can at least get a verification it <can> work then it’s worth investing more effort.

BTW - I do recommend signing up for that mail list and trying there, too. A different set of eyeballs and some of them are quite skilled in xen.

IMO,
TSU

As mentioned earlier in the thread, I already tested the device with VirtualBox, where it works perfectly out of the box without any special configuration. But I will ask them about kvm.

BTW - I do recommend signing up for that mail list and trying there, too. A different set of eyeballs and some of them are quite skilled in xen.

I’m subscribed (for a long time) to that mailing list, and replied to that thread, with a link to this thread, but no response so far…

If you’re sure it’s working in VBox, you can try looking <very deep> at how the device is recognized.
No guarantees, but often times at a very low level virtualization technologies sometimes operate the same.

TSU

As a long time (open)Suse and virtualization user, I must disagree: there are very justifiable reasons to run even storage devices in passthrough mode (for eg. testing boot disks).

Also, it should not matter if the host OS has drivers for USB device being redirected to guest. Even mode, host must not have any drivers active for that device, and any device should work that way. (and they worked for me in Virtualbox and VMware, but I have stopped using then almost completely since I found KVM, still running only 2 VB because of USB passtrough not working in latest KVM, same error as OP)

Now, about the OP problem: it seems to me very much like http://comments.gmane.org/gmane.linux.pve.devel/5615 , but I could not find any libusb newer than 1.0.12 found in http://software.opensuse.org/package/libusb (must “show unstable packages”).

There is something called “libusbX” http://software.opensuse.org/package/libusbx but I don’t know if that is interchangeable (and not in the mood of destroying my installation just yet). Can somebody confirm or deny this?

Best regards,
Sinisa Bandin

I wouldn’t disagree that there probably are <some> odd scenarios which require USB pass-through, but most of them generally fall in the category “because ordinary USB support doesn’t work” or the application requires direct hardware access, eg pen testing using a USB NIC where you need to modify the NIC properties (in the old days you needed this to enable promiscuous mode, but all my NICs have been enabled for over 5 yrs now). If a USB dongle provides certificates required for a hardware (even virtual hardware) to load, then I can envision special USB pass-through for that, too.

I can’t think of a “test boot disk” scenario that would require direct USB access, all virtualization I’ve used configure boot devices differently than “normal” USB device connectivity (after the OS loads which if Linux utilizes udev today) very much like bare hardware.

There may be a small window today where direct USB support may be lacking, from another concurrent thread in this forum http://forums.opensuse.org/showthread.php/495453-Attaching-USB?p=2624749#post2624749

TSU

I already filed a bug ticket almost related to this see link https://bugzilla.novell.com/show_bug.cgi?id=863933 . On the other hand it start when you can’t attach a usb when the vm is already running using attach-device. I filed a bug and confirmed that it is. But when you update the libvirt and other virtualization stuff using the virtualization repo. There goes the second problem where you can’t passthrough a usb device even the vm is not running at all. So I guess it will take more time in this.