Skip Navigation

Using QEMU

After years of testing several different virtualization tools, I’ve settled on QEMU. While I like the nice GUI provided by VirtualBox, I’ve seen some oddities running on Linux hosts, and students have reported various issues on Mac and Windows hosts. In addition, as of August 2022, VirtualBox doesn’t support the new Apple M1 CPU, which is Arm-based instead of x86_64 (Intel).

I have known about – and worked with – QEMU for many years now. In fact, some of my early published research tested the performance of the Kernel-based Virtual Machine (KVM) accelerator for QEMU on Linux hosts.1

Page Contents

Introduction to QEMU

QEMU is an extremely powerful CPU emulator and virtualizer. It powers a number of other enterprise virtualization systems, including Proxmox VE,2 OpenNebula,3 oVirt,4 and others. Even VirtualBox uses some of QEMU’s underlying components, particularly the implementations of virtual hardware.5

The main downside to using QEMU directly is that it is fundamentally a command-line application, and there are an incredible number of command-line arguments that can be used for fine-tuning virtual machines. As such, there is a bit more of a learning curve with this system compared to VirtualBox. On the flip side, QEMU is available free of charge and runs on Linux, macOS, Windows, various BSD Unix systems, and Solaris.6 QEMU is also one of a handful of options (as of Fall 2022) for running virtual machines on Arm-based Apple Silicon (M1 and subsequent processors), with full virtualization support added as of version 6.2.7

Virtualization vs. Emulation

QEMU is capable of both virtualization and emulation. With virtualization, it is possible to run guest operating systems at near native speeds, since most of the instructions from the virtual machine can execute directly on the host computer’s CPU. (The “host” computer is your laptop or desktop computer.) In order for virtualization to work, the guest operating system must match the processor type of the host. That is, if you have an Intel or AMD CPU in your host computer, the guest operating system needs to be built for Intel/AMD (x86_64) instructions. If you have a newer Mac with Apple silicon, then the guest operating system needs to be built for 64-bit ARM (AArch64) instructions.

So what happens if you want to run a system built for AArch64 on an x86_64 host? Or, conversely, how do you run a guest built for x86_64 on Apple silicon? The answer here is that QEMU can emulate the instructions for the other CPU architecture, enabling a virtual machine for ARM to run on Intel or vice-versa. The trade-off here is that QEMU has to translate all the guest instructions to host instructions before they can run on your CPU, so the performance of the guest system will be reduced significantly. However, given some patience, the software should still run.

Getting Started with QEMU

The remainder of this OER describes how to install QEMU and use it to run virtual machines.

Additional Topics

Helpful Documentation

References


  1. Michael Fenn, Michael A. Murphy, Jim Martin, and Sebastien Goasguen. “An Evaluation of KVM for Use in Cloud Computing.” 2nd International Conference on the Virtual Computing Initiative (ICVCI ‘08), Durham, NC, May 2008. PDF 

  2. QEMU/KVM Virtual Machines. Proxmox VE Wiki. 

  3. Christian González. Selecting the Right CPU Model on KVM x86 Hosts. OpenNebula Blog. December 10, 2019. 

  4. Petr Kotas. How VM is started. oVirt Blog. September 21, 2017. 

  5. VirtualBox Frequently Asked Questions for Developers 

  6. Hosts. QEMU Wiki. 

  7. ChangeLog/6.2. QEMU Wiki. 

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.