KVM won't install with KVM capable CPU

I’m running Debian Lenny on a system with an AMD Athlon II 240 CPU.

I’m installing KVM on my Debian system (fully updated) following this walkthrough. After installing the Xen kernel and rebooting, I attempt to install kvm and get the following error:

[code]slinky:/home/user# aptitude install kvm
Reading package lists… Done
Building dependency tree
Reading state information… Done
Reading extended state information
Initializing package states… Done
Reading task descriptions… Done
The following NEW packages will be installed:
kvm
0 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 1111kB of archives. After unpacking 3121kB will be used.
Writing extended state information… Done
Get:1 http://ftp.us.debian.org lenny/main kvm 72+dfsg-5~lenny5 [1111kB]
Fetched 1111kB in 1s (726kB/s)
Selecting previously deselected package kvm.
(Reading database … 29584 files and directories currently installed.)
Unpacking kvm (from …/kvm_72+dfsg-5~lenny5_amd64.deb) …
Processing triggers for man-db …
Setting up kvm (72+dfsg-5~lenny5) …
Your system does not have the CPU extensions required to use KVM. Not doing anything. failed!
Reading package lists… Done
Building dependency tree
Reading state information… Done
Reading extended state information
Initializing package states… Done
Writing extended state information… Done
Reading task descriptions… Done

slinky:/home/user# egrep ‘(vmx|svm)’ --color=always /proc/cpuinfo
[/code]

But when I run

egrep '(vmx|svm)' --color=always /proc/cpuinfo

the above code in the normal kernel (the one that installed with the OS), I get the proper CPU extensions.

Everything I can find says my CPU supports KVM and obviously Debian does as well, but once I boot into a Xen kernel, I can’t install KVM. Anybody know what the deal is?

Are you running a 32-bit or 64-bit kernel in Xen?

Are you running a 32-bit or 64-bit kernel in Xen?

64-bit.

Hmmm, does /dev/kvm already exist?

slinky:/home/user# ls /dev/kvm ls: cannot access /dev/kvm: No such file or directory
Nope.

EDIT
According to this site, "You’ll never see (vmx|svm) in /proc/cpuinfo if you’re currently running in in a dom0 or domU.
The Xen hypervisor suppresses these flags in order to prevent hijacking. " so it’s going to be impossible to install kvm while booted in a xen kernel right?

If I reboot to a normal kernel I’m able to install kvm no problem. But once I boot back to the normal kernel, the module doesn’t load and I can’t reinstall it as it fails with the same error.

Yup, this sounds like a chicken/egg bug between Deb’s implementation of KVM and Xen. Of course, in Xen you’re not directly using KVM anyway, but merely its kernel hooks to accelerate QEMU for HVM domains. You can get similar results in Lenny by using the kqemu module, which doesn’t require any specific CPU flags to install.

:-/ I guess I’ll just go ahead and use the kqemu module. I was hoping to experiment with KVM some since I used kqemu in the past. Thanks AT.

Well, Xen uses QEMU to run HVM domains, not KVM, so there really isn’t much of a practical difference. In a Xen environment, KVM (or kqemu) is simply used to accelerate HVM domains. PV domains aren’t affected either way, and that’s really where Xen shines.