Guides / Security / How to Test Shirudo on Ubuntu
Security · Guide

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.

opnF.shNov 25, 2026Updated Nov 27, 202612 min readshirudoubuntuebpf
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.

Shirudo OperatorUbuntu host: builds and signs upatches
→
Shirudo TargetQEMU VM: verifies and loads upatches
Only the target VM receives the patched kernel and Shirudo protection.

#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.

Ubuntu: check virtualizationBASH
1cat /etc/os-release
2uname -m
3ls -l /dev/kvm
4df -h /tmp "$HOME"
5findmnt -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.

Ubuntu: install packagesBASH
1sudo apt update &&
2sudo 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.

Ubuntu: install Docker if neededBASH
1sudo 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.

Ubuntu: configure permissionsBASH
1sudo systemctl enable --now docker &&
2sudo usermod -aG docker,kvm "$USER" &&
3printf '%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.

Ubuntu: verify permissionsBASH
1test -r /dev/kvm && test -w /dev/kvm && echo "KVM OK"
2docker info
3ulimit -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.

Ubuntu: download ShirudoBASH
1cd "$HOME" &&
2git clone https://github.com/shirudo-dev/shirudo.git &&
3cd shirudo &&
4git rev-parse HEAD

Before running the installers, inspect the two scripts below. Press q to exit each file.

Ubuntu: inspect scriptsBASH
1less .github/scripts/install-clang.sh
2less .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.

Ubuntu: install compilerBASH
1sudo sh .github/scripts/install-clang.sh &&
2sudo sh .github/scripts/install-static-libcrypto-deps.sh &&
3/usr/bin/clang --version &&
4openssl 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.

Ubuntu: build ShirudoBASH
1testing/vm/kernel-artifact.sh fetch &&
2make BPF_VMLINUX_BTF="$PWD/artifacts/bpf-next-kernel-debs/vmlinux.btf" &&
3make BPF_VMLINUX_BTF="$PWD/artifacts/bpf-next-kernel-debs/vmlinux.btf" shirudo-build &&
4cat vendor/linux/.vmlinux-btf-source &&
5export PATH="$PWD:$PWD/tools/shirudo-build:$PATH" &&
6export SHIRUDO_BUILD="$PWD/tools/shirudo-build/shirudo-build" &&
7shirudo version &&
8shirudo 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.

Ubuntu: start the test VMBASH
1make -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:

Ubuntu: restore shell setupBASH
1cd "$HOME/shirudo" &&
2export PATH="$PWD:$PWD/tools/shirudo-build:$PATH" &&
3export 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.

Ubuntu: inspect the sampleBASH
1cat 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.

Ubuntu: sign the sampleBASH
1KEYS=/tmp/shirudo-test-vm-private-$(id -u)/operator-keys/keys
2shirudo build testing/fixtures/basic.bpf.c \
3 --keys-dir "$KEYS" --vmlinux vendor/linux/vmlinux.h -o basic.upatch &&
4shirudo 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.

Ubuntu: sign the removalBASH
1PAYLOAD=$(set -o pipefail; shirudo upatch info --json basic.upatch | jq -er '.payload_sha256 | select(test("^[a-fA-F0-9]{64}$"))') &&
2shirudo 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.

Ubuntu: connect to the VMBASH
1make -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:

Shirudo VM: test accessBASH
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.

Shirudo VM: check statusBASH
1cd /workspace/shirudo &&
2shirudo status --check

Once the health check passes, load the signed sample and check that it is active and the target is still healthy.

Shirudo VM: load the sampleBASH
1shirudo upatch load basic.upatch &&
2shirudo upatch list &&
3shirudo 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.

Shirudo VM: remove the sampleBASH
1cd /workspace/shirudo &&
2shirudo upatch unload basic.unload.upatch &&
3shirudo upatch list &&
4shirudo 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.

Ubuntu: stop the VMBASH
1make -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.

Ubuntu: remove the VMBASH
1make -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:

  1. KVM device unavailableConfirm that CPU virtualization is enabled in firmware. If Ubuntu is itself a VM, expose nested virtualization to it and check /dev/kvm again.
  2. Docker or memory checks failCheck the Docker service with sudo systemctl status docker and your group memberships with id. If ulimit -l is not unlimited after a fresh login, check the PAM session limits. The upstream Ubuntu provisioning configuration also shows systemd manager-level settings.
  3. Temporary storage runs outRun df -h /tmp and findmnt -T /tmp. If /tmp is mounted as tmpfs and too small, use disk-backed temporary storage on the dedicated Ubuntu lab. Save your work, run sudo systemctl mask tmp.mount and sudo reboot, then check findmnt -T /tmp and ls -ld /tmp after logging in. Confirm it is disk-backed and has sticky-bit permissions (drwxrwxrwt). To restore the original configuration, run sudo systemctl unmask tmp.mount and 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 ~/shirudo and 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.
  4. Build reports missing dependenciesCheck the first error against the developer guide. Confirm that Clang supports BPF with /usr/bin/clang --print-targets and 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.

Open ›

#Frequently asked questions

Can I deploy Shirudo directly on Ubuntu instead?
Yes. A physical server or existing VM can be a target, but the package alone is not enough. The target needs a compatible patched development kernel, signed BPF loading, an active BPF LSM, TPM 2.0, trusted operator certificates, signed configuration and integrity-protected runtime images. Production boot requires an authenticated unified kernel image containing Shirudo's initrd. See the installation guide for the full requirements. QEMU is only needed for this particular test setup.
Do I need a physical TPM to run the lab?
No. The test VM uses a software TPM. That makes the lab useful for learning the workflow, but it is not a substitute for production trust configuration.

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.

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.