Rocky 9.6 - Virtualbox quit (includes the fix)

I haven’t used Virtualbox for a few weeks so I’m not entirely sure if this is related to an update to Virtualbox itself or to the new Rocky 9.6 update, though I suspect the latter.

Maybe something changed in regard to what kernel modules are loaded by default?

When you load a Virtualbox image on 9.6, this error shows up:

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).

As stated in the error message, the fix is to remove the kvm kernel module.

I just did this:

modprobe -r kvm_intel
modprobe -r kvm

And it works now.

You can also add this to your kernel commandline:

kvm.enable_virt_at_load=0

For me this was cleared up with VirtaulBox 7.1.6 and I have since removed the parameter.