Skip to content

eBPF-based security platform

lima: flag a conflicting test VM state path

Andrea Lattuada6558fb2df47b
diff --git a/Documentation/start/quickstart-macos.rst b/Documentation/start/quickstart-macos.rst
index c9aa988c..47b78a8f 100644
--- a/Documentation/start/quickstart-macos.rst
+++ b/Documentation/start/quickstart-macos.rst
@@ -121,3 +121,19 @@ Troubleshooting
``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.
+
+ .. code-block:: console
+
+ 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.
diff --git a/infra/lima/shirudo.yaml b/infra/lima/shirudo.yaml
index fe4f4624..d02a4271 100644
--- a/infra/lima/shirudo.yaml
+++ b/infra/lima/shirudo.yaml
@@ -105,6 +105,21 @@ probes:
exit 1
fi
hint: See /var/log/cloud-init-output.log in the guest.
+- description: test VM state path
+ script: |
+ #!/bin/bash
+ set -eu
+ state="{{.Param.checkout}}/build/test-vm"
+ if [[ -L "$state" ]]; then
+ [[ "$state" -ef "$HOME/test-vm" ]]
+ exit
+ fi
+ # User provisioning may still be about to create the link.
+ [[ ! -e "$state" ]]
+ hint: |
+ The checkout already has a build/test-vm path. See Troubleshooting in
+ Documentation/start/quickstart-macos.rst to preserve it and link the
+ path to the Lima VM's own disk.
message: |
From your checkout, open a shell in the Lima VM: