How To Install VirtualBox on Ubuntu 26.04 LTS

Install VirtualBox on Ubuntu 26.04

If you want to run isolated virtual environments directly on your Ubuntu desktop or server, knowing how to install VirtualBox on Ubuntu 26.04 LTS is one of the most practical skills you can pick up. Whether you are a developer spinning up a throwaway test box, a sysadmin validating a deployment script, or a student exploring a new OS without nuking your main machine, VirtualBox gives you a clean, free, and flexible solution.

Ubuntu 26.04 LTS ships with the Linux kernel 6.17 series, and that changes a few things compared to older LTS releases. The kernel module signing requirements are stricter, DKMS behavior has shifted slightly, and the default Secure Boot configuration on UEFI systems will silently block unsigned kernel modules from loading. This guide walks you through every step from system update to Guest Additions, with real explanations for why each step matters, not just command-copy instructions.

This tutorial covers two installation methods: the Ubuntu multiverse repository for simplicity, and Oracle’s official repository for the latest VirtualBox 7.2+. You will also learn how to handle Secure Boot, install the Extension Pack, create your first VM, and fix the five most common errors that show up in production environments.

Prerequisites

Before you run a single command, confirm the following:

Hardware:

  • A 64-bit CPU with Intel VT-x or AMD-V virtualization support enabled in BIOS/UEFI
  • Minimum 4 GB RAM on the host (8 GB strongly recommended)
  • At least 25 GB of free disk space; SSD preferred

Software:

Check virtualization support before anything else:

grep -E --color 'vmx|svm' /proc/cpuinfo

If you get no output, virtualization is either disabled in firmware or your CPU does not support it. Go into your BIOS/UEFI settings, find the CPU section, and enable Intel Virtualization Technology (VT-x) or AMD Secure Virtual Machine (SVM). Without this flag active at the firmware level, VirtualBox will install cleanly but throw a VERR_VMX_NO_VMX error the moment you try to start any VM.

Confirm your current running kernel after enabling virtualization:

uname -r

You should see something like 6.17.0-xx-generic. Note this string, because you will need it when installing kernel headers.

Step 1: Update Your System Packages

sudo apt update && sudo apt upgrade -y

This is not optional housekeeping. Running outdated packages before adding new repository keys is a known cause of GPG key conflicts and broken dependency resolution on Ubuntu. Upgrading first ensures your APT metadata cache is coherent and that the kernel headers you install in the next step actually match the running kernel.

After the upgrade finishes, check if the kernel was updated:

uname -r

If the kernel version changed after the upgrade, reboot now before continuing:

sudo reboot

DKMS compiles kernel modules against the currently running kernel, not the latest installed one. Skipping this reboot is one of the most common reasons the vboxdrv module silently fails to build.

Step 2: Install Required Dependencies

sudo apt install -y build-essential dkms linux-headers-$(uname -r)

Here is what each package does and why it matters:

  • build-essential: Installs GCC, make, and other compilation tools. VirtualBox kernel modules are compiled from source on your machine, not shipped as pre-built binaries for every kernel variant.
  • dkms (Dynamic Kernel Module Support): Automatically rebuilds VirtualBox’s kernel modules (vboxdrv, vboxnetflt, vboxnetadp) whenever Ubuntu pushes a new kernel update. Without DKMS, every kernel upgrade would silently break VirtualBox until you manually rebuilt everything.
  • linux-headers-$(uname -r): Provides the kernel source headers for your specific running kernel version. The compilation will fail with “unable to find the sources of your current Linux kernel” if these are missing.

Verify DKMS installed correctly:

dkms --version

Step 3: Choose Your Installation Method

You have two solid options. Here is a practical comparison:

Ubuntu Multiverse Repo Oracle Official Repo
Speed Fastest, one command Slightly more setup
VirtualBox version May lag Oracle by weeks Always latest (7.2+)
DKMS integration Automatic Automatic
Best for Casual use, quick setup Lab environments, latest features
Kernel 6.17 tested Check Ubuntu’s bug tracker VirtualBox 7.2 confirmed

For Ubuntu 26.04 LTS with its kernel 6.17 series, Oracle’s repository is the recommended path. The Ubuntu-packaged VirtualBox 7.0.x has known DKMS build failures with kernel 6.17, which Oracle fixed in version 7.2.

Step 4: Add Oracle’s Repository and GPG Key

Step 4a: Import Oracle’s Signing Key

wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | \
  sudo gpg --dearmor -o /usr/share/keyrings/oracle-virtualbox.gpg

APT requires a trusted GPG key to authenticate every package it downloads from a third-party repository. Importing it into /usr/share/keyrings/ follows Ubuntu 22.04+ security conventions. The older method of adding keys to /etc/apt/trusted.gpg is deprecated and affects all repositories globally, which is a security risk.

Confirm the key file was created:

ls -lh /usr/share/keyrings/oracle-virtualbox.gpg

Step 4b: Add the Oracle APT Repository

