Gentoo kvm to qemu-kvm goodness

I run Linux KVM on a Gentoo server and recently noticed that the kvm package had been moved to qemu-kvm, apparently something to do with merging of qemu and kvm upstream…

Anyhow, I thought i’d update as this is mainly a test machine rather than production, what could possibly go wrong?

Libvirtd and a few other packages were updated at the same time, things seemed fairly promising, no special output from any of the updates meant that I assumed I could simply restart libvirtd and everything would just magically work again. Unfortunately it didn’t. None of my virtual machines started up.

I started up virsh and tried to start a machine, receiving the error:

Error starting domain: Cannot find QEMU binary /usr/bin/kvm: No such
file or directory

Erm… ok, perhaps the binary has moved, or changed names? The package was renamed from kvm to qemu-kvm after all… Lo and behold, there’s actually a /usr/bin/qemu now. So fire up virsh, edit my virtual machine config and replace

<emulator>/usr/bin/kvm</emulator>

with

<emulator>/usr/bin/qemu</emulator>

That ought to solve the problem, so again, try to start the virtual machine… ooh, ok, it looks like it starts, so I connect to the serial console and twiddle my thumbs for a bit… nothing. Eventually give in and connect to the vnc port for this machine. Rather annoyingly after trying to boot my x86_64 kernel on what turns out to be x86 qemu I see the message

This kernel requires an x86-64 CPU, but only detected an i686 CPU.

ARGH! Ok, so there must be some sort of flag I can pass to qemu to tell it to be x86_64? Or perhaps an qemu-x86_64, yes, that’s it /usr/bin/qemu-x86_64, so I edit my machine within virsh again and this time change emulator to:

<emulator>/usr/bin/qemu-x86_64</emulator>

Surely that will solve my problems? Nope, now when I try to start the VM with virsh it tells me:

error cannot parse QEMU version number in 'qemu-x86_64 version 0.11.0
(qemu-kvm-0.11.0), Copyright (c) 2003-2008 Fabrice Bellard'

Eh?! So does virsh do some sort of parsing of the qemu version number and if so, what’s wrong with that?

It turns out (I learn after much random googlage), that there’s also a qemu-system-x86_64 (obviously), so once again, edit the virtual machine config in virsh and change emulator to that

<emulator>/usr/bin/qemu-system-x86_64</emulator>

Start the VM, watch the console…. and YaY, it boots. Finally. All I need to do now is update the rest of my virtual machine configs and everything should be ready to go again.

Whoever decided this update was a good idea without at least warning people that things were going to break needs to be flogged with a wet kipper. I know this is technically ‘unstable’ Gentoo, but come on people, give us a chance!

Leave a Reply