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

Time:11-05

Problem 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
make
# 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

CodePudding user response:

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.

  • Related