LXD Virtual Machines Runing Perfectly In Raspberry Pi 4

I thought I’d share this information…

I have a Raspberry Pi 4 with 4GB RAM. It is running Ubuntu 20.04 LTS. And both LXC/LXD containers and Virtual Machines are running perfectly!

I had no idea that the Raspberry Pi supports Hardware Virtualization. I just tried it, for the hell of it and I was quite pleasantly surprised to find it working!

Furthermore, the cpu performance of the virtual machine is almost the same as bare metal. Using sysbench cpu test:-

Bare Metal: 1488 events per second
Ubuntu VM: 1478 events per second


P.S. I tried Ubuntu and openSUSE so far. Arch Linux image doesn’t work. It says access denied when trying to boot the QEMU hard disk. If I disable secure boot, then it goes straight to grub>


Great to hear!

We suspected that a rpi4 would be able to run virtual machines but I don’t have any around and only tested LXD VMs on arm64 using much fancier (rare & expensive) arm64 servers instead.

It’s great to hear that someone can just grab a rpi4 and run that as a LXD remote with both containers and VMs.

I believe I noted that in my VM forum post but SecureBoot on ARM is very much a novelty still so I would indeed expect having to turn it off for most distros at this time :slight_smile:

Thanks. Yes for $55 ($35 for the 2GB version), you can have a server running containers and VMs! Crazy times…

Yes I do have to disable the secure boot, but with the Arch image it does not even boot, instead I see the grub prompt (grub>).

Since, with VMs we are not limited to using Linux, will you be publishing images for FreeBSD, OpenBSD, etc?

Opened https://github.com/lxc/lxc-ci/issues/150 for tracking this one.

We could indeed offer other operating systems, though preparing their images is a bit harder as our tool, distrobuilder is rather Linux specific and doesn’t actually build any of the images inside a VM.

We’re looking to have it support repacking Windows images. A similar approach may be viable for the BSDs, though you may also be able to just create an empty VM (lxc init some-name --empty --vm) and then attach an ISO image and install it through lxc console.

1 Like

One of the best things about the VMs of LXD is that they are so lightweight and quick to download and deploy - almost container like. So it would be great to see more images in future :smile:

In the meantime, I would love to see a VM image of Alpine Linux, one of my favorite distributions - so lightweight and fast.

Also I see a Gentoo VM image but not for aarch64…

I suspect Gentoo was because of issues with arm64 bootloaders or something along those lines, @monstermunchkin may recall the exact issue.

For Alpine, we won’t distribute images until we can get the LXD agent working on that platform, which currently crashes immediately as Alpine doesn’t use glibc.

We have ongoing work to make the agent fully static, at which point Alpine images will be made available (assuming no other problems).

We don’t support Gentoo because it doesn’t provide a prebuilt kernel for aarch64.

Is it working with ZFS;

Hi, I have a quick question. I have Raspbian VMs with me with no access to hardware(Raspi boards) currently. I am trying to setup LXC/LXD containers on these VMs. Is that possible? Does Raspbian support cgroups and usernamespaces?

1 Like