Can't disable kvm at boot

With the latest VirtualBox, I ran into the problem with VBox VMs unable to start if if kvm modules are loaded. This is a known issue in the release notes.

As expected, the commands:
modprobe -r kvm_intel
modprobe -r kvm

… fix the issue and allow VBox VMs to run.

But I also tried the more permanent fix of adding kvm.enable_virt_at_load=0 to the GRUB_COMMAND_LINE in /etc/default/grub. Then I executed “grub2-mkconfig -o /boot/grub2/grub.cfg”, and grub2 reported it did its thing.

This is not working for me - the kvm_intel and kvm modules are still loaded. I also checked that the same patch was made to /etc/sysconfig/grub.

What am I missing that the change to /etc/default/grub is not having any effect?

Thank you!

On Rocky9 you have to:

grub2-mkconfig -o /boot/grub2/grub.cfg --update-bls-cmdline

This updates the entries in /boot/loader/entries/

Well, thank you very much. VirtualBox VMs are starting on reboot again. Never saw your suggestion documented when I was searching for fixes.

I am curious about something. After applying your suggestion and rebooting, the VMs do start but

lsmod | grep kvm

tells me that kvm_intel and kvm are still loaded. I would have expected them to no longer be there since they are gone after the modprobe -r commands.

Anyway, thank you so much.

Probably to stop them loading would be to create a file, eg: /etc/modprobe.d/kvm.conf and within that file put:

blacklist kvm
blacklist kvm_intel

that should stop them loading.

@iwalker: Thank you. I’ve added the file and I’ll check next time I reboot.

I noticed the existing files in /etc/modprobe.d end in .conf. Should this new file be kvm.conf or does it not matter?

1 Like

Yeah, oversight on my part :slight_smile: so should be kvm.conf. I’ll update my post to reflect that.