VirtualBox and KVM fighting for control on Debian Trixie

Posted: 2025-10-30 08:21:02 by Alasdair Keyes

Direct Link | RSS feed


I've recently updated my dev laptop to Debian Trixie. I waited a while as Debian hadn't ported VirtualBox to their Backports repository and Oracle hadn't released a version that would install correctly on Trixie.

Once Oracle finally released the .deb package for VirtualBox I rebuilt my machine only to get the following error upon starting a VM...

VT-x is being used by another hypervisor (VERR_VMX_IN_VMX_ROOT_MODE)

VirtualBox can't operate in VMX root mode. Please disable the KVM kernel extension, recompile your kernel and reboot.

The message is fairly self explanatory as to the problem. It looks like VirtualBox now doesn't like to share hypervisor duties.

VirtualBox is detecting that the KVM kernel modules are loaded and throwing the error. You can get VirtualBox VMs started by unloading the KVM Kernel modules

$ lsmod | grep kvm
kvm_intel             413696  0
kvm                  1396736  1 kvm_intel
irqbypass              12288  1 kvm

$ sudo rmmod kvm_intel kvm

$ lsmod | grep kvm
$

Note: If you run AMD processors, you'll need to adjust the kvm_intel to kvm_amd. Also Note: Loading and unloading is order-specific, you need to put the architecture specific kvm_xxx module before the standard kvm module.

Solutions

I have created a couple of aliases in my ~/.bashrc file to load the KVM modules if I want by running load-kvm-modules and unload them with unload-kvm-modules

alias unload-kvm-modules="sudo rmmod kvm_intel kvm"
alias load-kvm-modules="sudo modprobe kvm_intel kvm"

Using VirtualBox more than KVM

I use VirtualBox far more than KVM so the simple fix is that I stop the KVM modules being loaded at boot by blacklisting the KVM modules. I created a new file called /etc/modprobe.d/no-kvm.conf with the following contents.

blacklist kvm_intel
blacklist kvm

Using KVM more than VirtualBox

If you use KVM more than VirtualBox, the modules are already present at boot, you can just use KVM as normal. You don't need to do anything other than create the same aliases as above to load/unload the modules when required.


If you found this useful, please feel free to donate via bitcoin to 1NT2ErDzLDBPB8CDLk6j1qUdT6FmxkMmNz

© Alasdair Keyes

IT Consultancy Services

I'm now available for IT consultancy and software development services - Cloudee LTD.



Happy user of Digital Ocean (Affiliate link)


Version:master-baaeb07db6


Validate HTML 5