qemu-sanity-check man page

qemu-sanity-check — 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" 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.
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".
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).
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>


Explore man page connections for qemu-sanity-check(1).