echo "deb [arch=amd64 signed-by=/usr/share/keyrings/oracle-virtualbox.gpg] \
  https://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib" | \
  sudo tee /etc/apt/sources.list.d/virtualbox.list

The signed-by= parameter ties this repository entry to only the Oracle key you just imported, preventing key collisions with other repos. Placing the repo in /etc/apt/sources.list.d/virtualbox.list as a separate file makes it easy to remove later without touching the base system’s sources.list.

Refresh APT’s package index to pull in Oracle’s package list:

sudo apt update

Step 5: Install VirtualBox on Ubuntu 26.04 LTS

sudo apt install virtualbox-7.2 -y

APT will resolve all dependencies, compile the kernel modules via DKMS, and register the vboxdrv service automatically. This step usually takes 2 to 5 minutes depending on your CPU speed.

Once it finishes, verify the installation and confirm the core kernel service is active:

vboxmanage --version

Expected output:

7.2.x_Ubuntu r168xxx
sudo systemctl status vboxdrv

Expected output:

● vboxdrv.service - VirtualBox Linux kernel module
     Loaded: loaded (/lib/systemd/system/vboxdrv.service; enabled)
     Active: active (exited) since ...

The vboxdrv kernel service is VirtualBox’s core driver. If this service is not active and showing active (exited), no virtual machine will ever start, regardless of how cleanly the VirtualBox application itself opens. If it shows failed, jump to the Troubleshooting section below.

Step 6: Configure VirtualBox on Ubuntu 26.04 and Handle Secure Boot

This step catches most people off guard. Ubuntu 26.04 LTS enables Secure Boot by default on UEFI systems. Secure Boot blocks unsigned kernel modules from loading, and vboxdrv is an out-of-tree module that the kernel does not automatically trust.

Step 6a: Check Secure Boot Status

mokutil --sb-state

If the output is SecureBoot enabled, you need to enroll VirtualBox’s DKMS signing key into the Machine Owner Key (MOK) database. If it shows SecureBoot disabled, skip to Step 6b.

Step 6b: Enroll the DKMS MOK Key

sudo mokutil --import /var/lib/dkms/mok.pub

You will be prompted to create a one-time password. Choose something simple like virtualbox123 since you will type it on the next boot’s blue UEFI screen.

Now reboot:

sudo reboot

On reboot, a blue screen titled “Perform MOK Management” appears. Select “Enroll MOK”, then “Continue”, enter your one-time password, and select “Yes”. The system reboots again automatically.

The UEFI firmware now trusts VirtualBox’s locally-signed DKMS modules. This lets vboxdrv, vboxnetflt, and vboxnetadp load without disabling Secure Boot entirely. Disabling Secure Boot is a common shortcut recommendation online, but it weakens your system’s boot-time integrity protection. The MOK enrollment path keeps your security posture intact.

After reboot, confirm the modules loaded:

lsmod | grep vbox

Expected output:

vboxnetadp             28672  0
vboxnetflt             36864  0
vboxdrv               692224  2 vboxnetadp,vboxnetflt

Step 6c: Add Your User to the vboxusers Group

sudo usermod -aG vboxusers $USER

Log out and log back in, or run newgrp vboxusers to apply the group change in your current session.

VirtualBox’s USB and bridged network drivers restrict hardware access to members of vboxusers. Running VirtualBox as a non-member means USB devices stay invisible inside VMs and bridged network adapters do not appear in VM network settings. This is an intentional security model decision by Oracle, not a misconfiguration you need to work around.

Confirm your group membership:

groups $USER

Your username should appear alongside vboxusers in the output.

Step 7: Install the VirtualBox Extension Pack

The Extension Pack is a separate Oracle component that adds USB 2.0/3.0 support, NVMe disk passthrough, host webcam passthrough, disk encryption, and PXE boot for Intel network adapters.

Without the Extension Pack, USB devices plugged into your host machine are invisible to all guest VMs. That matters for developers testing embedded devices, sysadmins doing USB-based OS deployments, or anyone who wants to share a phone or drive with a VM.

Download the pack that matches your exact installed version:

VER=$(vboxmanage --version | cut -d'r' -f1)
wget https://download.virtualbox.org/virtualbox/${VER}/Oracle_VirtualBox_Extension_Pack-${VER}.vbox-extpack

Install it:

sudo vboxmanage extpack install Oracle_VirtualBox_Extension_Pack-${VER}.vbox-extpack

Accept the Oracle license agreement when prompted. Verify the installation:

vboxmanage list extpacks

Expected output:

Extension Packs: 1
Pack no. 0:   Oracle VirtualBox Extension Pack
Version:      7.2.x

Version mismatches between VirtualBox and the Extension Pack produce an immediate fatal error and can corrupt your VirtualBox installation state. Always use the $VER variable method above to keep them in sync.

Step 8: Create and Configure Your First Virtual Machine

Via the VirtualBox GUI

