I got two virtual machines with native virtualization support running on a Raspberry Pi 3 using openSUSE Leap. A Raspberry Pi is still an amazing piece of hardware - an inexpensive pocket computer with a solid 4-core ARM Cortex-A53 core, which is powerful and capable. This modern CPU allow for hardware virtualization - Yes, your Raspberry Pi has build-in hardware virtualization (neat!)
Most Raspberry Pi flavors don’t compile kvm into their kernels - at least not the last time I tried to get libvirt and kvm running there. openSUSE does, and it’s super easy to get your virtual machine hypervisor running.
The steps on the Raspberry Pi are done in a terminal. Don’t worry - after the initial steps we will use
virt-manager from your laptop to connect to the Raspberry Pi via ssh, while having the comfort of a GUI at hand.
Installing openSUSE is easy going, if you have already flashed Raspbian or any other Linux distribution to a sd-card. Get the corresponding images from here, and copy the raw images to your sd-card. There are many tutorials on how to do this your operating system - Google is your guide :-)
From the repository, select the disk image you want to have. I used the JeOS image (Just enough OS - a minimal VM image with just enough system to boot in a VM) openSUSE-Leap-15.1-ARM-JeOS-raspberrypi3.aarch64-2019.05.17-Snapshot1.105.raw.xz because we want to have as much RAM as possible for the guests. With only 1GB on the Raspberry Pi 3, a desktop system might consume a bit too much memory per se. Download the image, copy it to the SD card and boot into the system. Don’t use anything below 16GB, as the system+iso+disk images will need some space.
Boot into the system and ensure, you have ssh root access to your raspberry. I’m naming this one
raspberry3 in this tutorial.
Installing libvirt on the Raspberry Pi
Once the system is up, we only need to install
libvirt and enable the daemon. For that open a ssh session to your Raspberry Pi and type in the following commands
raspberry3:~ # zypper install libvirt libvirt-daemon raspberry3:~ # systemctl enable --now libvirtd
libvirtd is up and running
libvirt is now up and running. If not, try a
reboot before you go on. Ignore those error messages about CPU model cannot be detected for now.
Installing virtual machines
virt-manager from my Laptop to connect to the Raspberry Pi. Add a connection to your Raspberry Pi (In my case it’s 192.168.0.135, consult your router or do a quick
arp-scan to find out the IP address) and connect as
root (or as your user, assuming you are member of the
Now select the new connection and click on “Create a new virtual machine”.
Before proceeding, download the install iso. For this tutorial I suggest you use alpine or Debian, because they require minimal memory. I tried the procedure with openSUSE Leap, Ubuntu and CentOS and failed in all three causes, because the installed needs more than the provided 768MB RAM I could spare. alpine and debian both work just fine with 256 MB (!!) RAM
raspberry3:~ # cd /var/lib/libvirt/images raspberry3:~ # wget https://cdimage.debian.org/debian-cd/current/arm64/iso-cd/debian-10.4.0-arm64-netinst.iso
Once completed, you can go on in
virt-manager with installing the virtual machine from an ISO. I used 256MB ram and 2 cores and a disk image of 4 GB for both distributions.
The procedure is self-explaining and straight-forward (normally). I didn’t encountered any peculiarities or difficulties for both distributions. In the end I had them both up and running. Both work like charm, are super slim and feel fast and responsive. Time to be very happy about your achievement :-)
virt-manager, the raspberry pi and two ssh sessions to the virtual machines open
The Raspberry Pi 3 is already quiet powerful, if you use the right software - with openSUSE you have a mainstream distributions that has build-in kvm support for the used Cortex-A53 CPU - allowing for hardware virtualization. While the CPU per se could be enough for some small projects, the amount of memory is a bit deflating for virtualization usage. The newer Raspberry Pi 4 has up to 4 GB 8 GB of RAM and this might become a very interesting small hypervisor platform for me, once openSUSE Leap becomes available/stable there :-)
However, the procedure to setup and run a virtual machine on a Raspberry Pi 3 running openSUSE is IMHO straight-forward, painless and fun :-)
Updated the RAM of the Raspberry Pi 4 to include the new 8 GB variant. Thanks to Linda de Mol for pointing this out!