usb is not available as normal user

Bug #60273 reported by stefab
This bug report is a duplicate of:  Bug #156085: Could not open /proc/bus/usb/devices. Edit Remove
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
kvm (Ubuntu)
Confirmed
Wishlist
TJ
qemu (Ubuntu)
Confirmed
Wishlist
TJ

Bug Description

Only launching qemu with sudo or as root i could manage usb devices. As usability issue there could be a workaround changing permission of usb devices (proc) in fstab or use some other workaround so normal user can manage usb devices in qemu.
See also this: http://fabrice.bellard.free.fr/qemu/qemu-doc.html#SEC28

Revision history for this message
Peter Whittaker (pwwnow) wrote :

From reading http://fabrice.bellard.free.fr/qemu/qemu-doc.html#TOC35, it appears that root privileges are required to do this, so qemu appears to be working properly. Marking as rejected.

Changing this would require non-trivial system changes, which require an accompanying specification. Please look into writing or working with others on such a spec.

Thanks!

Changed in qemu:
status: Unconfirmed → Rejected
Revision history for this message
TJ (tj) wrote :

I'm working with Gutsy and kvm/qemu. I got around this by modifying the permission rule in

/etc/udev/rules.d/40-permissions.rules

I added GROUP="plugdev" so that the USB devices are members of that group:

# USB devices (usbfs replacement)
SUBSYSTEM=="usb_device", MODE="0664", GROUP="plugdev"

Regular user accounts are usually members of that group, which means that qemu/kvm can be run as a regular user and access the USB devices:

$ sudo /etc/init.d/udev reload
$ sudo find /dev/bus/usb -exec ls -l {} \; | grep plugdev
crw-rw-r-- 1 root plugdev 189, 141 2007-10-31 18:58 014
crw-rw-r-- 1 root plugdev 189, 142 2007-10-31 18:58 015
crw-rw-r-- 1 root plugdev 189, 143 2007-10-31 19:29 016
crw-rw-r-- 1 root plugdev 189, 144 2007-10-31 19:34 017
crw-rw-r-- 1 root plugdev 189, 145 2007-10-31 18:58 018
crw-rw-r-- 1 root plugdev 189, 146 2007-10-31 18:58 019
crw-rw-r-- 1 root plugdev 189, 146 2007-10-31 18:58 /dev/bus/usb/002/019
crw-rw-r-- 1 root plugdev 189, 145 2007-10-31 18:58 /dev/bus/usb/002/018
crw-rw-r-- 1 root plugdev 189, 144 2007-10-31 19:34 /dev/bus/usb/002/017
crw-rw-r-- 1 root plugdev 189, 143 2007-10-31 19:29 /dev/bus/usb/002/016
crw-rw-r-- 1 root plugdev 189, 142 2007-10-31 18:58 /dev/bus/usb/002/015
crw-rw-r-- 1 root plugdev 189, 141 2007-10-31 18:58 /dev/bus/usb/002/014

A group could be created specifically for qemu/kvm but using plugdev makes more sense since it is there to provide support for hot-plugged devices.

Revision history for this message
TJ (tj) wrote :

I'm investigating options to allow qemu/kvm safe access to the USB devices.

The options seem to be (in increasing order of complexity:

1. Modify the udev rule as described here but as a general change to udev is not really a general solution for a pre-packaged solution.
2. Add a wrapper script to the qemu & kvm packages that adds the udev modification just whilst qemu/kvm is running, and removes it after.
3. Add a USB daemon to the qemu/kvm package that runs as root and communicates over dbus with the qemu/kvm user process.

Changed in kvm:
assignee: nobody → intuitivenipple
importance: Undecided → Wishlist
status: New → Confirmed
Changed in qemu:
assignee: nobody → intuitivenipple
importance: Undecided → Wishlist
status: Invalid → Confirmed
Revision history for this message
Daniel Gimpelevich (daniel-gimpelevich) wrote :

This bug is not exclusive to qemu/kvm; it affects any software that deals with USB devices in userspace. I consider any USB /dev node not group-owned by plugdev to be a release-critical bug. You should put the following command into some kind of cron job:

ls -gR /dev/usb* /dev/bus/usb|grep -v ^d|grep -qv plugdev && echo Bug 60273 is not fixed!

Revision history for this message
Dustin Kirkland  (kirkland) wrote :

I've marked this bug (Bug #60273) a duplicate of Bug #156085, which has far more detail, and TJ has provided links to PPA packages of his which are trying to fix this problem.

:-Dustin

Revision history for this message
Stephen Parry (sgparry) wrote :

Eh? This bug (https://bugs.launchpad.net/bugs/60273<a href="https://bugs.launchpad.net/bugs/60273">https://bugs.launchpad.net/bugs/60273</a>) is about permissions in /dev/bus/usb the other (<a href="https://bugs.launchpad.net/bugs/156085">bug #156085</a>was about /proc/bus/usb/devices becoming obsolete. The bugs are largely unrelated. Please re-open!

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.