Removing qemu-kvm doesn't prevent kvm module from getting loaded (purging works ok)

Bug #292588 reported by Petri Koistinen
302
This bug affects 50 people
Affects Status Importance Assigned to Milestone
Virtualbox
New
Undecided
Unassigned
qemu-kvm (Ubuntu)
Fix Released
Low
Unassigned
virtualbox-ose (Ubuntu)
Invalid
Medium
Unassigned

Bug Description

Binary package hint: virtualbox-ose

When starting virtualmachine, VirtualBox will complain now:

"Failed to start the virtual machine XYZ

VirtualBox can't operate in VMX root mode. Please disable the KVM kernel extension, recompile your kernel and reboot.
VBox status code: -4011 (VERR_VMX_IN_VMX_ROOT_MODE).

Result Code:
NS_ERROR_FAILURE (0x80004005)
Component:
Console
Interface:
IConsole {e3c6d4a1-a935-47ca-b16d-f9e9c496e53e}"

This worked with 8.04 LTS ubuntu, so how can I install kernel that will work with new virtualbox on 8.10?

# lsb_release -rd
Description: Ubuntu 8.10
Release: 8.10
# apt-cache policy virtualbox-ose
virtualbox-ose:
  Asennettu: 2.0.4-dfsg-0ubuntu1
  Ehdokas: 2.0.4-dfsg-0ubuntu1
  Versiotaulukko:
 *** 2.0.4-dfsg-0ubuntu1 0
        500 http://fi.archive.ubuntu.com intrepid/universe Packages
        100 /var/lib/dpkg/status

Tags: patch

Related branches

Revision history for this message
Munzir Taha (منذر طه) (munzirtaha) wrote :

I faced the same problem and modprobe -r kvm_intel solved it for me

Revision history for this message
Petri Koistinen (pkoistin) wrote :

That works, it's a good work around, thanks, but virtualbox should work directly "out of box".

Revision history for this message
Pierre Buyle (mongolito404) wrote :
Revision history for this message
Motin (motin) wrote :

The workaround is to disable KVM:

1. Install "bum" (Boot-up Manager): sudo apt-get install bum
2. Start Boot-up Manager (in systems menu) and untick "Full virtualization on i386 and amd64 hardware - kvm"
3. Click Apply

Answer yes to make the change effective right away.

Revision history for this message
Cédric Darné (cdarne) wrote :

Thanks for the tip Motin, I don't need to manually unload the module each time I reboot now.

Revision history for this message
Mark Rabideau (manyroads) wrote :

Thank you Motin. Your fix worked for me.

Revision history for this message
Milan Knizek (knizek) wrote :

With VirtualBox 2.1.2 on Intrepid (binary packs from Sun) it is enough to stop kvm service to unload the kvm module.

$ sudo /etc/init.d/kvm stop

Revision history for this message
Simon Brennan (crashatza) wrote :

Only problem with this workaround is what if you are actually using KVM?

Revision history for this message
Huygens (huygens-25) wrote :

I think if KVM is not installed, the module should not be loaded. Or at least, they should not be loaded by default. Those who want to use KVM will load them.
I have too the problem with Jaunty and VirtualBox (either the OSE one - v2.1.4 - in the Ubuntu repositories or the Sun deb one - v2.2.2).
For me the workaround was to remove first kvm_intel, then kvm (in this order).

Daniel Hahler (blueyed)
Changed in virtualbox-ose (Ubuntu):
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
Alberto González Palomo (matmota) wrote :

I just found the same issue after upgrading to Ubuntu 9.10 and VirtualBox 3.x.
For some reason the package qemu-kvm got installed and that's what runs the kvm module.
Before I was using VirtualBox 2.2 (not the OSE version, but the personal use version from virtualbox.org) in Ubuntu 9.04. I don't know whether qemu was installed or not. I don't remember doing so and I'm sure I never used it, but it might be.

