0

I'm using VirtualBox for some projects that I'm working on but also want to use KVM. I know that I can't use both at the same time, because of VirtualBox which refuses to start with an error like: VERR_VMX_IN_VMX_ROOT_MODE

Now I thought it would be easy to stop all KVM / libvirtd services and after that to unload the KVM modules like so:

$ sudo systemctl stop libvirtd
$ sudo modprobe -r kvm_intel
$ sudo modprobe -r kvm

But when I try to unload the KVM modules, modprobe tells me that these modules are still in use.

When I check systemctl for other running services with libvirt in its name, it also lists:

$ sudo systemctl list-unit-files| grep libvirt
libvirt-bin.service                        enabled        
libvirt-guests.service                     enabled        
libvirtd.service                           enabled

and

$ sudo systemctl list-unit-files| grep kvm    
qemu-kvm.service                           enabled

So I stopped them all, but even after that, something is using KVM.

I did a

$ sudo lsof | grep kvm          
qemu-syst 14745           libvirt-qemu  mem       REG               0,13                  10646 anon_inode:kvm-vcpu (stat: No such file or directory)
qemu-syst 14745           libvirt-qemu   11u      CHR             10,232         0t0        551 /dev/kvm
qemu-syst 14745           libvirt-qemu   12u  a_inode               0,13           0      10646 kvm-vm
qemu-syst 14745           libvirt-qemu   18u  a_inode               0,13           0      10646 kvm-vcpu
qemu-syst 14745 14753     libvirt-qemu  mem       REG               0,13                  10646 anon_inode:kvm-vcpu (stat: No such file or directory)
qemu-syst 14745 14753     libvirt-qemu   11u      CHR             10,232         0t0        551 /dev/kvm
qemu-syst 14745 14753     libvirt-qemu   12u  a_inode               0,13           0      10646 kvm-vm
qemu-syst 14745 14753     libvirt-qemu   18u  a_inode               0,13           0      10646 kvm-vcpu
CPU\x200/ 14745 14761     libvirt-qemu  mem       REG               0,13                  10646 anon_inode:kvm-vcpu (stat: No such file or directory)
CPU\x200/ 14745 14761     libvirt-qemu   11u      CHR             10,232         0t0        551 /dev/kvm
CPU\x200/ 14745 14761     libvirt-qemu   12u  a_inode               0,13           0      10646 kvm-vm
CPU\x200/ 14745 14761     libvirt-qemu   18u  a_inode               0,13           0      10646 kvm-vcpu
SPICE\x20 14745 14763     libvirt-qemu  mem       REG               0,13                  10646 anon_inode:kvm-vcpu (stat: No such file or directory)
SPICE\x20 14745 14763     libvirt-qemu   11u      CHR             10,232         0t0        551 /dev/kvm
SPICE\x20 14745 14763     libvirt-qemu   12u  a_inode               0,13           0      10646 kvm-vm
SPICE\x20 14745 14763     libvirt-qemu   18u  a_inode               0,13           0      10646 kvm-vcpu
kvm-pit/1 14762                   root  cwd       DIR              253,0        4096          2 /
kvm-pit/1 14762                   root  rtd       DIR              253,0        4096          2 /
kvm-pit/1 14762                   root  txt   unknown                                           /proc/14762/exe

and it seems that something is still running. Did I miss something that I have to stop in order to completely stop KVM?

I would like to put all relevant steps into a script so that I can easily start / stop KVM or VirtualBox...

  • KVM can't run VMs on its own and is often paired with QEMU to do the actual emulation. From your lsof output, QEMU (your VM) is still running. – dsstorefile1 May 8 '18 at 7:39
  • Sorry for my ambiguous use of the terms... But I made sure in virt-manager, that I stopped all the virtual machines. How can it be that qemu is still running? – Marc May 8 '18 at 7:48

Your Answer

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

Browse other questions tagged or ask your own question.