qemu: CPU model 'host' requires KVM or HVF, but kvm-ok is fine


I try to run a qcow image with the following configuration:

:~$ sudo ~/Downloads/qemu-7.1.0/bin/debug/native/x86_64-softmmu/qemu-system-x86_64 
-L -enable-kvm -cpu host -s -kernel bzImage -m 2048
-hda rootfs.qcow2-append "root=/dev/sda rw
nokaslr" -net nic,model=virtio -net user,hostfwd=tcp::5555-:22

Error Message:

qemu-system-x86_64: CPU model 'host' requires KVM or HVF

But kvm should be fine:

:~$ kvm-ok
INFO: /dev/kvm exists
KVM acceleration can be used

What I did:

I’d like to use qemu in version 7.1.0 and installed it following the wiki by using the tar archive.

# Switch to the QEMU root directory.
cd qemu
# Prepare a native debug build.
mkdir -p bin/debug/native
cd bin/debug/native
# Configure QEMU and start the build.
../../../configure --enable-debug
# Return to the QEMU root directory.
cd ../../..

The simple test from the wiki works fine.

bin/debug/native/x86_64-softmmu/qemu-system-x86_64 -L pc-bios


The "-L" option needs an argument (a path to the BIOS and other binary files), but you haven’t given it one. QEMU’s command line parser therefore thinks that you are asking it to look in a directory named "-enable-kvm", and that you haven’t given ‘-enable-kvm’ as an option at all. So it’s running in TCG, where ‘-cpu host’ is not valid.

You need to fix your command line: either specify the -L option correctly, or if you don’t need it then just drop it.

You are also missing a space before ‘-append’.

If you got this command line from a tutorial, re-check it carefully and make sure you’ve got it exactly right, including any necessary pieces to add in and that all the spaces and punctuation are matching.

Answered By – Peter Maydell

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published