Skip to the content.

Complete Guide to VirtualBox Installation and USB Configuration on Ubuntu

1. Installing Oracle VirtualBox

1.1 Add Oracle VirtualBox Repository

# Add Oracle VirtualBox GPG key
wget -O- https://www.virtualbox.org/download/oracle_vbox_2016.asc | sudo gpg --dearmor --yes --output /usr/share/keyrings/oracle-virtualbox-2016.gpg
# Add the repository
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/oracle-virtualbox-2016.gpg] https://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib" | sudo tee /etc/apt/sources.list.d/virtualbox.list

1.2 Install VirtualBox

# Update package list
sudo apt update
# Install VirtualBox
sudo apt install virtualbox-7.0

2. Prerequisites Check

# Verify user groups
groups $USER
# Add user to vboxusers group
sudo adduser $USER vboxusers

3. Install VirtualBox Extension Pack

# Update package list
sudo apt update
# Install Extension Pack
sudo apt install virtualbox-ext-pack

4. Troubleshooting Installation Issues

4.1 Complete Reinstallation Process

# Kill VirtualBox processes
sudo killall VirtualBox
sudo killall VBoxSVC

# Remove existing installation
sudo apt remove --purge virtualbox* virtualbox-*
sudo apt autoremove

# Clean configuration files
sudo rm -rf ~/.config/VirtualBox/
sudo rm -rf /etc/vbox/

# Fresh installation
sudo apt update
sudo apt install virtualbox virtualbox-ext-pack

# Rebuild kernel modules
sudo /sbin/vboxconfig

5. USB Configuration in VirtualBox

5.1 GUI Configuration

  1. Open VirtualBox
  2. Select your virtual machine
  3. Go to Settings > USB
  4. Enable USB Controller
  5. Select USB 2.0 (EHCI) or USB 3.0 (xHCI) Controller

5.2 Connecting USB Devices

  1. Start your virtual machine
  2. Click the USB icon at the bottom of VirtualBox window
  3. Select your USB device from the list

6. Verification and Testing

# Check USB devices in host system
lsusb
# Verify VirtualBox installation
virtualbox --help

Common Issues and Solutions

Error: VirtualBox is Currently Running

# Stop VirtualBox processes
sudo killall VirtualBox
sudo killall VBoxSVC

Error: Kernel Modules Not Loaded

# Rebuild kernel modules
sudo /sbin/vboxconfig

Important Notes

System Requirements