VirtualBox is Type 2 virtualisation: it runs on top of your running system rather than beside it. That makes it easy to install and manage, and noticeably slower than KVM for anything demanding. For a Windows application, a browser test or a throwaway Linux install, it is exactly the right tool.
Install
Install virtualbox from Discover, or from Oracle's own repository if you want the
newest release:
sudo apt install virtualbox virtualbox-guest-utils virtualbox-ext-pack
The extension pack adds USB 2.0/3.0 passthrough, disk encryption and the VRDP server. It is free for personal and educational use under Oracle's licence — read it before using it commercially.
To use USB devices inside a guest, your user must be in the vboxusers group:
sudo usermod -aG vboxusers $USER
Log out and back in for the group change to apply.
Create a machine
- New → give it a name; VirtualBox guesses the OS from the name and ISO.
- Select the ISO. For Windows 11 you need the ISO plus EFI and a TPM — see below.
- Memory: half your installed RAM is a sensible ceiling, 4 GB minimum for a modern desktop guest.
- Processors: half your cores, never all of them.
- Disk: 40 GB or more, dynamically allocated unless you care about maximum speed, in which case fixed-size is faster to run and slower to create.
- Before starting, open Settings → Display and give the guest at least 128 MB of video memory, with 3D acceleration on if the guest needs it.
Windows 11 guests
Windows 11 checks for a TPM and Secure Boot. In Settings → System: enable Enable EFI, then under the TPM tab choose v2.0. Without both, the installer stops with “This PC can't run Windows 11”.
Guest Additions
Without them the guest is stuck at one resolution with no clipboard sharing. With them you get automatic resolution, a shared clipboard, drag and drop, shared folders and better mouse integration.
- Boot the guest and log in.
- Menu Devices → Insert Guest Additions CD image.
- In a Linux guest, open a terminal in the mounted CD and run:
sudo apt install build-essential linux-headers-$(uname -r) sudo ./VBoxLinuxAdditions.run - In a Windows guest, run
VBoxWindowsAdditions.exefrom the CD and reboot.
Shared folders
Settings → Shared Folders → add a folder from the host. Tick
Auto-mount and Make Permanent. In a Linux guest it appears under
/media/sf_<name>; mount it manually if it does not:
sudo mkdir -p /mnt/share
sudo mount -t vboxsf sharename /mnt/share
To mount it at every boot, add an entry to /etc/fstab:
sharename /mnt/share vboxsf defaults 0 0.
Snapshots: the reason to use virtual machines
Take a snapshot before installing anything risky: Machine → Take Snapshot. Restoring it rolls the entire guest — disk, memory, settings — back to that moment. It costs disk space, so delete snapshots you no longer need.
Snapshot before, not after. The snapshot that saves you is the one taken while everything still worked.
Troubleshooting
| Problem | Fix |
|---|---|
| “KVM is not available” / the machine refuses to start | VirtualBox and KVM fight over the virtualisation extensions. Either unload KVM (sudo modprobe -r kvm_intel) or use KVM itself through virt-manager, which is faster anyway. |
| Very slow guest | Virtualisation is probably disabled in the firmware. Reboot into the BIOS/UEFI settings and enable VT-x or AMD-V (sometimes called SVM). |
| Black screen or graphics glitches in the guest | Turn off 3D acceleration in Settings → Display, or switch the graphics controller to VMSVGA. |
| Guest Additions will not build | The guest lacks kernel headers: sudo apt install linux-headers-$(uname -r) build-essential inside the guest, then re-run the installer. |
| USB device not visible in the guest | Extension pack installed, user in vboxusers, and the device attached from Devices → USB after the guest has booted. |
| No internet in the guest | Adapter set to NAT is the most forgiving. Use Bridged only when the guest needs to be reachable from the network. |
| Host freezes with a heavy guest | You have over-allocated. Leave at least 2 GB and two cores for the host desktop. |
When to use KVM instead
If the guest is for real work rather than testing, virt-manager with QEMU/KVM is
substantially faster because it uses the CPU's virtualisation hardware directly. Install
virt-manager and qemu-system-x86 from Discover; the workflow — create,
install, snapshot — is the same idea with a different window.