In order to get virtualbox to work in Linux I have to run the following commands as root:

modprobe -r kvm_intel
modprobe -r kvm

otherwise I get an error. This works well.

The only problem is that I have to re-run those two commands every time the machine reboots.

Is there a way to permanently disable those two kernel modules?

  • updated my answer for fedora, plus you might look at the complete-disable option – quack quixote Nov 2 '09 at 3:31
  • I'm stuck trying to figure out how to stop the qemu-system service, – ThorSummoner Jan 28 '17 at 0:11

If you don't plan to use kvm at all, why not simply remove the qemu-system-[ARCH] rpm that supplies it. Also, fedora contains a file /etc/sysconfig/modules/kvm.modules which tells the system to load the kvm modules if virtualization extensions are detected in the processor. Modifying /etc/sysconfig/modules/kvm.modules or removing it altogether should also solve the problem, but removing the package seems like it would be the best solution.


Update: For Fedora, save the blacklist lines under Option 1 below into a file under /etc/modprobe.d/, for example, /etc/modprobe.d/blacklist. The name of the file isn't important; all files in the directory get processed during boot.

Option 3 might be more preferable if you're sure you'll never need to load these modules dynamically.

Option 1: Blacklist

Many distros use a module blacklist to disallow module loading. Normally this can be done by adding these lines to your distro's modules.conf or similar. You might try reading man modules.conf or googling for directions for your specific distribution.

blacklist kvm_intel
blacklist kvm

Option 2: Unload

An alternative is to add these lines to your rc.local script (or some other system boot-time script, preferably not one associated with a package):

modprobe -r kvm_intel
modprobe -r kvm

Option 3: Disable (new)

Both of the above will prevent the modules from getting loaded on bootup, but won't stop them from loading into the kernel later. To completely disable the module, use these lines -- again, they can go in a modules.conf file, or in /etc/modprobe.d/disabled or similar:

install kvm_intel /bin/true
install kvm /bin/true

What this does is tell the system to run /bin/true whenever these modules are requested. The program doesn't do anything except return true, so any load "succeeds" but the modules are never actually loaded. To re-enable drivers disabled with this technique, comment out these lines and reboot.

  • Thanks. The rc.local tip should work. I am using Fedora which does not appear to have a modules.conf file, at least, none that 'locate' could find. – jmvidal Nov 2 '09 at 1:38
  • At least on CentOS the file name should be /etc/modprobe.d/disabled.conf (without .conf extension it won't be picked up). – scrutari Dec 4 '20 at 19:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.