The Ubuntu upgrade disabled the third party repositories. I had added the VirtualBox one as, if I remember correctly, it was not available in the standard repositories before.
Then the installed VirtualBox 2.2 failed to start because it could not load some kernel module (didn't complain yet about KVM, but I don't remember the details), so I went to add the karmic repository from VirtualBox.org to Synaptic.
When going to mark the VB 3.0 package for installation, I saw that the OSE version was available, so I just removed the third party repository, updated the package list, and installed virtualbox-ose 3.0.8-dfsg-1ubuntu1.
That's when I got the error message described in the bug report.

So, I'm not sure what actually triggered the issue in my case: the change of VirtualBox version, or the upgrade to Karmic.

What I've done is deinstall qemu-kvm (and qemu with it).

Revision history for this message
Yavvsy (yavanna-spring) wrote :

I just upgraded from 9.04 to 9.10 and VB 3.08 to 3.10. Also get the same message as in the original bug report. The workaround:

sudo modprobe -r kvm-intel

worked, but that's a cludge. I am not a great linuxer, and don't know how to fix this "nicely"

Yav

Revision history for this message
Acemilo (acemilo) wrote :

Alberto, thank you that fixed my problem. After the jaunty -> karmic upgrade I got the error and removing the package fixed it. For those who don't know how to remove it, the command would be sudo apt-get remove qemu-kvm.

Thank you!

Revision history for this message
Forest (foresto) wrote :

I'm with Simon in comment #8. Some of us actually use qemu, which requires qemu-kvm. There was no conflict with VirtualBox in Jaunty. Why the conflict now?

Revision history for this message
ignatius (ignatius) wrote :

I'm running Ubuntu Karmic, and even when I had already uninstalled (as in removed completely) qemu-kvm and kvm, I still had to untick "Full virtualization on i386 and amd64 hardware - kvm" in Boot Manager to stop it from starting up... So, "removed completely" doesn't really mean remove completely... :p

Revision history for this message
Germán Pablo Gentile (germanpablogentile) wrote :

You have qemu working, just remove it and solved.

sudo aptitude purge qemu-kvm

Revision history for this message
BassKozz (basskozz+ubuntu) wrote :

Just upgraded from Jaunty to Karmic and I just started seeing this problem.
sudo aptitude purge qemu qemu-kvm
worked !!!

