How to Install VirtualBox on Linux Mint

VirtualBox is Oracleโ€™s free and open-source virtualization software that allows you to run multiple operating systems on a single machine. Whether you need to test software in isolated environments, run Windows applications, experiment with other Linux distributions, or develop across different platforms, VirtualBox provides a straightforward solution. This guide walks you through installing VirtualBox on Linux Mint using Oracleโ€™s official APT repository, which ensures you receive the latest stable releases and security updates.

By the end of this guide, you will have a fully functional VirtualBox installation with the Extension Pack for USB 2.0/3.0 support, disk encryption, and other advanced features. To begin, open a terminal from the applications menu.

Understanding Linux Mint and Ubuntu Codenames

Linux Mint is based on Ubuntu, and most third-party repositories (including Oracleโ€™s VirtualBox repository) use Ubuntu codenames rather than Mint codenames. Before adding the repository, identify which Ubuntu codename matches your Linux Mint version:

Linux Mint VersionMint CodenameUbuntu BaseUbuntu Codename
Linux Mint 22.xWilma, Xia, Zara, ZenaUbuntu 24.04 LTSnoble
Linux Mint 21.xVanessa, Vera, Victoria, VirginiaUbuntu 22.04 LTSjammy

You can verify your Mint version by running lsb_release -a in the terminal. The commands in this guide provide separate blocks for each supported version, so you can copy the correct one for your system.

Prepare Your System for VirtualBox Installation

Update Package Information

Before installing new software, refresh your package lists to ensure you have access to the latest versions of all packages. This step also helps prevent dependency conflicts during installation.

sudo apt update && sudo apt upgrade

The apt update command downloads the latest package information from all configured repositories, while apt upgrade applies any available updates to your installed packages.

Install Required Dependencies

Next, VirtualBox requires kernel headers and DKMS (Dynamic Kernel Module Support) to compile its kernel modules. These modules are essential for VirtualBox to interact with your hardware and run virtual machines. Install the dependencies with:

sudo apt install dkms linux-headers-$(uname -r) curl ca-certificates -y

Specifically, this command installs:

  • dkms โ€“ Automatically rebuilds kernel modules when you update your kernel
  • linux-headers-$(uname -r) โ€“ Header files matching your current kernel version, required for module compilation
  • curl and ca-certificates โ€“ Secure file downloads for the GPG key import

Add the VirtualBox APT Repository

Import Oracleโ€™s GPG Signing Key

First, APT uses GPG keys to verify that packages come from trusted sources. Import Oracleโ€™s official signing key to authenticate VirtualBox packages:

curl -fsSL https://www.virtualbox.org/download/oracle_vbox_2016.asc | sudo gpg --dearmor -o /usr/share/keyrings/virtualbox.gpg

This command downloads the key from Oracleโ€™s website, converts it to the binary format APT expects, and stores it in the system keyring directory. The -fsSL flags ensure curl fails silently on errors, follows redirects, and shows no progress output.

Configure the VirtualBox Repository

Next, add Oracleโ€™s official repository to your system. Use the command that matches your Linux Mint version:

Linux Mint 22.x (Ubuntu 24.04 noble):

cat <<'EOF' | sudo tee /etc/apt/sources.list.d/virtualbox.sources
Types: deb
URIs: https://download.virtualbox.org/virtualbox/debian
Suites: noble
Components: contrib
Signed-By: /usr/share/keyrings/virtualbox.gpg
EOF

Linux Mint 21.x (Ubuntu 22.04 jammy):

cat <<'EOF' | sudo tee /etc/apt/sources.list.d/virtualbox.sources
Types: deb
URIs: https://download.virtualbox.org/virtualbox/debian
Suites: jammy
Components: contrib
Signed-By: /usr/share/keyrings/virtualbox.gpg
EOF

After adding the repository, update your package lists to include the new VirtualBox packages:

sudo apt update

You should see output indicating the new repository was fetched successfully:

Get:1 https://download.virtualbox.org/virtualbox/debian noble InRelease [4,445 B]
Get:2 https://download.virtualbox.org/virtualbox/debian noble/contrib amd64 Packages [1,830 B]

Choose Your VirtualBox Version

Oracle maintains multiple VirtualBox release branches simultaneously. As a result, the repository provides several versions, each with different trade-offs:

PackageVersionStatusBest For
virtualbox-7.27.2.xCurrent stableMost users; recommended for new installations
virtualbox-7.17.1.xPrevious stableUsers with existing 7.1 VMs or preferring proven releases

For most users, virtualbox-7.2 is recommended because it provides the latest stable features while receiving regular maintenance and security updates. This version includes full VM encryption, secure boot support, improved DirectX 11 performance on Linux hosts, and a redesigned virtual machine wizard.

