Set up a Linux host on macOS#
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 |
|
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
( |
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#
In the root of your checkout, create and start the VM.
checkoutnames 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.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/andartifacts/among it, into the checkout.build/test-vmis a link to the VM’s own disk: QEMU and swtpm need Unix sockets, which the shared checkout does not carry.Check that the VM can run the test VM.
/dev/kvmmust be readable and writable, and the locked-memory limit must beunlimited:$ 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 startfails withfield `mounts[0].location` must be an absolute pathThe command did not pass
--param checkout=<path>.limactl startfails on nested virtualization or on the probe for nested KVMThe 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 vmcannot create the vTPM keys If
build/test-vmis a directory in the shared checkout, Lima leaves it in place. Ubuntu’s AppArmor profile deniesswtpmwrites 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.