7

In order to run a virtual machine, VirtualBox tells me to disable the KVM kernel module. I googled around and found out that KVM is included in the qemu-*-packages, but none of them is/was installed on my system (Debian Wheezy).

After that I simply tried to unload the module, but this doesn't want to work because it is in use:

# modprobe -r kvm_intel
FATAL: Module kvm_intel is in use.
# modprobe -r kvm
FATAL: Module kvm is in use.

I don't know what program is using it and I have really no idea what that could be. I also tried with the -f option but I get the same result.

My question is: How can I remove or disable the KVM Kernel module?

Update:

Here is the output of the lsmod command:

# lsmod | grep kvm
kvm_intel             138825  3 
kvm                   404853  1 kvm_intel
  • Sometimes you can use lsmod to try and backtrack what is using the module. – mchid Nov 6 '14 at 19:51
  • @mchid I added the output of lsmod to the question. What programs should I terminate? – msrd0 Nov 6 '14 at 19:54
  • it says that kvm_intel is also in use, what is using kvm_intel? – mchid Nov 6 '14 at 19:55
  • @mchid Where can I know what is using kvm_intel? – msrd0 Nov 6 '14 at 19:59
  • 3
    you can lsof | grep kvm and then kill the PID running see stackoverflow.com/questions/9029526/… and you could also force rmmod stackoverflow.com/a/449211/3393576 – mchid Nov 6 '14 at 20:19
5

As you noticed, there was an application using the module. The KVM module actually presents (part of) its functionality through the/dev/kvm device file. So find out what application is using it - e.g. with

$ lsof | grep /dev/kvm
  • This worked for me. Though the libvirtd service was stopped, qemu-system-x86_64 was still running, thus the module was still in use. lsof's output made it far more obvious. :) – zaTricky Aug 2 '16 at 11:52
2

Sometimes you can use lsmod to try and backtrack what is using the module.

Here's an example:

kvm_intel             143597  0 
kvm                   459817  1 kvm_intel

On my machine it says that kvm is used by kvm_intel. Also, kvm is not in use. If this were the case you should be able to run:

sudo modprobe -r kvm_intel 

and then,

sudo modprobe -r kvm
  • 1
    This does not work, kvm_intel is also in use – msrd0 Nov 6 '14 at 19:58
  • @msrd0 yes the output says kvm_intel is in use because it has a "3" instead of a "0". So, run lsmod alone without grep and look for what is using kvm_intel. You have to go back and start with the module that is using that is not in use. Go down the line from there one by one. – mchid Nov 6 '14 at 20:01
  • 1
    Why should I stop using grep? How do I benefit from that? Since grep only returns those two lines, it seems that there is no other module using kvm or kvm_intel – msrd0 Nov 6 '14 at 20:03
  • @msrd0 Actually, that won't help. nevermind – mchid Nov 6 '14 at 20:06

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.