Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
    
updated my answer for fedora, plus you might look at the complete-disable option –  quack quixote Nov 2 '09 at 3:31
add comment

2 Answers

up vote 1 down vote accepted

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.

share|improve this answer
add comment

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.

share|improve this answer
    
Jinx! I'll delete my nearly identical answer. –  Ryan Thompson Nov 1 '09 at 22:35
    
aw man. can i speak yet or do i have to buy you a Coke first? –  quack quixote Nov 1 '09 at 22:50
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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