Virtual USB and VBoxusergroup Troubleshoot on Linux Host Rumi, December 16, 2011December 16, 2011 I faced USB issues on both Virtualbox installation on both Debian and CentOS linux host. I really didn't notice the urgency of vboxusers group in running VBox in headless mode! Anyway, following snippets of texts really did help me out solving my USB problems. All credits goes to the VBox manual documents. The manual page links are provided below for future refences- USB settings The "USB" section in a virtual machine's Settings window allows you to configure VirtualBox's sophisticated USB support. VirtualBox can allow virtual machines to access the USB devices on your host directly. To achieve this, VirtualBox presents the guest operating system with a virtual USB controller. As soon as the guest system starts using a USB device, it will appear as unavailable on the host. Note Be careful with USB devices that are currently in use on the host! For example, if you allow your guest to connect to your USB hard disk that is currently mounted on the host, when the guest is activated, it will be disconnected from the host without a proper shutdown. This may cause data loss. Solaris hosts have a few known limitations regarding USB support; please see Chapter 14, Known limitations. In addition to allowing a guest access to your local USB devices, VirtualBox even allows your guests to connect to remote USB devices by use of the VirtualBox Remote Desktop Extension (VRDE). For details about this, see the section called “Remote USB”. In the Settings dialog, you can first configure whether USB is available in the guest at all, and in addition also optionally enable the USB 2.0 (EHCI) controller for the guest. If so, you can determine in detail which devices are available. For this, you must create so-called "filters" by specifying certain properties of the USB device. Note The EHCI controller is shipped as a VirtualBox extension package, which must be installed separately. See the section called “Installing VirtualBox and extension packs” for more information. Clicking on the "+" button to the right of the "USB Device Filters" window creates a new filter. You can give the filter a name (for referencing it later) and specify the filter criteria. The more criteria you specify, the more precisely devices will be selected. For instance, if you specify only a vendor ID of 046d, all devices produced by Logitech will be available to the guest. If you fill in all fields, on the other hand, the filter will only apply to a particular device model from a particular vendor, and not even to other devices of the same type with a different revision and serial number. In detail, the following criteria are available: Vendor and product ID. With USB, each vendor of USB products carries an identification number that is unique world-wide, the "vendor ID". Similarly, each line of products is assigned a "product ID" number. Both numbers are commonly written in hexadecimal (that is, they are composed of the numbers 0-9 and the letters A-F), and a colon separates the vendor from the product ID. For example, 046d:c016 stands for Logitech as a vendor, and the "M-UV69a Optical Wheel Mouse" product. Alternatively, you can also specify "Manufacturer" and "Product" by name. To list all the USB devices that are connected to your host machine with their respective vendor and product IDs, you can use the following command (see Chapter 8, VBoxManage): VBoxManage list usbhost On Windows, you can also see all USB devices that are attached to your system in the Device Manager. On Linux, you can use the lsusb command. Serial number. While vendor and product ID are already quite specific to identify USB devices, if you have two identical devices of the same brand and product line, you will also need their serial numbers to filter them out correctly. Remote. This setting specifies whether the device will be local only, or remote only (over VRDP), or either. On a Windows host, you will need to unplug and reconnect a USB device to use it after creating a filter for it. As an example, you could create a new USB filter and specify a vendor ID of 046d (Logitech, Inc), a manufacturer index of 1, and "not remote". Then any USB devices on the host system produced by Logitech, Inc with a manufacturer index of 1 will be visible to the guest system. Several filters can select a single device — for example, a filter which selects all Logitech devices, and one which selects a particular webcam. You can deactivate filters without deleting them by clicking in the checkbox next to the filter name. Implementation notes for Windows and Linux hosts On Windows hosts, a kernel mode device driver provides USB proxy support. It implements both a USB monitor, which allows VirtualBox to capture devices when they are plugged in, and a USB device driver to claim USB devices for a particular virtual machine. As opposed to VirtualBox versions before 1.4.0, system reboots are no longer necessary after installing the driver. Also, you no longer need to replug devices for VirtualBox to claim them. On newer Linux hosts, VirtualBox accesses USB devices through special files in the file system. When VirtualBox is installed, these are made available to all users in the vboxusers system group. In order to be able to access USB from guest systems, make sure that you are a member of this group. On older Linux hosts, USB devices are accessed using the usbfs file system. Therefore, the user executing VirtualBox needs read and write permission to the USB file system. Most distributions provide a group (e.g. usbusers) which the VirtualBox user needs to be added to. Also, VirtualBox can only proxy to virtual machines USB devices which are not claimed by a Linux host USB driver. The Driver= entry in /proc/bus/usb/devices will show you which devices are currently claimed. Please refer to the section called “USB not working” also for details about usbfs. (http://www.virtualbox.org/manual/ch03.html#idp11184832) The vboxusers group The Linux installers create the system user group vboxusers during installation. Any system user who is going to use USB devices from VirtualBox guests must be a member of that group. A user can be made a member of the group vboxusers through the GUI user/group management or at the command line with sudo usermod -a -G vboxusers username Note that adding an active user to that group will require that user to log out and back in again. This should be done manually after successful installation of the package. Starting VirtualBox on Linux The easiest way to start a VirtualBox program is by running the program of your choice (VirtualBox, VBoxManage, VBoxSDL or VBoxHeadless) from a terminal. These are symbolic links to VBox.sh that start the required program for you. The following detailed instructions should only be of interest if you wish to execute VirtualBox without installing it first. You should start by compiling the vboxdrv kernel module (see above) and inserting it into the Linux kernel. VirtualBox consists of a service daemon (VBoxSVC) and several application programs. The daemon is automatically started if necessary. All VirtualBox applications will communicate with the daemon through Unix local domain sockets. There can be multiple daemon instances under different user accounts and applications can only communicate with the daemon running under the user account as the application. The local domain socket resides in a subdirectory of your system's directory for temporary files called .vbox-<username>-ipc. In case of communication problems or server startup problems, you may try to remove this directory. All VirtualBox applications (VirtualBox, VBoxSDL, VBoxManage and VBoxHeadless) require the VirtualBox directory to be in the library path: LD_LIBRARY_PATH=. ./VBoxManage showvminfo "Windows XP" (http://www.virtualbox.org/manual/ch02.html#idp5640240) USB not working If USB is not working on your Linux host, make sure that the current user is a member of the vboxusers group. On older hosts, you need to make sure that the user has permission to access the USB filesystem (usbfs), which VirtualBox relies on to retrieve valid information about your host's USB devices. The rest of this section only applies to those older systems. As usbfs is a virtual filesystem, a chmod on /proc/bus/usb has no effect. The permissions for usbfs can therefore only be changed by editing the /etc/fstab file. For example, most Linux distributions have a user group called usb or similar, of which the current user must be a member. To give all users of that group access to usbfs, make sure the following line is present: # 85 is the USB group none /proc/bus/usb usbfs devgid=85,devmode=664 0 0 Replace 85 with the group ID that matches your system (search /etc/group for "usb" or similar). Alternatively, if you don't mind the security hole, give all users access to USB by changing "664" to "666". The various distributions are very creative from which script the usbfs filesystem is mounted. Sometimes the command is hidden in unexpected places. For SuSE 10.0 the mount command is part of the udev configuration file /etc/udev/rules.d/50-udev.rules. As this distribution has no user group called usb, you may e.g. use the vboxusers group which was created by the VirtualBox installer. Since group numbers are allocated dynamically, the following example uses 85 as a placeholder. Modify the line containing (a linebreak has been inserted to improve readability) DEVPATH="/module/usbcore", ACTION=="add", RUN+="/bin/mount -t usbfs usbfs /proc/bus/usb" and add the necessary options (make sure that everything is in a single line): DEVPATH="/module/usbcore", ACTION=="add", RUN+="/bin/mount -t usbfs usbfs /proc/bus/usb -o devgid=85,devmode=664" Debian Etch has the mount command in /etc/init.d/mountkernfs.sh. Since that distribution has no group usb, it is also the easiest solution to allow all members of the group vboxusers to access the USB subsystem. Modify the line domount usbfs usbdevfs /proc/bus/usb -onoexec,nosuid,nodev so that it contains domount usbfs usbdevfs /proc/bus/usb -onoexec,nosuid,nodev,devgid=85,devmode=664 As usual, replace the 85 with the actual group number which should get access to USB devices. Other distributions do similar operations in scripts stored in the /etc/init.d directory. (http://www.virtualbox.org/manual/ch12.html#usb_linux) Configurations (Linux) Virtualbox Virtualization virtualbox