Install VirtualBox

With the repository configured, install VirtualBox along with your kernel headers:

sudo apt install virtualbox-7.2 linux-headers-$(uname -r) -y

If you prefer an older release, replace virtualbox-7.2 with virtualbox-7.1 in the command above.

During installation, DKMS automatically compiles the VirtualBox kernel modules for your running kernel. Consequently, this process may take a minute or two depending on your systemโ€™s speed.

Verify the Installation Source

After installation, confirm that VirtualBox was installed from Oracleโ€™s repository rather than the distributionโ€™s default packages:

apt-cache policy virtualbox-7.2

The output should show the package coming from download.virtualbox.org:

virtualbox-7.2:
  Installed: 7.2.x-xxxxxx~Ubuntu~noble
  Candidate: 7.2.x-xxxxxx~Ubuntu~noble
  Version table:
 *** 7.2.x-xxxxxx~Ubuntu~noble 500
        500 https://download.virtualbox.org/virtualbox/debian noble/contrib amd64 Packages
        100 /var/lib/dpkg/status

Notably, the key confirmation is that the package comes from download.virtualbox.org rather than the distributionโ€™s default repositories. Mint 21 users will see jammy instead of noble in the output.

Check the VirtualBox Kernel Module Status

VirtualBox uses a kernel module called vboxdrv to interface with hardware virtualization features. Verify that the module loaded correctly:

systemctl status vboxdrv

A successful installation shows the service as loaded and active:

โ— vboxdrv.service - VirtualBox Linux kernel module
     Loaded: loaded (/lib/modules-load.d/virtualbox.conf; static)
     Active: active (exited) since [date]; [time] ago
    Process: [PID] ExecStart=/sbin/vboxconfig (code=exited, status=0/SUCCESS)
   Main PID: [PID] (code=exited, status=0/SUCCESS)
        CPU: [duration]

If the service is not running, start and enable it with:

sudo systemctl enable vboxdrv --now

Install the VirtualBox Extension Pack

Additionally, the VirtualBox Extension Pack adds features not included in the open-source base package, including USB 2.0/3.0 support, VirtualBox Remote Desktop Protocol (VRDP), disk encryption, and PXE boot for Intel network cards. The Extension Pack is free for personal and educational use under Oracleโ€™s Personal Use and Evaluation License (PUEL).

The Extension Pack version must exactly match your installed VirtualBox version. The commands below automatically detect your installed version and download the matching Extension Pack.

Download and Install the Extension Pack

First, determine your installed VirtualBox version:

VBOX_VERSION=$(vboxmanage -v | cut -dr -f1)
echo "VirtualBox version: $VBOX_VERSION"

Expected output:

VirtualBox version: 7.2.x

Next, download the Extension Pack for your version:

wget "https://download.virtualbox.org/virtualbox/${VBOX_VERSION}/Oracle_VirtualBox_Extension_Pack-${VBOX_VERSION}.vbox-extpack"

Install the Extension Pack using the VirtualBox management command:

sudo vboxmanage extpack install "Oracle_VirtualBox_Extension_Pack-${VBOX_VERSION}.vbox-extpack"

When prompted to accept the license terms, review the license text and type y to proceed:

Expected output:

0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Successfully installed "Oracle VirtualBox Extension Pack".

Verify the Extension Pack Installation

Confirm that the Extension Pack installed correctly:

vboxmanage list extpacks

Expected output:

Extension Packs: 1
Pack no. 0:   Oracle VirtualBox Extension Pack
Version:      7.2.x
Revision:     xxxxxx
Edition:      
Description:  Oracle Cloud Infrastructure integration, Host Webcam, VirtualBox RDP, PXE ROM, Disk Encryption, NVMe, full VM encryption.
VRDE Module:  VBoxVRDP
Crypto Module: VBoxPuelCrypto
Usable:       true 
Why unusable: 

Finally, after verifying the installation, you can remove the downloaded Extension Pack file:

rm "Oracle_VirtualBox_Extension_Pack-${VBOX_VERSION}.vbox-extpack"

Add Your User to the vboxusers Group

To access USB devices and certain hardware features from virtual machines, VirtualBox requires your user account to be a member of the vboxusers group. Add your account to this group:

sudo usermod -aG vboxusers $USER

Normally, group membership changes take effect after you log out and back in. However, to apply the change immediately without logging out, run:

newgrp vboxusers

Verify your group membership:

groups $USER

Expected output includes vboxusers:

username : username adm cdrom sudo dip plugdev lpadmin sambashare vboxusers

Launch VirtualBox

You can launch VirtualBox from the terminal or through your desktop environmentโ€™s application menu.

Launch from Terminal

To start VirtualBox from the command line:

virtualbox

Launch from Applications Menu

