A few years ago, people were saying they were able to emulate a Raspberry Pi 2 or 3 in QEMU. However as of late 2020, I am unable to do so. Can anyone let me know what the correct command line arguments are to emulate a Raspberry Pi 3 or 4 in either 32- or 64-bit mode is today? My goal is 64-bit Raspberry Pi OS. I have Qemu 5.1.0 installed.

  • 3
    "I am unable to do so" - what have you tried? What command line do you use, that fails? Please edit the question and add the information there. Please don't use a comment.
    – Ingo
    Sep 30, 2020 at 10:52
  • I usually use Docker to manage my images. If you install QEMU and the right binfmt configuration, you can simply run the ARM version of Raspbian inside of a Docker container, and you don't have to configure QEMU manually. I explained the process in this answer. It works great for running applications or compiling code natively. If you want to emulate the entire boot process and the kernel etc., you'll probably have to use QEMU from the command line.
    – tttapa
    Sep 30, 2020 at 15:05

4 Answers 4


You can use

qemu-system-arm -machine type=raspi2 -m 1024 -kernel vmlinux -initrd initramfs
qemu-system-aarch64 -machine type=raspi3 -m 1024 -kernel vmlinux -initrd initramfs

The kernel and initramfs you can find on the first partition of your SD card or extract from the OS image for a Raspian Pi.

If you want a 64bit OS then you need to use qemu-system-aarch64 with the raspi3 type and a 64bit kernel.

Note: qemu only emulates some aspects of the Rapsberry Pi. Linux kernel can be build generic enough to handle the differences on the fly but that depends on what your distribution has configured for the kernel. You might have to get a more generic kernel for it to boot properly.

  • What processor (intel, arm) is used to run the guests kernel?
    – Ingo
    Sep 30, 2020 at 16:34
  • A cortex-a52 or cortex-a72 I believe. You can set the processor independently using -mcpu=.... qemu has a long list of options. Sep 30, 2020 at 16:37
  • There is no obvious initial RAM disk in /boot. Do you mean bootcode.bin? There are 4 kernels in /boot. (kernel7.img kernel7l.img kernel8.img kernel.img) Which one to use?
    – wudude
    Oct 1, 2020 at 14:49
  • Maybe your distribution has none. You can boot linux without one. It's just not very common to do so. Oct 1, 2020 at 16:53

What you are asking for precisely is apparently not yet possible for a normal user without developments.

Firstly, QEMU 5.0.0 does not support Raspberry Pi 3 or 4:

% qemu-system-arm -version          
QEMU emulator version 5.0.0 (Debian 1:5.0-5ubuntu9.2)

% qemu-system-arm -M help|grep rasp
raspi2               Raspberry Pi 2B

See also https://wiki.qemu.org/Documentation/Platforms/ARM#Supported_Machines.

I don't have qemu version 5.1.0, please check.

Secondly, the latest Raspberry Pi OS Buster uses 32 bits, see https://www.raspberrypi.org/software/operating-systems/.

64 bits is unnecessary as long as Raspberry Pi does not have more than 4GB of RAM.

Indeed I see that Raspberry Pi 4 can have up to 8GB of RAM now and that 64 bit OS is coming:



I can answer for Raspberry Pi 2 with Raspberry Pi OS Buster 32 bits, if you are interested, let me know.

  • Yes if you can prove that I can emulate the Rpi 2 in 32-bit mode that would be helpful. So far I have had no luck. I'm running Qemu on the Rpi4.
    – wudude
    Jan 31, 2021 at 21:25
  • I have stock qemu 4.2.1 from Ubuntu 20.04 repositories. It seems to support Raspberry Pi 3 emulation, but only with qemu-system-aarch64. Jun 19, 2021 at 19:40
  • 2
    qemu-system-arm only emulates 32-bit CPUs, which is why it only supports up to the Pi 2. Since the Pi 3 and later have 64-bit CPUs, you need to use qemu-system-aarch64 instead. 64-bit is backwards compatible with 32-bit programs, so you can still use qemu-system-aarch64 to run a 32-bit OS if you wish, just like on the real hardware.
    – Malvineous
    Jul 3, 2021 at 14:59

After many trials, I could emulate my Raspberry Pi 2 with this:

qemu-system-arm \
  -M versatilepb \
  -cpu arm1176 \
  -m 256 \
  -drive "file=raspbian_backup-2.img,if=none,index=0,media=disk,format=raw,id=disk0" \
  -device "virtio-blk-pci,drive=disk0,disable-modern=on,disable-legacy=off" \
  -net "user,hostfwd=tcp::5022-:22" \
  -dtb versatile-pb-buster-5.4.51.dtb \
  -kernel kernel-qemu-5.4.51-buster \
  -append 'root=/dev/vda2 panic=1' \

where raspbian_backup-2.img is the image of my personal Raspberry Pi 2 micro SDcard.

Unfortunately, I did this a few weeks ago and don't remember much more.

I use Ubuntu 20.10 with up to date packages.

One problem when trying this is that QEMU reacts slowly (at least on my old machine) so it may look as if stuck.


I don't like these parameters :

-m 256 -M versatilepb

I tried to do something like this :

virt-install --name pi
--machine raspi3
--cpu arm1176
--memory 1024 \ --import \ --disk /root/Desktop/zi/Work/Android/Raspy/Debian/2019-09-26-raspbian-buster-lite.img,format=raw,bus=virtio --network user,model=virtio
--video vga
--graphics spice
--rng device=/dev/urandom,model=virtio
--boot 'uefi=RPI_EFI.fd,dtb=bcm2710-rpi-3-b-plus.dtb,kernel=kernel8.img,kernel_args=root=/dev/vda2 rootwait panic=1 dwc_otg.fiq_fsm_enable=0'
--events on_reboot=destroy

But I get this error :

ERROR internal error: Unexpected enum value 0 for virDomainDeviceAddressType

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.