Setting up KVM on Raspberry Pi 3 using a 64bit openSUSE Pi3 Leap 42.2 xfce image

Obligatory Raspberry Pi 3 Model B Image

This story begins how most stories begin, browsing github issues and tech forums to hope that someone is going or has gone through the process of getting a working kvm virtualization on the Raspberry Pi 3. For me, things started looking good after I stumbled into this particular issues thread on github. That eventually led me to this post about the release of openSUSE Pi3 Leap 42.2 64bit image for the raspberry pi. If you are like me and have been searching le interwebs for this exact product this probably looked too good to be true but lo and behold here we are.

Without further ado, this is what I did to get kvm setup on my Raspberry Pi 3 model B:

# Download the opensuse 64bit image for raspberry pi 3

1. Download the opensuse Leap 42.2 xfce image from the HCL website here. This is the only 64 bit aarch image for the raspberry pi 3 right now…I tried about everything from ubuntu snappy to centos7 to le fedora but with no cigar. This OS image comes with the kvm kernel module automatically installed. NOTE: LVDS display (e.g. raspberry pi 7 inch display) won’t work with this image. If you don’t have an HDMI capable display close by, don’t worry because I manage to get a remote display working through remote desktop (xrdp) by leveraging this guide — I explain this later.

# Preparing the SD card.

2. I used Etcher to flash the 64bit xfce image to the SD card.

# Installing the image

3.1 Insert the SD card with the openSUSE image into your board.

3.2 Connect the board to your PC via HDMI or serial port (optional, but helpful for debugging; USB-TTL serial cable needed). I didn’t use this initially but I strongly recommend it so you can get insight into what’s going on asap… I kinda flew blind and crossed my fingers a lot when I got to the images without display support. Any HDMI version 1.3a and below are guaranteed to work. The serial port details should be either serial0 at 115200 or ttyAMA0 at 115200.

3.3 For an easy first connection, I recommend using Ethernet but if you’d like you can setup wifi through the serial port using by leveraging this guide.

3.4 Power on the board and walk through the boot process. If you are flying blind, I timed this process on my board and it took 5 minutes.

3.4.1 After this process is finished you can connect to the board using ssh if know what ip the board is running on. You can also login through the serial interface. The default login is root:linux, works on serial console, via ssh, or GUI. I connected using ssh to my raspberry pi running at 192.168.1.86.

ssh root@192.168.1.86

3.5 Update the package manager by running

sudo zypper update

If you have network issues related to ipv6 then edit the /proc/sys/net/ipv6/conf/all/disable_ipv6 file and change the value from 0 to 1.

# Installing xrdp to enable GUI through Remote Desktop

Part of the reason I chose the xfce image is so that I can easily setup remote desktop on my pi.

4.1 Open a terminal and run

sudo zypper install xrdp

Then run

echo xfce4-session >~/.xsession

4.2 Restart the xrdp session.

sudo service xrdp restart

NB: You will have to do this everytime you reboot the board.

4.3 You can now use remote desktop on windows or Mac to connect to your pi.

This is what it looked like for me. My pi was running at 192.168.1.86. Password is linux.

After connecting you should then see a screen that looks like this

# Installing libvirt and virt-manager

KVM running on virt-manager

Like I said, this image already has kvm kernel modules enabled automatically. From here we will just install libvirt and virt-manager. Virt-manager makes it easy to create and manager guest virtual machines by providing a graphical interface.

5.1 Install qemu uefi support, libvirt, and virt-manager by running

sudo zypper install qemu-uefi-aarch64 libvirt virt-manager

5.2 Restart the libvirtd service by running

sudo service libvirtd restart

NB: again, you will have to do this everytime you reboot the board.

5.3 type virt-manager on the terminal to bring up the virt-manager

virt-manager kvm not yet connected.

5.4 Double click the QEMU/KVM selection to connect. If you see something that says that libvirtd daemon is not running then you need to restart the libvirtd service like I did above and try again. if not you should see the Not Connected status go away.

With that we have officially connect KVM to run on pi3. From here you can create a new virtual machine by going to File>New Virtual Machine. Doing that should produce a pop-up like the image at the title of this section. Follow the instructions and configure your VMs to run with KVM!

Hack happily,

VN

Like what you read? Give Valentine Nwachukwu a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.