To launch VirtualBox using the graphical interface:

  1. Click the applications menu at the bottom-left corner of your screen (or press the Super key).
  2. Type โ€œVirtualBoxโ€ in the search field.
  3. Click Oracle VM VirtualBox to launch the application.

Once launched, the VirtualBox Manager window appears, ready for you to create and manage virtual machines.

Troubleshooting Common Issues

Kernel Module Fails to Load

If VirtualBox reports โ€œKernel driver not installedโ€ or virtual machines fail to start, the kernel module may not have compiled correctly. First, check your kernel and headers:

uname -r
dpkg -l | grep linux-headers-$(uname -r)

If the headers are missing, install them:

sudo apt install linux-headers-$(uname -r)

Then rebuild the VirtualBox kernel modules:

sudo /sbin/vboxconfig

Expected output on success:

vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Starting VirtualBox services.
vboxdrv.sh: Building VirtualBox kernel modules.

Alternatively, if the build fails with errors about missing compilers or make, you need to install build tools. See our GCC installation guide for Linux Mint for complete instructions, or run sudo apt install build-essential to install the essential compilation tools.

Secure Boot Prevents Module Loading

On systems with Secure Boot enabled, unsigned kernel modules cannot load. In this case, you have two options:

  1. Disable Secure Boot in your UEFI/BIOS settings (simplest solution)
  2. Sign the VirtualBox kernel modules with a custom key enrolled in your UEFI

To check if Secure Boot is enabled:

mokutil --sb-state

If the command is not found, install mokutil first: sudo apt install mokutil. Expected output when Secure Boot is enabled:

SecureBoot enabled

If Secure Boot is enabled and you choose to disable it, reboot and access your UEFI settings (typically by pressing F2, F12, or Delete during boot). The location of the Secure Boot setting varies by manufacturer but is usually under Security or Boot options.

USB Devices Not Visible in Guest

If USB devices do not appear in your virtual machines, verify that:

  1. The Extension Pack is installed (required for USB 2.0/3.0)
  2. Your user is in the vboxusers group
  3. USB controller is enabled in the VM settings (Settings > USB)

Remember, after adding yourself to the vboxusers group, you must log out and back in for the change to take effect.

Update VirtualBox

Since VirtualBox is installed from Oracleโ€™s APT repository, updates arrive through the standard system update process:

sudo apt update && sudo apt upgrade

When a VirtualBox update is available, it appears alongside your other system updates. After upgrading VirtualBox, DKMS automatically rebuilds the kernel modules for your running kernel.

However, after a major VirtualBox version update (for example, 7.2 to 7.3), you must also update the Extension Pack to the matching version. Follow the Extension Pack installation steps above with the new version number.

Remove VirtualBox

If you no longer need VirtualBox, you can remove it completely along with its repository configuration.

Uninstall VirtualBox and Extension Pack

First, remove the Extension Pack if installed:

sudo vboxmanage extpack uninstall "Oracle VirtualBox Extension Pack"

Then uninstall VirtualBox and remove orphaned dependencies:

sudo apt remove --purge virtualbox-7.2 -y
sudo apt autoremove -y

If you installed a different version, replace virtualbox-7.2 with the package name you used (such as virtualbox-7.1).

Remove Repository Configuration

Next, remove the repository configuration file and GPG key:

sudo rm /etc/apt/sources.list.d/virtualbox.sources
sudo rm /usr/share/keyrings/virtualbox.gpg
sudo apt update

Remove User Data (Optional)

The following commands permanently delete your virtual machines and VirtualBox settings. This includes all VM disk images, snapshots, and configuration. Back up any VMs you want to keep before proceeding.

By default, VirtualBox stores virtual machines and configuration in your home directory:

rm -rf ~/VirtualBox\ VMs/
rm -rf ~/.config/VirtualBox/

After removal, verify VirtualBox is no longer installed:

apt-cache policy virtualbox-7.2

Expected output:

virtualbox-7.2:
  Installed: (none)
  Candidate: (none)
  Version table:

Conclusion

You now have VirtualBox installed on Linux Mint with the Extension Pack configured for USB support and disk encryption. As a result, your installation receives updates alongside your regular system packages through Oracleโ€™s official repository. To create your first virtual machine, launch VirtualBox, click New, and follow the wizard to allocate resources and install a guest operating system. For detailed guidance on VM creation and guest additions, consult the official VirtualBox documentation.

6 thoughts on “How to Install VirtualBox on Linux Mint”

  1. Hello,
    Great tutorial that works perfectly on Linux Mint 22.

    Note that there is a typo on “Import the VirtualBox APT repository,” which mentions Mint 21 twice instead of Mint 22 in the box at the top.

    Thanks for these tutorials.

    Reply

Leave a Comment