Open VirtualBox Manager from your applications menu. Click “New” and follow these settings as a baseline:

  • Name: Give it something descriptive, like Ubuntu-Test-VM
  • Type: Linux
  • Version: Ubuntu (64-bit)
  • RAM: Allocate at least 2 GB (4 GB recommended). Insufficient RAM causes the guest kernel to OOM-kill processes during boot, which looks like a random crash.
  • CPU: Set to 2 cores minimum. Single-core VMs stall on modern guest OSes that expect SMP at boot.
  • Disk: Create a new VDI virtual disk, dynamically allocated, 25 GB minimum. Dynamic allocation means the .vdi file only consumes actual used space on the host, not the full 25 GB upfront.
  • Display VRAM: Set to 128 MB and enable 3D acceleration. Ubuntu 26.04’s GNOME 50 uses Wayland for compositing; low VRAM causes persistent desktop rendering glitches inside the VM.

Via the Command Line (for Automation)

vboxmanage createvm --name "Ubuntu-VM" --ostype "Ubuntu_64" --register
vboxmanage modifyvm "Ubuntu-VM" --memory 4096 --cpus 2
vboxmanage createhd --filename ~/VirtualBox\ VMs/Ubuntu-VM/Ubuntu-VM.vdi --size 25000
vboxmanage storagectl "Ubuntu-VM" --name "SATA" --add sata --controller IntelAhci
vboxmanage storageattach "Ubuntu-VM" --storagectl "SATA" --port 0 --device 0 --type hdd --medium ~/VirtualBox\ VMs/Ubuntu-VM/Ubuntu-VM.vdi

The CLI method is how you provision lab VMs at scale, embed VM creation in Ansible playbooks, or automate repeatable test environments. It is not just a nerd trick; it is the foundation of reliable infrastructure automation.

Step 9: Install VirtualBox Guest Additions Inside the VM

Guest Additions are kernel modules and userspace drivers you install inside the guest VM, not on the host.

Without Guest Additions, you get a fixed 800×600 display resolution, no clipboard sharing between host and guest, no drag-and-drop support, and no shared folders. For any practical daily use, they are non-negotiable.

Boot your guest VM, open a terminal inside it, and run:

sudo apt update
sudo apt install -y build-essential dkms linux-headers-$(uname -r)

You need linux-headers inside the guest for the same reason as on the host: Guest Additions compile their own kernel modules inside the guest OS.

In the VirtualBox menu bar, go to Devices > Insert Guest Additions CD Image. Then mount and run it:

sudo mount /dev/cdrom /mnt
sudo /mnt/VBoxLinuxAdditions.run

Reboot the guest when the installation finishes:

sudo reboot

After reboot, add your guest user to the vboxsf group to enable shared folder access:

sudo gpasswd --add $USER vboxsf

Log out and back in inside the guest to apply the group change.

Take a snapshot immediately after this clean state: VirtualBox Manager > Machine > Take Snapshot. Rolling back a broken VM takes under 10 seconds from a clean snapshot versus a full reinstall.

Troubleshooting Common Errors

Error 1: VERR_VMX_NO_VMX When Starting a VM

Cause: Intel VT-x is not enabled in BIOS/UEFI, or Hyper-V is active on a Windows host.

Fix: Enter BIOS/UEFI, navigate to CPU/Advanced, and enable Intel Virtualization Technology. Confirm with:

lscpu | grep Virtualization

Error 2: vboxdrv Kernel Module Failed to Build

Cause: Kernel headers are missing or there is a DKMS version mismatch.

Fix:

sudo apt install --reinstall dkms linux-headers-$(uname -r)
sudo /sbin/vboxconfig

Error 3: Secure Boot Blocks Module Loading

Cause: DKMS signing key not enrolled in the MOK database.

Fix: Follow Step 6b in this guide. Run mokutil --sb-state to confirm, then enroll the key and reboot.

Error 4: USB Devices Not Visible Inside the VM

Cause: Your user is not a member of the vboxusers group, or the Extension Pack is not installed.

Fix:

sudo usermod -aG vboxusers $USER

Log out and back in. Confirm the Extension Pack is installed with vboxmanage list extpacks.

Error 5: VM Display Stuck at 800×600

Cause: Guest Additions not installed or failed to install inside the guest VM.

Fix: Re-run the Guest Additions installer inside the guest. Confirm the modules loaded with:

modinfo vboxguest

If the command returns module info, Guest Additions are active. If not, re-run /mnt/VBoxLinuxAdditions.run and reboot the guest.

Congratulations! You have successfully installed VirtualBox. Thanks for using this tutorial for installing VirtualBox on the Ubuntu 26.04 LTS (Resolute Raccoon) system. For additional help or useful information, we recommend you check the VirtualBox website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!
r00t is a Linux Systems Administrator and open-source advocate with over ten years of hands-on experience in server infrastructure, system hardening, and performance tuning. Having worked across distributions such as Debian, Arch, RHEL, and Ubuntu, he brings real-world depth to every article published on this blog. r00t writes to bridge the gap between complex sysadmin concepts and practical, everyday application — whether you are configuring your first server or optimizing a production environment. Based in New York, US, he is a firm believer that knowledge, like open-source software, is best when shared freely.

Related Posts