If you’re trying to run virtual machines on Ubuntu 25.04 using VirtualBox and encountering an error like this:
VirtualBox can’t operate in VMX root mode. Please disable the KVM kernel extension, recompile your kernel and reboot (VERR_VMX_IN_VMX_ROOT_MODE).
Result Code: NS_ERROR_FAILURE (0X80004005)
Component: ConsoleWrap
Interface: IConsole {6ac83d89-6ee7-4e33-8ae6-b257b2e81be8}
Don’t worry — you’re not alone. This problem is due to changes introduced in Linux kernel 6.12, where KVM (Kernel-based Virtual Machine) initializes virtualization by default as soon as its modules load. Unfortunately, this conflicts with VirtualBox, which expects full control over the CPU’s virtualization features.
In this guide, I’ll walk you through both a quick temporary fix and a proper permanent solution.
Quick Temporary Solution
If you just want to quickly get VirtualBox working without rebooting or editing configuration files, you can unload the KVM kernel module manually. Open your terminal and run:
- For AMD processors:
$ sudo rmmod kvm_amd
- For Intel processors:
$ sudo rmmod kvm_intel
Important:
This will only last until your next reboot. After restarting your machine, you will need to run the command again.
Permanent Reboot-Proof Solution
If you want a proper fix that survives reboots, follow these steps:
- Open a terminal.
- Create a new configuration file:
$ sudo nano /etc/modprobe.d/VBox-NoKVM.conf
- Paste the following content exactly into the file:
# This is so that VirtualBox can start. # See: # https://www.virtualbox.org/wiki/Changelog # # VirtualBox 7.1.4 (released October 15 2024) # Linux Guest Additions: Introduce initial support for kernel 6.12 (NOTE: # In kernel 6.12, KVM initializes virtualization on module loading by # default. This prevents VirtualBox VMs from starting. In order to avoid # this, either add "kvm.enable_virt_at_load=0" parameter into kernel # command line or unload corresponding kvm_XXX module) # options kvm enable_virt_at_load=0
- Save the file and exit (in Nano, press
CTRL+O
,ENTER
, thenCTRL+X
). - Reboot your computer:
After the reboot, VirtualBox should now start your virtual machines without any issues.
Why This Happens
Starting with Linux kernel 6.12, KVM modules automatically take control of virtualization features (VMX/SVM) when they load. VirtualBox, however, needs to access these features directly. If KVM claims them first, VirtualBox fails to start VMs.
The workaround above tells KVM not to enable virtualization at load time, leaving VirtualBox free to use it.