[Bug 787091] Re: Unable to use USB device in KVM quest

Royston Carter 787091 at bugs.launchpad.net
Wed Jun 29 08:15:37 UTC 2011


Serge,
     See below. The open program opens it and gets file ID 3 as one 
would expect. Whilst running this the VM is outputting the not permitted 
message on the same device. So root can open but libvirt cannot!

root at vmserver:/tmp# lsusb
Bus 008 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 003: ID 04a9:1717 Canon, Inc. MP510
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
root at vmserver:/tmp# ./open /dev/bus/usb/003/003
open returned 3
root at vmserver:/tmp# ./open /dev/bus/usb/003/003
open returned 3
root at vmserver:/tmp#

Regards

Roy

On 29/06/2011 05:39, Serge Hallyn wrote:
> Let's see if we can get root in general to fail to open this.  First
> paste the following into 'open.c' (without the '========' lines), and
> then compile that using 'make open'.
>
> ===============================================================
> #include<stdio.h>
> #include<stdlib.h>
> #include<sys/types.h>
> #include<sys/stat.h>
> #include<fcntl.h>
>
>
> int main(int argc, char *argv[])
> {
> 	int ret;
> 	
> 	if (argc<  2)
> 	{
> 		printf("try %s /dev/bus/usb/001/013\n", argv[0]);
> 		exit(1);
> 	}
> 	ret = open(argv[1], O_RDWR|O_NONBLOCK);
> 	printf("open returned %d\n", ret);
> 	close(ret);
> }
> ===============================================================
>
> Plug in the printer and try starting the VM with libvirt.  Look in the
> log file to get the pathname it is trying to use.  Then run open with
> that file as argument.  For instance if you see
>
> /dev/bus/usb/001/004: Operation not permitted
>
> then try
>
>    sudo ./open /dev/bus/usb/001/004
>
> If it says it returned a positive number, then it succeeded in opening
> it.  If it returned -1, then we know that in fact root can't open that
> device, and it isn't just libvirt.
>

-- 
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to qemu-kvm in Ubuntu.
https://bugs.launchpad.net/bugs/787091

Title:
  Unable to use USB device in KVM quest

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/qemu-kvm/+bug/787091/+subscriptions



More information about the Ubuntu-server-bugs mailing list