Comment 34 for bug 156085

Revision history for this message
Rui Bernardo (epimeteo) wrote :

I was trying to use QEMU with USB in Ubuntu 7.10 Gutsy when I found this bug. I comment out the magic lines in /etc/init.d/mountdevsubfs.sh, started it, but still couldn't use USB in QEMU. Everything inside /proc/bus/usb/ and /dev/bus/usb was owned by root and QEMU couldn't read/write in it. I searched the web for something to change /dev/bus/usb/ and /proc/bus/usb/ permissions. QEMU docs says to "chown -R" all /proc/bus/usb/ and this was a problem since it "doesn't exist".

I found this: http://www.ubuntu1501.com/2007/12/installing-virtualbox-with-usb-support.html and adapted it to QEMU.

Basicaly, I added a new system group called "usbusers", added my username to that new system group and added a line in /etc/fstab setting the GID of /proc/bus/usb. I didn't need to change /etc/udev/rules.d/40-permissions.rules! All the process:

# Edit, uncomment "magic" and start the file /etc/init.d/mountdevsubfs.sh

# Create a system group for usb users:
sudo addgroup --system usbusers
# Output was GID 128

# Add user to usbusers group:
sudo adduser $USER usbusers

# With the lines in /etc/init.d/mountdevsubfs.sh comment out,
# edit /etc/fstab:
sudo nano /etc/fstab

# Add the following line:
# 128 is the GID of the group "usbusers".
none /proc/bus/usb usbfs devgid=128,devmode=664 0 0

# Reboot. After restarting the group owner of the devices were "usbusers":
$ ls -la /proc/bus/usb/
total 0
drwxr-xr-x 7 root root 0 2008-03-11 14:45 .
dr-xr-xr-x 5 root root 0 2008-03-11 14:46 ..
dr-xr-xr-x 2 root root 0 2008-03-11 14:45 001
dr-xr-xr-x 2 root root 0 2008-03-11 14:45 002
dr-xr-xr-x 2 root root 0 2008-03-11 14:45 003
dr-xr-xr-x 2 root root 0 2008-03-11 14:45 004
dr-xr-xr-x 2 root root 0 2008-03-11 14:45 005
-r--r--r-- 1 root root 0 2008-03-11 14:45 devices

$ ls -la /proc/bus/usb/003
total 0
dr-xr-xr-x 2 root root 0 2008-03-11 14:45 .
drwxr-xr-x 7 root root 0 2008-03-11 14:45 ..
-rw-rw-r-- 1 root usbusers 43 2008-03-11 14:45 001

# Eject the USB device in Gnome before using QEMU!
# Run QEMU with the option "-usb" or "-usbdevice host:1234:5678".

This was the way I got this working 100%.