Linux

Installation of VirtualBox on Ubuntu: Detailed Guide

This guide will help you quickly and correctly install VirtualBox on Ubuntu. You'll learn how to add the official repository, install packages and extensions, and resolve common kernel module issues.

Updated at February 16, 2026
10-15 min
Medium
FixPedia Team
Применимо к:Ubuntu 22.04 LTSUbuntu 24.04 LTSDebian 11/12

Introduction / Why This Is Needed

VirtualBox is a free, powerful Type 2 hypervisor that allows you to run multiple guest operating systems (Windows, Linux, macOS, Solaris) on a single computer. Installing it on Ubuntu is a routine task, but it requires attention to detail, especially regarding kernel module compatibility. After completing this guide, you will have a fully functional virtual machine with USB support and other extensions.

Requirements / Preparation

Before you begin, ensure that:

  • You have Ubuntu 22.04 LTS or newer installed (the instructions also work for recent versions of Debian).
  • You have access to an account with sudo privileges.
  • Your system is updated: sudo apt update && sudo apt upgrade -y.
  • Important: The dkms (Dynamic Kernel Module Support) package must be installed. It is usually present by default, but you can check with:
    dpkg -l dkms | grep -q dkms || echo "DKMS is not installed. Install it with: sudo apt install dkms"
    

Step-by-Step Guide

Step 1: Add the Official Oracle Repository

The Ubuntu repository often contains outdated versions of VirtualBox. Let's add the official source from Oracle.

  1. Import the Oracle GPG key:
    wget -O- https://www.virtualbox.org/download/oracle_vbox_2016.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/virtualbox-archive-keyring.gpg > /dev/null
    
  2. Add the repository to your system. For Ubuntu 22.04 (jammy) and 24.04 (noble):
    echo "deb [arch=amd64 signed-by=/usr/share/keyrings/virtualbox-archive-keyring.gpg] https://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib" | sudo tee /etc/apt/sources.list.d/virtualbox.list
    

Step 2: Update and Install VirtualBox

After adding the repository, install the main package and the package for working with kernel modules (dkms).

sudo apt update
sudo apt install virtualbox virtualbox-dkms -y

What happens:

  • virtualbox — the main package with the graphical interface and CLI.
  • virtualbox-dkms — a critically important package. It automatically rebuilds kernel modules (vboxdrv, vboxnetflt, etc.) on every kernel update, preventing the "Kernel driver not installed" error.

Step 3: Install the Extension Pack

The Extension Pack adds support for USB 2.0/3.0, RDP, encryption, and other features. Download the latest version from the official website or install it via the command line.

# Download the latest Extension Pack (version may differ)
wget https://download.virtualbox.org/virtualbox/7.0.12/Oracle_VM_VirtualBox_Extension_Pack-7.0.12.vbox-extpack

# Install it. You will be asked if you accept the license agreement. Press Enter, then 'y'.
sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-7.0.12.vbox-extpack

💡 Tip: Install the Extension Pack with the exact same version as your VirtualBox. Check the version with: virtualbox --help | head -1.

Step 4: Configure User Permissions

To work with USB devices and some other features, your user must be a member of the vboxusers group.

sudo usermod -aG vboxusers $USER

Important: This change takes effect after you log out and log back in (or reboot). Without this, you won't be able to connect a USB flash drive or use certain settings.

Step 5: Verify the Installation

  1. Launch VirtualBox from the applications menu or with the virtualbox command.
  2. In the menu, select File -> Preferences -> Extensions. You should see the installed Extension Pack.
  3. Create a test virtual machine (e.g., with an Ubuntu ISO) and ensure it starts.
  4. Check that kernel modules are loaded:
    lsmod | grep vbox
    
    The output should include vboxdrv, vboxnetflt, vboxnetadp, etc.

Verification of Results

A successful installation is confirmed by:

  • Launching the VirtualBox graphical interface without errors.
  • The presence of a default virtual machines folder path in File -> Preferences -> General.
  • The presence of the Extension Pack entry in File -> Preferences -> Extensions.
  • The ability to create and run a virtual machine.
  • Working USB redirection (if the Extension Pack is installed).

Potential Issues

Error: "No access to /dev/vboxdrv" or "Kernel driver not installed (rc=-1908)"

Cause: Kernel modules are not loaded or the user is not in the vboxusers group. Solution:

  1. Ensure you ran sudo usermod -aG vboxusers $USER and have logged out/in.
  2. Reinstall the DKMS modules:
    sudo apt install --reinstall virtualbox-dkms
    sudo dpkg-reconfigure virtualbox-dkms
    
  3. Force a module build:
    sudo /sbin/vboxconfig
    

Error: "The VirtualBox kernel modules do not match this version of VirtualBox"

Cause: The versions of VirtualBox and virtualbox-dkms differ (often after a partial update). Solution: Completely reinstall VirtualBox from a single source:

sudo apt purge virtualbox virtualbox-*
sudo apt install virtualbox virtualbox-dkms

Extension Pack Does Not Appear in the List

Cause: An Extension Pack of a different version is installed, or the license agreement was not accepted. Solution:

  1. Check the version: VBoxManage --version.
  2. Remove the old Extension Pack: sudo VBoxManage extpack uninstall "Oracle VM VirtualBox Extension Pack".
  3. Reinstall it, downloading the package with the exact same version.

3D Graphics Acceleration Issues in the Guest OS

Cause: Guest Additions are not installed or are incompatible. Solution: In the running virtual machine, open the menu Devices -> Insert Guest Additions CD image.... Inside the guest system (e.g., Ubuntu), run:

# For an Ubuntu/Debian guest system
sudo apt update
sudo apt install build-essential dkms linux-headers-$(uname -r)
sudo sh /media/cdrom/VBoxLinuxAdditions.run

Reboot the guest system.

DKMS Build Error: "module verification failed: signature and/or required key missing"

Cause: Kernel module signature verification is enabled (Secure Boot). Solution:

  • Option 1 (simpler): Disable Secure Boot in your UEFI/BIOS.
  • Option 2 (without disabling): On the first DKMS install/build, you will need to enter a MOK (Machine Owner Key) password that you set. After rebooting, the system will prompt you to enroll the key. Follow the on-screen instructions.

F.A.Q.

Why does VirtualBox fail to start after an Ubuntu kernel update?
Can VirtualBox be installed from Ubuntu's standard repositories?
What is VirtualBox Extension Pack and why is it needed?
How to install Guest Additions on a guest Ubuntu?

Hints

Adding Oracle's official repository
Updating package list and installing VirtualBox
Installing Extension Pack
Adding the current user to the vboxusers group
FixPedia

Free encyclopedia for fixing errors. Step-by-step guides for Windows, Linux, macOS and more.

© 2026 FixPedia. All materials are available for free.

Made with for the community