How to Test Shirudo on Ubuntu
Test Shirudo on Ubuntu 26.04 by signing a sample security program on your computer, then loading it inside a Linux virtual machine.

On this page 10 sections ▾
TL;DR
- Ubuntu builds and signs the sample. A separate Linux virtual machine runs it with the kernel that Shirudo needs.
- You will test how Shirudo restricts access to its protected state, then load and remove a signed sample program without running an exploit.
Shirudo is an open-source project from OpenAI and Cisco that lets Linux administrators apply temporary protections while preparing permanent patches. This lab uses Ubuntu 26.04 on x86-64 to sign a harmless sample and run it in a separate protected virtual machine. The walkthrough follows the project documentation and still needs an independent end-to-end test.
#How Shirudo works: operator and target
This lab uses two roles. Your Ubuntu computer acts as the operator, building and signing small programs called upatches. A separate target virtual machine checks signatures and loads the programs. QEMU runs the target using Linux’s KVM hardware virtualization support.
#What is BPF and why does Shirudo use it?
BPF (Berkeley Packet Filter) was originally developed to filter network traffic. Its modern form, eBPF, lets small programs run at specific points in the Linux kernel, for example to monitor or block file access.
Shirudo uses signed BPF programs to apply temporary protections without restarting the target. It needs a specially patched Linux development kernel that can enforce these protections. The standard Ubuntu kernel can run the operator tools.
The repository’s test scripts create and boot the target VM with the required kernel. Your Ubuntu operator keeps its existing kernel.
Run blocks labeled Ubuntu on the operator. After you connect to the target in step 5, run blocks labeled Shirudo VM in that session.
#1. Prepare Ubuntu
Use a dedicated x86-64 computer running Ubuntu 26.04 LTS. You can also use an Ubuntu VM if your hypervisor supports nested virtualization, which allows one VM to run another. Take a snapshot of the Ubuntu VM before building Shirudo.
If Ubuntu itself is a VM, suggested starting resources are 4 virtual CPUs, 8 GiB RAM and 100 GiB disk. You need internet access and sudo privileges on Ubuntu.
Open a Bash terminal on Ubuntu and run these checks. Look for Ubuntu 26.04 in the first output, x86_64 in the second, and an existing /dev/kvm device in the third. The last two commands show available disk space and whether /tmp uses RAM-backed storage. If virtualization or available storage is insufficient, see Troubleshooting before proceeding.
| 1 | cat /etc/os-release |
| 2 | uname -m |
| 3 | ls -l /dev/kvm |
| 4 | df -h /tmp "$HOME" |
| 5 | findmnt -T /tmp |
#2. Install the required software
The operator needs tools to build Shirudo, sign upatches and run the target VM. Here are the main components:
- QEMU/KVMRuns the protected target VM.
- DockerBuilds the components used to create the guest.
- Clang/LLVMCompiles BPF programs, which run at supported kernel hooks.
- OpenSSLProvides the cryptographic operations used for signing.
- Software TPMEmulates a Trusted Platform Module (TPM), a security component that records measurements of the target’s state.
- MakeExecutes the build and VM setup instructions included in the repository.
Install the build tools and VM packages on your Ubuntu host. The list adapts the project’s Ubuntu configuration for x86-64.
| 1 | sudo apt update && |
| 2 | sudo apt install build-essential pkg-config python3 git gh curl ca-certificates gpg jq \ |
| 3 | openssl libssl-dev libcurl4-openssl-dev libelf-dev libluajit-5.1-dev \ |
| 4 | libtpms-dev libtss2-dev zlib1g-dev libzstd-dev libc6-dev \ |
| 5 | autoconf autoconf-archive automake libtool libltdl-dev \ |
| 6 | bc bison flex cpio debhelper dpkg-dev fakeroot kmod libdw-dev \ |
| 7 | libncurses-dev pahole rsync xz-utils zstd \ |
| 8 | qemu-system-x86 qemu-utils swtpm swtpm-tools tpm2-tools \ |
| 9 | libtss2-tcti-swtpm0t64 cloud-image-utils libguestfs-tools \ |
| 10 | dracut-core cryptsetup-bin e2fsprogs file openssh-client \ |
| 11 | iproute2 isc-dhcp-client |
Docker builds the VM bundle. If Docker Engine is already installed, keep it and skip the next command. On a fresh Ubuntu host, install Ubuntu’s Docker package. Installing it alongside Docker CE from Docker’s own repository causes a package conflict.
| 1 | sudo apt install docker.io |
Run the lab using your normal Ubuntu account rather than root. Your account needs access to Docker and KVM, as well as an unlimited locked-memory limit. Locked memory is RAM that cannot be moved to swap space; Shirudo requires this limit to be unlimited.
Warning
Only make these permission changes on a dedicated lab. Membership in the Docker group grants root-equivalent privileges, and unlimited locked memory removes a resource limit for your account.
| 1 | sudo systemctl enable --now docker && |
| 2 | sudo usermod -aG docker,kvm "$USER" && |
| 3 | printf '%s - memlock unlimited\n' "$USER" | sudo tee /etc/security/limits.d/90-shirudo-memlock.conf |
Log out of Ubuntu completely and log back in so the new permissions take effect. Check that you can access KVM and Docker and that the memory limit is unlimited.
| 1 | test -r /dev/kvm && test -w /dev/kvm && echo "KVM OK" |
| 2 | docker info |
| 3 | ulimit -l |
Continue only if you see KVM OK, Docker reports its server information without errors, and ulimit -l prints unlimited. If the checks fail, see Troubleshooting below.
#3. Build Shirudo
Shirudo has no stable release yet. This guide follows the November 26 quickstart. Save the commit ID printed below so you can return to the same revision if you repeat the lab.
| 1 | cd "$HOME" && |
| 2 | git clone https://github.com/shirudo-dev/shirudo.git && |
| 3 | cd shirudo && |
| 4 | git rev-parse HEAD |
Before running the installers, inspect the two scripts below. Press q to exit each file.
| 1 | less .github/scripts/install-clang.sh |
| 2 | less .github/scripts/install-static-libcrypto-deps.sh |
The compiler installer can change system-wide compiler links and package configuration. Run the following on your dedicated lab only after reviewing the scripts.
| 1 | sudo sh .github/scripts/install-clang.sh && |
| 2 | sudo sh .github/scripts/install-static-libcrypto-deps.sh && |
| 3 | /usr/bin/clang --version && |
| 4 | openssl version && |
| 5 | /usr/bin/clang --print-targets | grep -i bpf |
Confirm Clang reports version 23, OpenSSL is at least 3.5 and the compiler lists a BPF target. Download the test kernel and build Shirudo against its BTF (BPF Type Format) data, which describes the guest kernel’s types and structures. The build produces the main shirudo command and its signing helper, shirudo-build. Adding both directories to PATH lets your shell find those commands.
| 1 | testing/vm/kernel-artifact.sh fetch && |
| 2 | make BPF_VMLINUX_BTF="$PWD/artifacts/bpf-next-kernel-debs/vmlinux.btf" && |
| 3 | make BPF_VMLINUX_BTF="$PWD/artifacts/bpf-next-kernel-debs/vmlinux.btf" shirudo-build && |
| 4 | cat vendor/linux/.vmlinux-btf-source && |
| 5 | export PATH="$PWD:$PWD/tools/shirudo-build:$PATH" && |
| 6 | export SHIRUDO_BUILD="$PWD/tools/shirudo-build/shirudo-build" && |
| 7 | shirudo version && |
| 8 | shirudo bpm --help |
Check that the BTF source points to artifacts/bpf-next-kernel-debs/vmlinux.btf in your checkout, not /sys/kernel/btf/vmlinux. You should also see Shirudo's version and package-management help. Resolve any errors before continuing. Keep this Ubuntu terminal open in ~/shirudo so the environment variables remain available.
Get opnF in your inbox
Tech news for IT professionals that actually teaches you something.
Our promise to you: we'll be conscious about email quality/frequency, and your address will never be shared/sold.
#4. Start the protected VM
Still on Ubuntu, start the target using the repository’s Makefile. The scripts prepare and boot the guest with the patched kernel and a software TPM. LOCAL_STACK=0 skips optional development services.
| 1 | make -C testing vm VM_NAME=quickstart LOCAL_STACK=0 |
A Trusted Platform Module (TPM) is a security component that can record cryptographic measurements and sign evidence about them. Shirudo records upatch loads and removals in a measurement register for the current boot. An operator can compare signed evidence with expected measurements, a process called attestation. This VM uses a software TPM rather than a physical chip.
The guest boots directly from a kernel and its initial boot filesystem (initrd). Production targets use an authenticated unified kernel image, which combines the kernel and initial boot environment into a bootable image. The QEMU lab therefore does not reproduce all production boot measurements.
Wait for the VM ready message. Leave the VM running. If you return to the Ubuntu prompt, stay in that shell and skip the next block. If the command keeps the terminal occupied, open another Ubuntu Bash terminal and restore the environment:
| 1 | cd "$HOME/shirudo" && |
| 2 | export PATH="$PWD:$PWD/tools/shirudo-build:$PATH" && |
| 3 | export SHIRUDO_BUILD="$PWD/tools/shirudo-build/shirudo-build" |
#5. Sign, load and remove an upatch
We’ll use the project’s harmless sample program, basic.bpf.c. It demonstrates that an approved program can be loaded and removed. It does not attempt to exploit or fix a vulnerability.
Create the signed files on Ubuntu
The target needs access to the signed files you create on Ubuntu. The test scripts provide a shared directory for this purpose, so the lab does not require a package registry or separate management server.
The VM setup creates a signing key pair and configures the guest to trust the associated certificate. The private key stays on Ubuntu outside the shared directory. We’ll sign both the sample and an instruction to remove it.
The digital signature proves the program was signed by a trusted key and its contents have remained intact. First, inspect the supplied sample on Ubuntu.
| 1 | cat testing/fixtures/basic.bpf.c |
The VM setup generated the signing keys in a temporary directory on Ubuntu. Set KEYS to that directory, then build and inspect the signed sample.
| 1 | KEYS=/tmp/shirudo-test-vm-private-$(id -u)/operator-keys/keys |
| 2 | shirudo build testing/fixtures/basic.bpf.c \ |
| 3 | --keys-dir "$KEYS" --vmlinux vendor/linux/vmlinux.h -o basic.upatch && |
| 4 | shirudo upatch info basic.upatch |
The payload hash is a fingerprint of the sample program. The removal instruction uses this fingerprint to identify the exact program to unload.
| 1 | PAYLOAD=$(set -o pipefail; shirudo upatch info --json basic.upatch | jq -er '.payload_sha256 | select(test("^[a-fA-F0-9]{64}$"))') && |
| 2 | shirudo build --unload basic --payload-sha256 "$PAYLOAD" \ |
| 3 | --keys-dir "$KEYS" -o basic.unload.upatch |
You should now have both basic.upatch and basic.unload.upatch in your checkout. If either build failed, stop and resolve the error. Next, connect to the target using the SSH helper. SSH opens a command-line session inside the guest.
| 1 | make -C testing vm-ssh VM_NAME=quickstart |
You are now in a root shell inside the Shirudo VM. When you connect using Shirudo’s SSH helper, the shirudo command automatically uses the trusted runtime. Your two signed files are available in the shared checkout at /workspace/shirudo. Changes you make to the checkout inside the guest do not write back to Ubuntu.
Check the VM and load the sample
The VM contains two identical copies of Shirudo's executable. Only the one launched from its integrity-protected runtime image has authority to access Shirudo's protected state. Try the ordinary copy as root:
| 1 | /usr/local/bin/shirudo status |
The permission-denied response demonstrates that even the root account cannot use that copy of the program to read Shirudo’s protected state. Next, check that the trusted runtime reports Status: ok, with all health conditions marked OK and no upatches loaded on a fresh VM. Stop if these checks fail. For the optional attestation exercise, also run shirudo status --show-full and record its initial Chain value.
| 1 | cd /workspace/shirudo && |
| 2 | shirudo status --check |
Once the health check passes, load the signed sample and check that it is active and the target is still healthy.
| 1 | shirudo upatch load basic.upatch && |
| 2 | shirudo upatch list && |
| 3 | shirudo status --check |
Look for basic with LOADED set to yes and Status: ok. The target has accepted the signature and attached the program. This confirms the deployment workflow; the sample itself is not designed to block an attack.
Shirudo has no continuously running daemon or network listener. Its commands run when needed; after successful initialization, kernel-level enforcement remains active between commands.
Shirudo is designed to resist an attacker who has root access on the target but lacks the operator's signing key. It does not protect against a compromised kernel, compromised operator or stolen signing key, or prevent every denial-of-service attack.
Optional: if you saved the initial Chain value, run shirudo status --show-full in the guest and record the updated value. Type exit to return to Ubuntu and follow the project’s TPM verification exercise. Keep the Ubuntu shell with KEYS and PAYLOAD set. Reconnect to the guest to remove the sample. If skipping this exercise, stay in the guest shell.
Remove the sample
Run the signed removal instruction you created on Ubuntu. The first command ensures you're in the guest's shared checkout, including if you reconnected after optional attestation.
| 1 | cd /workspace/shirudo && |
| 2 | shirudo upatch unload basic.unload.upatch && |
| 3 | shirudo upatch list && |
| 4 | shirudo status --check |
The upatch list should now be empty and the target should still report Status: ok.
#Shut down the lab
To finish, type exit in the guest shell. Back on Ubuntu, stop the VM. Save any results you want to keep before deleting its state.
| 1 | make -C testing vm-stop VM_NAME=quickstart |
To repeat the lab using the same VM name, first delete its saved state. The following command removes the guest disk, TPM state and logs. Run it only after saving anything you need.
| 1 | make -C testing vm-clean VM_NAME=quickstart |
Deleting the target VM does not uninstall the tools or reverse changes to Ubuntu. If you used a disposable Ubuntu VM, discard it or restore your snapshot. On a spare computer, reverse the lab-specific memory-limit, group, compiler and temporary-storage changes only if they are no longer needed.
#Troubleshooting
If Shirudo fails to build or start, check the following:
- KVM device unavailableConfirm that CPU virtualization is enabled in firmware. If Ubuntu is itself a VM, expose nested virtualization to it and check
/dev/kvmagain. - Docker or memory checks failCheck the Docker service with
sudo systemctl status dockerand your group memberships withid. Ifulimit -lis not unlimited after a fresh login, check the PAM session limits. The upstream Ubuntu provisioning configuration also shows systemd manager-level settings. - Temporary storage runs outRun
df -h /tmpandfindmnt -T /tmp. If/tmpis mounted as tmpfs and too small, use disk-backed temporary storage on the dedicated Ubuntu lab. Save your work, runsudo systemctl mask tmp.mountandsudo reboot, then checkfindmnt -T /tmpandls -ld /tmpafter logging in. Confirm it is disk-backed and has sticky-bit permissions (drwxrwxrwt). To restore the original configuration, runsudo systemctl unmask tmp.mountand reboot. Do not do this on a shared or production machine. After rebooting, return to the step where you encountered the error. If you had already built Shirudo, return to~/shirudoand run the shell setup commands in step 4 before resuming. If a VM had been running, check its saved state and clean it before launching a fresh lab. - Build reports missing dependenciesCheck the first error against the developer guide. Confirm that Clang supports BPF with
/usr/bin/clang --print-targetsand that OpenSSL is at least 3.5. Do not replace system libraries on a production host.

Practice Linux administration
Practice Linux permissions and command-line administration with Security Pro’s server administration lessons, labs and quizzes in a simulated terminal.
#Frequently asked questions
Can I deploy Shirudo directly on Ubuntu instead?
Do I need a physical TPM to run the lab?
If you completed the lab successfully, you’ve verified that Shirudo can load and remove signed programs on the Linux target and report its protected state.
SourcesOpenAI announcementShirudo quickstartShirudo developer guideUbuntu provisioningDocker permissionsShirudo installationShirudo local developmentShirudo operator and targeteBPF introductionShirudo overviewShirudo threat modelShirudo TPM guideShirudo BTF guideShirudo versionsDocker Engine on Ubuntu
Get opnF in your inbox
Tech news for IT professionals that actually teaches you something.
Our promise to you: we'll be conscious about email quality/frequency, and your address will never be shared/sold.