Enabling USB Device Support in VirtualBox for Ubuntu Virtual Machines
To use USB devices (e.g., flash drives, cameras) in an Ubuntu virtual machine (VM) hosted on VirtualBox, you need to configure USB controller settings, adjust user permissions, and ensure proper installation of VirtualBox extensions. Below are the step-by-step requirements and solutions:
1. Install VirtualBox Extension Pack
The VirtualBox Extension Pack is required to enable USB 2.0/3.0 support (critical for faster data transfer with modern devices).
- Download the Extension Pack from Oracle’s official website (ensure compatibility with your VirtualBox version).
- Open VirtualBox, go to File → Preferences → Extensions, and add the downloaded file. Restart VirtualBox to apply changes.
2. Enable USB Controller in VM Settings
Before connecting a USB device, configure the VM to recognize USB controllers:
- Shut down the Ubuntu VM.
- Select the VM in VirtualBox Manager, click Settings → USB.
- Check Enable USB Controller and select the appropriate version (e.g., “USB 2.0 (EHCI) Controller” for USB 2.0 devices; “USB 3.0 (xHCI) Controller” for USB 3.0 devices).
- Click OK to save settings.
3. Add User to vboxusers Group
By default, VirtualBox runs with restricted permissions, preventing direct access to USB devices. Adding your user to the vboxusers group grants the necessary access:
- Open a terminal and run one of the following commands (replace
$USERwith your username if needed):orsudo usermod -aG vboxusers $USERsudo gpasswd --add $USER vboxusers - Log out and log back in (or restart your computer) for the group change to take effect.
4. Connect the USB Device to the VM
Once the above steps are complete, connect the USB device to the VM:
- Start the Ubuntu VM.
- In the VirtualBox window, click the USB icon in the bottom toolbar (or go to Devices → USB).
- Select the connected USB device from the list (e.g., “SanDisk Cruzer Blade”). The device will now be accessible in the Ubuntu VM.
5. Access the USB Device in Ubuntu
Ubuntu typically auto-mounts USB devices to the desktop or file manager. If not:
- Open a terminal and run
lsblkto identify the device (e.g.,/dev/sdb1). - Create a mount point (e.g.,
/mnt/usb) and mount the device:sudo mkdir /mnt/usb sudo mount /dev/sdb1 /mnt/usb - Access the device via the
/mnt/usbdirectory. To unmount, usesudo umount /mnt/usb.
Troubleshooting Common Issues
- USB Device Not Listed: Ensure the Extension Pack is installed, the VM has the correct USB controller enabled, and the user is part of the
vboxusersgroup. Restart VirtualBox and the VM after making changes. - Permission Denied: Double-check group membership (
groups $USERto verify) and ensure the device is not mounted on the host OS before connecting it to the VM.
By following these steps, you can successfully enable USB device support in VirtualBox for Ubuntu VMs, allowing seamless access to external storage, peripherals, and other USB-enabled devices.
以上就是关于“VirtualBox Ubuntu虚拟机USB设备支持”的相关介绍,筋斗云是国内较早的云主机应用的服务商,拥有10余年行业经验,提供丰富的云服务器、租用服务器等相关产品服务。云服务器资源弹性伸缩,主机vCPU、内存性能强悍、超高I/O速度、故障秒级恢复;电子化备案,提交快速,专业团队7×24小时服务支持!
简单好用、高性价比云服务器租用链接:https://www.jindouyun.cn/product/cvm