Virtual Machines with Incus on an Alpine Linux Host

By chimo on (updated on )

Before now, I'd only ever used Incus to run containers. I ran into a situation where I needed a virtual machine (VM) instead (more on that in a later post). This post documents my experience setting that up on an Alpine Linux host.

My first attempt was to just run incus launch images:alpine/3.21/amd64 alpine-vm --vm. I was greeted with “qemu-system-x86_64: executable file not found in $PATH”. Ah, so installing Incus doesn’t install the necessary “qemu” things to run VMs (at least on Alpine Linux). Completely understandable and a good move, in my opinion.

I then looked at Alpine’s Qemu wiki page (there is no Incus page, and the LXD page is pretty minimal). I installed the packages listed on that page, added myself to the proper groups, loaded the “tun” kernel module, but then was greeted with “QEMU failed to run feature checks”. This led me to this forum post that talks about installing the “ovmf” package.

By chance, I happened to look at the “ovmf” package’s “Required by” information and noticed a package called “incus-vm” which looks like depends on exactly what’s needed to run VMs on incus (…as the name suggests).

So I uninstalled all the qemu stuff I had installed and just installed the “incus-vm” package instead. To summarize:

  1. Install the incus-vm package.
  2. Add and enable the “tun” kernel module
    Otherwise, you might run into “failed to run ip tuntap add name[…]”
  3. Add your user to the “kvm” and “qemu” groups.
  4. Logout and login again so the group memberships takes into effect.

In command form:

apk add incus-vm
echo tun >> /etc/modules
modprobe tun
addgroup <username> kvm
addgroup <username> qemu
# Logout, login again

Create the VM:

Okay let’s try this again now that all the dependencies are installed:

incus launch images:alpine/3.21/amd64 alpine-vm --vm

Error: Failed instance creation: The image used by this instance is
incompatible with secureboot. Please set security.secureboot=false on the
instance

Nope.

After a web search or two, tried this:

incus launch images:alpine/3.21/amd64 alpine-vm --vm  \
    -c security.secureboot=false --device root,size=10GiB

Woo, no errors! (well, stay tuned for the next blog post in the saga).