Recommendation: How to disable KVM initialization?: GRUB vs modprobe.d

Hello Friends

Consider this question as a parallel extension of:

There are two possible solutions according with László (And both solutions are mentioned in other network too) as follows:

My readings told me it’s because the newer kernel loads and inits kvm module by default, whereas the previous version did not. This makes impossible for Virtualbox to init virtualization on its own, so the sulotion is either to disable kvm initialization in GRUB adding a kernel parameter ( kvm.enable_virt_at_load=0 ) , or blacklist kvm module via /etc/modprobe.d/something.conf.

Therefore:

Question

  • How to disable KVM initialization?: GRUB vs modprobe.d

My main concern is which one is either better or recommendable and why?.

Thanks for your understanding

3 Likes

Using modprobe.d is better because it is simpler.
If you use grub you have to edit /etc/default/grub, then do update-grub to build a new grub.cfg file, then if your linux is not the one controlling grub you have to go to the grub controlling linux and do update-grub there.

4 Likes

The modprobe.d approach seems is straightforward.
Do you know if it requires a reboot?

3 Likes

Yes it requires a reboot.

If it were a module, you could remove it from the current running kernel with modprobe -r modulename
but
I am not sure if kvm is a module? Do you know?

5 Likes

I had to do a grub update on 14 servers last week…

Was pulling my hair out trying to figure out why IPV6 wasn’t working…

And there it was in /etc/default/grub… “ipv6.disable=1”…

So - change grub config… then grubby update… then reboot…

PITA!!!

Then they wanted FIVE more servers!

So I stood up a VM from the template - made the grub changes… tested… shutdown and converted VM back to a new template…

5 Likes

Not necessarily.
You can safely unload it via rmmod kvm_intel.
Blacklisting the module ensures it will not be loaded upon next boots.

3 Likes

OK so it is a module

 lsmod | grep kvm
kvm_intel             421888  0
kvm                  1359872  1 kvm_intel
irqbypass              12288  1 kvm

So modprobe -r kvm-intel should work too.
What about the other 2 modules?

4 Likes

No problem with them, so I did not touch them :wink:

4 Likes