Your company here — click to reach over 10,000 unique daily visitors

qemu-sanity-check - Man Page

run a simple sanity check on qemu and the Linux kernel


qemu-sanity-check [options]


qemu-sanity-check is a short shell script that test-boots a Linux kernel under qemu, making sure it boots up to userspace.  The idea is to test the Linux kernel and/or qemu to make sure they are working.

You can use the command on its own:


In this case, the script will look for a suitable qemu binary on the $PATH and the latest Linux kernel in /boot (or /lib/modules/VERSION/vmlinuz on some distros) and try to boot that kernel on that qemu.

You can also specify a qemu binary or a Linux kernel (either or both options can be omitted):

 qemu-sanity-check --qemu=/path/to/qemu --kernel=/path/to/vmlinuz


KVM (kvm or qemu-kvm) can be used in place of qemu.

Kernel Drivers

No kernel modules or special drivers are required except as noted below.  The test uses an initramfs containing a static binary, so the kernel is not required to locate block devices, use virtio, mount filesystems, etc.

The kernel must support only the following, compiled in (not as modules):

  • A serial port (usually: CONFIG_SERIAL_8250=y)
  • Initrd/initramfs (CONFIG_BLK_DEV_INITRD=y)



Display short help message and exit.


This sets the -machine accel=... parameter which is passed to qemu.

If not set, then kvm:tcg is the default, which means to try to use KVM (hardware-assisted virtualization), and fall back to software emulation if KVM is not possible.

Other typical values of this parameter are: tcg, which means to force software emulation.  kvm, which means to force KVM and fail if KVM is unavailable.


Set the qemu --cpu option.  If not set then a suitable default is picked depending on the architecture and whether KVM is available. You can also use --cpu= to let qemu pick the default.


Use the initramfs image named INITRD instead of the default.


Use the kernel image VMLINUZ instead of searching for the latest kernel installed in /boot.


Set the qemu -m (machine type) option.  If not set then a suitable default is picked depending on the architecture.  You can also use --machine= to let qemu pick the default.


Use the qemu (or KVM) binary QEMU instead of searching $PATH for a suitable binary.


Specify a timeout instead of the default which is 10m (10 minutes).

The syntax for the TIMEOUT is described in full in the man page for timeout(1).


Print extra debugging information.


Display version and exit.

Exit Status

The exit status is 0 if the Linux kernel booted as far as userspace under qemu; or if the --help or --version options were used.

The exit status is 1 if the kernel boot failed under qemu.

The exit status is 2 if the script itself failed (eg. incorrect command line options were used, a suitable kernel could not be found).



The default location for the small initramfs image that is used to test that userspace has been reached.

See Also

<http://qemu.org>, <http://kernel.org>


Richard W.M. Jones <rjones@redhat.com>


2024-01-29 qemu-sanity-check-1.1.6 Virtualization Support