VirtualBox Ubuntu虚拟机USB设备支持
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
$USER
with your username if needed):
orsudo usermod -aG vboxusers $USER
sudo 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
lsblk
to 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/usb
directory. 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
vboxusers
group. Restart VirtualBox and the VM after making changes. - Permission Denied: Double-check group membership (
groups $USER
to 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.
声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!
若转载请注明出处: VirtualBox Ubuntu虚拟机USB设备支持
本文地址: https://pptw.com/jishu/716037.html