Run Your First Yocto Image in QEMU With runqemu
After bitbake core-image-minimal finishes, runqemu boots it in QEMU with no board. Here are the options for graphics, networking and getting out again.

A finished Yocto build leaves you holding a root filesystem and a kernel, and no way to know whether they work. Flashing a board for that is slow, and a first image is the wrong thing to risk on hardware. The Yocto Project ships a script for this: runqemu boots the image you just built in QEMU, the machine emulator, using a configuration file the build wrote beside the image. This post shows the three commands that matter, what the boot output looks like, how to get network access without root rights, and how to leave the emulator, using Scarthgap 5.0 LTS. It continues from the build host post, which produced the image.
What runqemu does for you
QEMU needs a long command line: the machine type, the CPU, the memory size, the kernel, the root filesystem as a disk, the kernel command line and a network setup. Writing that by hand for each machine is tedious and varies by architecture. When a build finishes, it writes a file called <image>-<machine>.rootfs.qemuboot.conf into tmp/deploy/images/<machine>/, and that file records the right answers for the machine you built. runqemu reads it, assembles the QEMU command, and starts it.
The script is on your PATH once you have sourced oe-init-build-env, and it uses the build directory's variables to find the images. The QEMU binary itself comes from the build: the qemu-system-native recipe is built as part of the image dependencies for QEMU machines, so you do not need to install QEMU on the host.
The simplest boot
Source the environment, then name the machine:
cd ~/poky
source oe-init-build-env build
runqemu qemux86-64 nographicrunqemu finds the newest core-image-minimal in tmp/deploy/images/qemux86-64/ when you do not name an image. The nographic keyword disables the graphical window and puts the guest's serial console on your terminal, which is the right mode over SSH or in a terminal pane.
Without a network option, runqemu normally sets up a TAP device, which needs root rights, and it may ask for sudo. The next section avoids that. A typical boot then scrolls past the BIOS, the kernel's messages and the init system, and ends at a login prompt like this:
Poky (Yocto Project Reference Distro) 5.0.5 qemux86-64 ttyS0
qemux86-64 login:The version number comes from your Poky point release. Log in as root. A default core-image-minimal built from local.conf.sample in Scarthgap has the debug-tweaks image feature on, which allows a root login with an empty password. If your local.conf does not enable it, you will be asked for a password that does not exist, which is the intended protection for a real product.
Networking without root: slirp
User-mode networking, called slirp, runs in QEMU itself and needs no privileges on the host. Add the slirp keyword:
runqemu qemux86-64 nographic slirpThe guest gets an address in the 10.0.2.0/24 network, the host appears as 10.0.2.2, and the guest can reach the outside world through the host's connection. The reverse direction is not automatic: to reach the guest from the host, runqemu forwards a few ports. The guest's port 22 appears on the host at port 2222, and port 23 at 2323, according to the script's own documentation, which you can read with runqemu help. Check the exact mapping there for your release, because the default forwards are a script detail. Then from a second terminal:
ssh -p 2222 [email protected]That works only if the image has an SSH server. core-image-minimal does not; add the ssh-server-dropbear image feature to your image or use core-image-full-cmdline, which is the topic of the custom-image post in this series.
Slirp is slower than a TAP device and cannot do everything, for example it does not pass ICMP the way a real network does, so ping to the outside from the guest may fail while TCP works. That limit belongs to user-mode networking, not to your image.
Booting with a graphical window
For images with a graphics stack such as core-image-sato, drop nographic:
runqemu qemux86-64 core-image-sato slirpA window opens with the guest's display. By default runqemu picks SDL or GTK according to what the host's QEMU build supports, and you can force a choice with sdl, gtk or vnc-style keywords as listed in runqemu help. On a headless build server, the nographic mode, or publicvnc, is usually what you want.
Other keywords worth knowing
runqemu accepts its options in any order, and it identifies each by shape. The keywords you will use most often:
| Keyword | Effect |
|---|---|
nographic | No window, serial console on the terminal |
slirp | User-mode networking, no root needed |
kvm | Use KVM acceleration when the host and guest architectures match |
qemuparams="-m 1024" | Pass extra arguments straight to QEMU |
bootparams="..." | Append to the kernel command line |
ext4, cpio.gz and similar | Choose the rootfs image type |
core-image-minimal | Name the image recipe instead of taking the newest |
The kvm keyword helps only on x86-64 hosts running an x86-64 guest, with KVM enabled and permission to use /dev/kvm. For other architectures, QEMU emulates the CPU and the guest is much slower. Do not assume a speed number from one machine to another.
Run runqemu help for the list that belongs to your checkout. The script is part of Poky at scripts/runqemu, and reading it is the most reliable documentation.
Look around inside the guest
Once you are logged in as root, a few commands confirm that the image is what you built:
uname -a
cat /etc/os-release
ls /Linux qemux86-64 6.6.52-yocto-standard #1 SMP PREEMPT_DYNAMIC Mon Jan 1 00:00:00 UTC 2025 x86_64 GNU/Linux
ID=poky
NAME="Poky (Yocto Project Reference Distro)"
VERSION="5.0.5 (scarthgap)"
VERSION_ID=5.0.5
VERSION_CODENAME="scarthgap"
PRETTY_NAME="Poky (Yocto Project Reference Distro) 5.0.5 (scarthgap)"
CPE_NAME="cpe:/o:openembedded:poky:5.0.5"
bin dev home lib64 media proc sbin tmp var
boot etc lib media mnt run sys usrThe kernel version, build date and point release in these lines belong to your build and will differ. What stays the same is the shape: the distribution identifies itself from the DISTRO setting, and /etc/os-release is where it says so. Scarthgap's default kernel is a 6.6 series, which is why the example shows 6.6; if you see a different one, trust your own output.
The directory listing is deliberately small. A minimal image holds BusyBox, the init system and little else, with no compiler, no package manager and no editor beyond vi.
Leaving QEMU
In nographic mode, the terminal is connected to the guest's serial port, so Ctrl+C goes to the guest. QEMU's own escape sequence is Ctrl+A followed by x:
QEMU: TerminatedPress Ctrl+A, release it, then press x. QEMU prints that line and exits, and your host terminal returns. You can also run poweroff inside the guest for a clean shutdown, which is the better habit because it lets the root filesystem sync. For a read-write ext4 image, a hard kill is like pulling the power from a real device, and the filesystem may need a check on the next boot.
If the terminal looks broken afterwards, run reset.
When runqemu will not start
It stops with a message that it cannot find a kernel or rootfs: you ran it from outside the build environment, or
MACHINEdoes not match the images intmp/deploy/images/. Sourceoe-init-build-envand name the machine.It asks for
sudoand fails to createtap0: useslirp, or set up TAP devices as the Poky manual describes.The window never appears over SSH: use
nographic.


