Set up a Linux host on macOS#

How-to · First-time users

shirudo builds and runs on Linux only, and its test VM needs KVM. On a Mac, a Lima VM takes the place of the Linux host the Quickstart asks for: it is the operator host, and the test VM, the target, runs inside it with nested virtualization. infra/lima/shirudo.yaml sets that VM up.

Where

What runs there

The Mac

limactl, and the checkout you start the VM from.

Lima VM, as the operator

Ubuntu 26.04 on arm64 with clang and LLVM 23 and every package the quickstart lists. It builds in your checkout, which it shares with the Mac.

Test VM, as the target

The bpf-next kernel and the runtime image, with a software TPM (swtpm) inside the Lima VM. The Mac’s own hardware takes no part.

Before you begin#

  • An Apple M3 or later running macOS 15 or later. Earlier Macs, Intel ones included, offer no nested virtualization, and the test VM does not boot without it.

  • Lima 2.2 or later (limactl --version), for instance from Homebrew (brew install lima).

  • About 100 GiB of free disk and 8 GiB of memory for the VM.

  • A checkout of shirudo on the Mac.

Create the VM#

  1. In the root of your checkout, create and start the VM. checkout names the checkout, which the VM shares at the same path:

    $ limactl start --name=shirudo-dev --param checkout="$PWD" infra/lima/shirudo.yaml
    
    Using a Git worktree

    If you’re using a Git worktree, run the command below to share the repository too.

    $ limactl start --name=shirudo-dev --param checkout="$PWD" \
        --mount="$(git rev-parse --path-format=absolute --git-common-dir)" \
        infra/lima/shirudo.yaml
    

    The VM takes 8 GiB of memory and Lima’s default of at most 4 CPUs. Add --cpus=<count> to give the VM more CPUs.

  2. From your checkout, open a shell in the VM:

    $ limactl shell shirudo-dev
    

    The shell opens in your checkout. An edit on the Mac shows up in the VM at once, and the build writes its output, build/ and artifacts/ among it, into the checkout. build/test-vm is a link to the VM’s own disk: QEMU and swtpm need Unix sockets, which the shared checkout does not carry.

  3. Check that the VM can run the test VM. /dev/kvm must be readable and writable, and the locked-memory limit must be unlimited:

    $ test -r /dev/kvm && test -w /dev/kvm && echo kvm ok
    kvm ok
    $ ulimit -l
    unlimited
    

Continue with the quickstart#

In the VM shell, start the quickstart at Use the test kernel artifact. Every operator$ command runs in the Lima VM. The quick guides and Develop locally work the same way; the VM has Docker for the registry and the collector of the latter.

Delete the VM#

When you are done, delete the VM and its disk from the Mac:

$ limactl delete --force shirudo-dev

Troubleshooting#

limactl start fails with field `mounts[0].location` must be an absolute path

The command did not pass --param checkout=<path>.

limactl start fails on nested virtualization or on the probe for nested KVM

The Mac does not offer nested virtualization: it is older than an M3 or runs a macOS before 15.

The test VM state path probe fails, or make vm cannot create the vTPM keys

If build/test-vm is a directory in the shared checkout, Lima leaves it in place. Ubuntu’s AppArmor profile denies swtpm writes there. After stopping any test VMs that use that directory, move it aside and link the path to the Lima VM’s disk. Run these commands in the checkout from the Lima shell.

operator$ mkdir -p "$HOME/test-vm" && \
    mv -T build/test-vm "build/test-vm.saved-$(date +%Y%m%d-%H%M%S)" && \
    ln -sT "$HOME/test-vm" build/test-vm

Retry the step that boots the test target. The saved directory holds the logs and state from the earlier run.