On Fri, 2008-12-19 at 13:57 +0000, Daniele Smartango wrote:
> I tried it in Intrepid forcing dependencies, I got:
>
> (qemu) usb_add host:0951:1601
> husb: open device 2.5
> /dev/bus/usb/002/005: Permission denied
Daniele, see the discussion on device-node permissions further back
(2008-09-04 onwards).
The unresolved issue is, no decision has been made on how to set
permissions for KVM/QEMU to access the raw device nodes. By default they
are root:root so when KVM/QEMU are run as a regular user the "Permission
Denied" message is to be expected.
Running KVM/QEMU as root isn't the most desirable solution either.
Until a decision is made on how best to support this the user will need
to choose a method to set permissions manually to allow the user access
to the raw devices.
In my PPA package I added manual instructions to the man-page. I'll
quote it here (Dustin - maybe this is worth adding to the current
lvm/qemu man pages until the permissions issue is resolved?):
USING USB DEVICES
kvm-74 introduced much-improved support for USB host devices, but still expected to find
them in /proc/bus/usb/ which has been deprecated for over a year. The Ubuntu patches added
in 1:74+dfsg-0ubuntu2 provide support for /sys/bus/usb/devices/ and /dev/bus/usb/devices
discovery, and connection via /dev/bus/usb/*/*
kvm must be started with the "-usb" option. From the kvm monitor console (Ctrl+Alt+2 when
the VM Window has grabbed focus - Ctrl+Alt+1 to return to the VM) USB host devices can be
discovered using:
info usbhost
The devices can be added to the guest using, for example:
add_usb host:5.3
If the guest is running as non-root the permissions to /dev/bus/usb/*/* will need altering
to allow the VM read/write access to the USB devices.
Create a new group "vm" and add users that require USB access for VMs to it:
sudo addgroup vm
sudo addgroup $USER vm
Log-out/log-in to effect the new group membership.
Add a udev rule to assign USB devices to the vm group:
# Virtual Machine hypervisor access to USB devices SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="vm" SUBSYSTEM=="usb_device", GROUP="vm"
Save the file as /etc/udev/rules.d/41-vm-usb.rules and reload udevd:
sudo /etc/init.d/udev restart
The guest virtual machines should now be able to access the USB devices without root priv‐
ileges.
On Fri, 2008-12-19 at 13:57 +0000, Daniele Smartango wrote: usb/002/ 005: Permission denied
> I tried it in Intrepid forcing dependencies, I got:
>
> (qemu) usb_add host:0951:1601
> husb: open device 2.5
> /dev/bus/
Daniele, see the discussion on device-node permissions further back
(2008-09-04 onwards).
The unresolved issue is, no decision has been made on how to set
permissions for KVM/QEMU to access the raw device nodes. By default they
are root:root so when KVM/QEMU are run as a regular user the "Permission
Denied" message is to be expected.
Running KVM/QEMU as root isn't the most desirable solution either.
Until a decision is made on how best to support this the user will need
to choose a method to set permissions manually to allow the user access
to the raw devices.
In my PPA package I added manual instructions to the man-page. I'll
quote it here (Dustin - maybe this is worth adding to the current
lvm/qemu man pages until the permissions issue is resolved?):
USING USB DEVICES usb/devices/ and /dev/bus/ usb/devices
kvm-74 introduced much-improved support for USB host devices, but still expected to find
them in /proc/bus/usb/ which has been deprecated for over a year. The Ubuntu patches added
in 1:74+dfsg-0ubuntu2 provide support for /sys/bus/
discovery, and connection via /dev/bus/usb/*/*
kvm must be started with the "-usb" option. From the kvm monitor console (Ctrl+Alt+2 when
the VM Window has grabbed focus - Ctrl+Alt+1 to return to the VM) USB host devices can be
discovered using:
info usbhost
The devices can be added to the guest using, for example:
add_usb host:5.3
If the guest is running as non-root the permissions to /dev/bus/usb/*/* will need altering
to allow the VM read/write access to the USB devices.
Create a new group "vm" and add users that require USB access for VMs to it:
sudo addgroup vm
sudo addgroup $USER vm
Add a udev rule to assign USB devices to the vm group:
# Virtual Machine hypervisor access to USB devices
SUBSYSTEM= ="usb", ENV{DEVTYPE} =="usb_ device" , GROUP="vm"
SUBSYSTEM= ="usb_device" , GROUP="vm"
Save the file as /etc/udev/ rules.d/ 41-vm-usb. rules and reload udevd:
sudo /etc/init.d/udev restart
The guest virtual machines should now be able to access the USB devices without root priv‐
ileges.