Not sure if it was nessesary to purge both qemu-kvm & qemu, but i did both just to be sure. I am not using it for anything anyways.
Thanks Germán Pablo Gentile (#15)

Revision history for this message
Jim Kirkpatrick (jim-kirkpatrick) wrote :

So why is qemu and/or KVM installed by default in Karmic? What changed, or is this a mistake?

Revision history for this message
Erik Garrison (erik-garrison) wrote :

For users who still might want to use qemu-kvm, you can use:

sudo update-rc.d -f qemu-kvm remove

To remove the system startup links that insert the module at boot. Now if you want to use kvm, then run:

sudo /etc/init.d/qemu-kvm start

To insert the module and enable kvm.

This bug suggests that you will not be able to run both virtualbox-ose and qemu-kvm at the same time. But this workaround will at least prevent you from having to manually remove the kvm module after every boot.

Revision history for this message
Erik Garrison (erik-garrison) wrote :

KVM is the default virtualization system for Ubuntu 9.10:

"The default virtualization technology supported in Ubuntu is KVM, a technology that takes advantage of virtualization extensions built into Intel and AMD hardware. For hardware without virtualization extensions Xen and Qemu are popular solutions." (http://doc.ubuntu.com/ubuntu/serverguide/C/virtualization.html)

This would explain why it's installed by default.

Revision history for this message
ehcpdeveloper (ehcpdeveloper) wrote :

can I use qemu and virutalbox on same ubuntu 9.10 ?
must I remove qemu ?

is there a way to use both ?

This seems something like, "virtualbox tries to kick off qemu ?"

Revision history for this message
yareckon (yareckon) wrote :

I think that on install, in a debconf box, virtualbox should say that KVM is the default virtualization service, but that virtualbox kernel module can't start if the kvm service is running. Would you like to disable it?

Alternatively, virtualbox could disable the kvm service / unload the kvm module on startup and restart it when it exits.

Revision history for this message
Manohar (mekalamanohar) wrote :

Installing BUM worked foe me. thank you for the tips

Revision history for this message
Gabe Gorelick (gabegorelick) wrote :

Why does kvm not remove the kernel module permanently when the package is uninstalled? Is there some reason to keep it?

Revision history for this message
AdamOutler (adamoutler) wrote :

This is a serious annoyance. Why not remove the QEMU module or at least mark it incompatable with virtualbox?

Revision history for this message
Forest (foresto) wrote :

Does anyone else remember using both KVM and VirtualBox back in Jaunty and earlier releases, without conflict? Does anyone know why they started conflicting?

Revision history for this message
l.sabatini (l-sabatini) wrote :

this problem affected me in ubuntu beta1 10.04
i installed 9.04 and upgraded using update-manager -d

installed virtualbox and now it show this error..

NS_ERROR_FAILURE (0x80004005)
Componente: Console
Interfaccia: IConsole {6375231a-c17c-464b-92cb-ae9e128d71c3}

Revision history for this message
Spang (hetkot) wrote :

Yes, this used to work with the bum solution. Afaik it worked because qemu fired up kvm on start, I don't think actual parallel use of qemu and VBox was available.

The fact that the bum solution doesn't work anymore in Lucid is quite inconvenient indeed.

Revision history for this message
Spang (hetkot) wrote :

It would seem that this has to do with incompatibility of bum with upstart.
sudo stop qemu-kvm
Seems to be the way the go these days. Of course this is more of a patchwork solution than a final one.

Revision history for this message
Spang (hetkot) wrote :

Hmm, some looking around has made me think this is an error in the qemu-kvm packaging.
Removing qemu-kvm should remove the qemu-kvm upstart job (which actually loads the module).
Qemu can run without kvm, but then it isn't using hardware virtualization. This could be a solution for people only using qemu sporadically.

People who want to keep the option of hardware qemu could modify /etc/init/qemu-kvm.conf
changing
start on runlevel [2345]
to
#start on runlevel [2345]
effectively disabling this line.
Probably running
sudo initctl reload
afterwards to reload the settings.

This should make the kvm module loading manual, with modprobe or with
sudo stop qemu-kvm
and
sudo start qemu-kvm

Revision history for this message
Jim Kirkpatrick (jim-kirkpatrick) wrote :

I see this: http://packages.ubuntu.com/karmic/qemu-kvm

But I still do not understand precisely what this package is doing in _desktop_ Ubuntu? Anyone know why it's here and what relies on it out the box?

Revision history for this message
Spang (hetkot) wrote :

Hmm, maybe without this line:
sudo initctl reload
I may have been a bit to eager on that one.

Revision history for this message
ghostdog (chiggavelli) wrote :

i use that every time i reboot box sudo modprobe -r kvm_intel

Revision history for this message
Felix Geyer (debfx) wrote :

The qemu-kvm upstart job shouldn't load the kenel modules when the package has been removed.

Revision history for this message
Chuck Short (zulcss) wrote :

This should be fixed in lucid. Can you please test and if it still doesnt work please re-open.

Changed in qemu-kvm (Ubuntu):
status: New → Fix Released
Revision history for this message
ehcpdeveloper (ehcpdeveloper) wrote :

yes, seems working.
now, I use Ubuntu 10.04 Lucid, and both qemu and virtualbox can be run at same time, without any setting change.

Revision history for this message
StevenHanes (z06steve) wrote :

I had this error, removed qemu-kvm and was fine until I applied a kernel update this morning and then got the error again; modprobe -r kvm_intel fixed it this time. I am running Lucid 64 bit.

Revision history for this message
Felix Geyer (debfx) wrote :

For me qemu-kvm still loads the kvm kernel modules when the package is removed but not purged.

Changed in qemu-kvm (Ubuntu):
status: Fix Released → New
Revision history for this message
Christophe Besson (christophe-besson) wrote :

(not tested)
If you want to use VirtualBox as your default VT solution and if you don't want to uninstall kvm, try to not load the kvm modules at startup by adding a new file in /etc/modprobe.d/kvm-blacklist, containing these directives:
blacklist kvm
blacklist kvm_intel

That should work after the next reboot. After that, in case you need to run KVM just for one time, you need to load the kvm modules thanks to "modprobe kvm && modprobe kvm_intel" before lauching your KVM machine.

What is the best behavior for the installation of the package in order to have VBox running out of the box? I don't know. For example, exim is removed when you install postfix (Conflicts: mail-transport-agent), but we can maybe imagine a thing like an update-alternative machanism (?)

Revision history for this message
Felix Geyer (debfx) wrote :

Running VirtualBox VMs when the kvm module is loaded works for me in Lucid.
Does it fail for anyone?

Revision history for this message
Felix Geyer (debfx) wrote :

I still think qemu-kvm shouldn't load those kernel modules when the package has been removed but not purged.
Please consider sponsoring this fix:

qemu-kvm (0.12.3+noroms-0ubuntu10) maverick; urgency=low

  * debian/qemu-kvm.upstart: don't load the kernel modules if the package
    has been removed but the upstart jobs still exists. (LP: #292588)

 -- Felix Geyer <email address hidden> Wed, 12 May 2010 16:04:48 +0200

Revision history for this message
Gresley (kevin-applebyfamily) wrote : Re: [Bug 292588] Re: VirtualBox can't operate in VMX root mode.

I tried that when I first reported the bug. The files still loaded
despite being blacklisted.

That was my original annoyance. I should have just been able to stop
KVM ever loading, but couldn't

Sent from my iPhone

On 12 May 2010, at 01:20, Christophe Besson <<email address hidden>
 > wrote:

> (not tested)
> If you want to use VirtualBox as your default VT solution and if you
> don't want to uninstall kvm, try to not load the kvm modules at
> startup by adding a new file in /etc/modprobe.d/kvm-blacklist,
> containing these directives:
> blacklist kvm
> blacklist kvm_intel
>
> That should work after the next reboot. After that, in case you need
> to
> run KVM just for one time, you need to load the kvm modules thanks to
> "modprobe kvm && modprobe kvm_intel" before lauching your KVM machine.
>
> What is the best behavior for the installation of the package in order
> to have VBox running out of the box? I don't know. For example, exim
> is
> removed when you install postfix (Conflicts: mail-transport-agent),
> but
> we can maybe imagine a thing like an update-alternative machanism (?)
>
> --
> VirtualBox can't operate in VMX root mode.
> https://bugs.launchpad.net/bugs/292588
> You received this bug notification because you are a direct subscriber
> of a duplicate bug.
>
> Status in “qemu-kvm” package in Ubuntu: New
> Status in “virtualbox-ose” package in Ubuntu: Triaged
>
> Bug description:
> Binary package hint: virtualbox-ose
>
> When starting virtualmachine, VirtualBox will complain now:
>
> "Failed to start the virtual machine XYZ
>
> VirtualBox can't operate in VMX root mode. Please disable the KVM
> kernel extension, recompile your kernel and reboot.
> VBox status code: -4011 (VERR_VMX_IN_VMX_ROOT_MODE).
>
> Result Code:
> NS_ERROR_FAILURE (0x80004005)
> Component:
> Console
> Interface:
> IConsole {e3c6d4a1-a935-47ca-b16d-f9e9c496e53e}"
>
> This worked with 8.04 LTS ubuntu, so how can I install kernel that
> will work with new virtualbox on 8.10?
>
> # lsb_release -rd
> Description: Ubuntu 8.10
> Release: 8.10
> # apt-cache policy virtualbox-ose
> virtualbox-ose:
> Asennettu: 2.0.4-dfsg-0ubuntu1
> Ehdokas: 2.0.4-dfsg-0ubuntu1
> Versiotaulukko:
> *** 2.0.4-dfsg-0ubuntu1 0
> 500 http://fi.archive.ubuntu.com intrepid/universe Packages
> 100 /var/lib/dpkg/status
>
> To unsubscribe from this bug, go to:
> https://bugs.launchpad.net/ubuntu/+source/qemu-kvm/+bug/292588/+subscribe

Daniel Hahler (blueyed)
Changed in qemu-kvm (Ubuntu):
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Ioannis (ioannisnousias) wrote : Re: VirtualBox can't operate in VMX root mode.

@ Felix Geyer

I'm on Lucid and running VirtualBox VMs when KVM is loaded does not work for me (I get the aforementioned error message). I have to unload kvm and kvm_intel for it to work.

Revision history for this message
zdendos (koukol-zdenek-seznam) wrote :

I had some problem with VirtualBox ... I was installing qemu ... so I take it out and now it is working ... :D
$sudo apt-get purge qemu*

Felix Geyer (debfx)
tags: added: patch
Revision history for this message
Roy Koh (astralab) wrote :

Still a problem in Lucid. I blacklisted the kvm_intel module by editing the blacklist.conf file:

nano /etc/modprobe.d/blacklist.conf

and adding

"blacklist kvm_intel" to the file.

Revision history for this message
Thierry Carrez (ttx) wrote :

This bug as it stands is confusing.
There should be two parts:
- one "Answer" to the question about further explaining the "VirtualBox can't operate in VMX root mode. Please disable the KVM kernel extension" error message
- one bug about making sure the kvm module is unloaded if you remove KVM.

I'll create the question and answer, close the virtualbox-ose task and rename the bug so that it matches the remaining bug.

Changed in virtualbox-ose (Ubuntu):
status: Triaged → Invalid
Revision history for this message
Thierry Carrez (ttx) wrote :

Created https://answers.launchpad.net/ubuntu/+source/virtualbox-ose/+question/122834 to track the solution to the general issue.

summary: - VirtualBox can't operate in VMX root mode.
+ Removing qemu-kvm doesn't prevent kvm module from getting loaded
+ (purging works ok)
Changed in qemu-kvm (Ubuntu):
importance: Medium → Low
Revision history for this message
Thierry Carrez (ttx) wrote :

We are past FinalFreeze now for Maverick. Please repropose your patch when Natty development opens. Hopefully we'll do a better job of picking it up while it's still time to fix it...

Revision history for this message
Felix Geyer (debfx) wrote :

Updated debdiff for natty:

qemu-kvm (0.13.0+noroms-0ubuntu6) natty; urgency=low

  * debian/qemu-kvm.upstart: don't load the kernel modules if the package
    has been removed but the upstart jobs still exists. (LP: #292588)

 -- Felix Geyer <email address hidden> Sat, 20 Nov 2010 09:42:03 +0100

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Would it be better to have the qemu-kvm package remove hook (a) unload
the kvm module and (b) remove the postfix job?

Revision history for this message
Felix Geyer (debfx) wrote :

The upstart job is a config file so it shouldn't be removed.
qemu-kvm already unloads the kernel modules when it's removed but it loads them again on boot.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package qemu-kvm - 0.13.0+noroms-0ubuntu9

---------------
qemu-kvm (0.13.0+noroms-0ubuntu9) natty; urgency=low

  [ Serge Hallyn ]
  * debian/qemu-kvm.upstart: don't load the kernel modules if the package
    has been removed but the upstart jobs still exists. (LP: #292588)
    (Originally by Felix Geyer <email address hidden>)
 -- Dustin Kirkland <email address hidden> Mon, 29 Nov 2010 13:47:03 -0600

Changed in qemu-kvm (Ubuntu):
status: Triaged → Fix Released
Revision history for this message
Bryce Nesbitt (bryce2) wrote :

I'd like to be able to TEMPORARY disable qemu-kvm (akin to stopping the service except over a reboot),
rather than having to completely remove qemu-kvm.

Revision history for this message
Byron Gibson (byrongibson) wrote :

Bryce, Have you tried 'sudo stop qemu-kvm' or 'sudo service qemu-kvm stop'? Those worked for me on 10.04 when I needed to run VirtualBox instead, no reboot needed. Restart by replacing 'stop' with 'start'.

Revision history for this message
Byron Gibson (byrongibson) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.