Back up, recover and decommission a target#
shirudo refuses to paper over a state it cannot vouch for, so several failures have one way out: a reboot. One has no way out in place. This page lists what to back up, how to get a target out of each state that blocks it, and how to take a target out of service.
Every procedure here works with shirudo as it is. Where no recovery exists, the page says so.
Before you begin#
Root on the target. On the target,
shirudostands for the runtime image’s binary,/run/shirudo/runtime/usr/bin/shirudo(Run shirudo on the target).For a decommission, the operator host that builds and signs the target’s UKI.
What to back up#
Item |
Why it matters |
|---|---|
|
The target’s measurement history across boots. Nothing else holds it, so it is evidence you cannot recreate. |
|
The config activation journal: each activation with its TPM reset and restart counts. Evidence, tied to this target’s TPM. |
|
The runtime image and every config bundle the target has activated, named by root hash. The operator holds the originals. |
|
The upatch archive that |
|
Host files: |
|
The runtime drop-ins of the shirudo units. |
On the operator host |
The signing keys (Manage signing keys), the image source directories and bootstrap files, the UKI build inputs, and each target’s attestation key name, endorsement key pin and expected values (Attest targets). |
Back up a target#
The seal stops writes to /var/lib/shirudo but not reads, so root can
copy the state while enforcement is up.
Archive the state and the host configuration:
target# tar --create --gzip --file=<archive> /var/lib/shirudo \ /etc/shirudo /etc/systemd/system
<archive>is a path outside/var/lib/shirudo, for example/root/shirudo-state.tar.gz.Save the journal of shirudo’s messages:
target# journalctl -t shirudo -o export > <journal-file>
Copy both files off the target.
Restore#
shirudo has no restore command, and while enforcement is up the seal
refuses root’s writes into /var/lib/shirudo. You cannot restore files
into a running target. Rebuild a lost target instead:
Provision it again (Boot integration, Initialize a target).
Install its packages from the registry (Deliver packages).
Keep the old eventlog, journal and activation journal with your records as the history of the old installation.
Do not copy an eventlog, an activation journal or the tree state
/var/lib/shirudo/bpm/upatch-tree/ onto another target. The tree
state records how far its own target got in the tree, and another
target would skip every operation up to that point.
Plan for eventlog growth#
The eventlog grows by one record for each boot, upatch load and unload, key revocation and tree operation. shirudo never rotates or truncates it, has no command to, and the seal stops root from doing it. In the test VM, the init record of a target with two certificates takes about 2 KB and a load adds a few hundred bytes:
target# shirudo status --show-full
...
Eventlog: /var/lib/shirudo/eventlog (2 entries, 2324 bytes)
...
Every command that reads the eventlog reads all of it, plus the pending
record of the initrd, and refuses when the two exceed 8 MiB (8388608
bytes). eventlog.max_bytes in the signed config sets a lower cap: at
the cap, upatch load and upatch unload, and the package and tree
commands built on them, refuse with eventlog_full.
init checks the same cap and the same read limit before it binds the
register, so a target whose eventlog reaches either one fails init at
every boot (init failed after it recorded the boot’s activation). At about 2 KB per boot,
that takes a few thousand boots with no other events, and fewer with
loads and tree operations.
Watch assets.eventlog_bytes in shirudo status --json or the
keepalive (Monitor and export telemetry), and decommission and reprovision a
target well before it reaches the limit.
Nothing removes old bundles from /var/lib/shirudo/images either.
Each config you activate stays there under its root hash, so size config
images with the --size option of shirudo-gen-image.
Recover a target#
Find the state from what the target shows, then follow its section.
What you see |
State |
Way out |
|---|---|---|
|
Reboot. |
|
The same, with |
Fix the cause and reboot. |
|
|
Boot the previous kernel, remove the upatch, boot the new one. If no kernel loads it, decommission. |
|
|
Reboot if you know the TPM was reset; otherwise handle an incident first. |
A config activation is pending#
Symptoms:
shirudo statusreportsreboot-pendingwith the reasona config activation is pending until the next reboot.shirudo image statusprintsPending: yesand exits 1.Every other command prints
shirudo: image state: Operation now in progressand exits 1.
Cause: shirudo image update stopped after it saved the pending
selection, or init failed after it recorded this boot’s activation
(init failed after it recorded the boot’s activation).
Read why in the journal:
target# journalctl -b -t shirudo
Reboot when it suits you. shirudo never reboots a node itself, and the node keeps running in this state with enforcement up.
Check after the reboot that
shirudo statusreportsokandshirudo image statusprintsPending: noandConsistent: yes.
At the next boot, init verifies the pending selection, records a
fresh boot activation and completes. There is no command that clears a
pending activation in the same boot, and the seal stops you from
removing the journal.
init failed after it recorded the boot’s activation#
init records the boot’s config activation before it restores the
archived upatches and binds the TPM register. A failure in either step
leaves the activation pending. The journal shows one of:
init: boot-restore failed; further changes and attestation remain blocked
init: incomplete: LSM active and upatches loaded, but the TPM register did not advance
In this state the LSM is attached and enforcement is up. The upatches
restored before the failure stay loaded, the register is not bound, and
shirudo status reports reboot-pending with the ChainIntact
detail no register bound this boot (init incomplete). Every command
that reads target state is refused, except status and image.
A second init in the same boot does not help. It stops with:
image: activation is pending; further changes are blocked
init: loading authenticated boot settings failed: Operation now in progress
Find the step that failed in the journal of both runs:
target# journalctl -b -u shirudo-initrd.service -u shirudo.service
Fix the cause. A cause in the boot inputs needs new boot inputs (Boot integration). An archived upatch that fails to load needs the next procedure.
Reboot.
An archived upatch no longer loads at boot#
Symptoms:
The journal shows
boot-restore: failed to apply <file>before theinitlines above.shirudo statusreportsreboot-pending, and commands other thanstatusandimage statusfail withshirudo: image state: Operation now in progress.
Cause: init restores the archive in name order and stops at the
first upatch that fails, without unloading what it already loaded. The
usual cause is a new kernel on which the upatch fails with
verifier_rejected, attach_target_missing or
kernel_abi_unsupported. For an XDP upatch, a line XDP: attach
<device> before it names a device whose driver refused the program: a
NIC added since the load, or a setting that survived the reboot, in the
NIC’s firmware or the hypervisor, such as LRO, header-data split or a
device without multi-buffer XDP.
init restores the same archive at every boot, so a reboot fails the
same way. These do not work:
A second
init: it refuses the pending activation.shirudo bpm uninstallandshirudo upatch unload: every command that reads target state is refused, exceptstatusandimage.Deleting the file from
/var/lib/shirudo/upatches: the seal refuses it.
For an XDP device, undo the setting or remove the device, and reboot. A device that cannot take XDP needs a upatch signed with a class mask that leaves it out. Otherwise remove the upatch from a boot on which it loads:
Before you reboot, read the name of the failed upatch:
target# journalctl -b -u shirudo-initrd.service
The line is
boot-restore: failed to apply <file>.Boot a kernel on which the upatch loads, usually the previous one, from its UKI in the boot menu. Its runtime image must still be where its UKI bootstrap file names it, in
/var/lib/shirudo/images.Check that
shirudo statusreportsok.Remove the upatch. Uninstall its package with
shirudo bpm uninstall <package>, unload it with its unload directive (shirudo upatch unload), or, for a upatch from the tree, publish adeleteoperation and let the tree sync apply it.Boot the new kernel’s UKI and check init as described in Initialize a target.
If no kernel loads the upatch, shirudo offers no recovery in place. Decommission the target and provision it again. To avoid the state, make sure every archived upatch loads on a new kernel before you reboot into it (Upgrade shirudo and the kernel).
TPM reset or restarted without a reboot#
The activation journal records the TPM’s reset count, which only a TPM
reset or TPM2_Clear changes. When it changes while the system runs:
Every command that reads target state, except
statusandimage, printsshirudo: image state: Stale file handleand exits 1.init,genkey,build,helpandversionskip that check.shirudo statusreportstamperedwith the reasonthe selected config cannot be verified against its records, andConfigActivereadsthe config activation record does not belong to this TPM boot.The register can be gone, which
ChainIntactreports as a warning.
A TPM restart, as a resume from hibernation does, keeps the reset count
but clears the config PCR and the register: commands print shirudo:
image state: Structure needs cleaning, and ConfigActive reads
the config PCR, activation records and mounted config disagree. A
resume from suspend to RAM keeps both, and the target runs on; a config
activation it finds pending stays pending until the next reboot.
If you know the TPM was reset or restarted, reboot. Do not run init
again: after a TPM reset it binds the register from the root file
system, which a verifier that pins PCR 11 rejects, and after a restart
it records nothing and refuses to bind. If you do not know why the
counts changed, handle the target as in
Respond to a tampered target before you reboot.
Hardening checklist covers turning hibernation off.
Decommission a target#
Enforcement cannot be switched off while the target runs: the LSM links are held by pins in the private bpffs that only shirudo could remove, and shirudo has no command that removes them. Taking a target out of service is a reboot into a boot path without shirudo.
Optional: uninstall every package, so the eventlog records each unload:
target# shirudo bpm uninstall <package>
Save the eventlog and the journal as the target’s last record, as in the backup procedure above.
Stop and disable the timers:
target# systemctl disable --now shirudo-keepalive.timer \ shirudo-map-export.timer shirudo-bpm-repo-update.timer \ shirudo-bpm-tree-sync.timer
Disable the root service:
target# systemctl disable shirudo.service
Remove the runtime drop-ins you installed (Install the unit drop-ins) and reload systemd:
target# systemctl daemon-reload
Remove the target package, which removes the binary, the units and the dracut module:
target# apt remove shirudo-target
On RPM-based systems, run
dnf remove shirudo-target.On the operator host, build and sign a UKI whose initrd does not contain the shirudo dracut module and whose kernel command line carries neither
bpf.keyring_unsealed=1nordm_verity.keyring_unsealed=1, and make it the target’s default boot entry. Without the module,shirudo-initrd.servicedoes not run. Without the parameters, the kernel seals the.bpfand.dm-veritykeyrings empty at boot. Regenerating the initrd on the target alone changes nothing a UKI boots. If the shirudo installer added the parameters, it wrote them throughgrubby, to/etc/default/grub.d/shirudo.cfgor to/etc/kernel/cmdline; remove them there too.Reboot the target.
Check that the kernel left the
.bpfkeyring sealed:target# cat /sys/module/bpf/parameters/keyring_unsealed
The file reads
N./run/shirudodoes not exist.Remove the state. The seal stopped root from doing this before the reboot:
target# rm -rf /var/lib/shirudo /etc/shirudo
On the operator host, retire the target: remove its attestation key name, endorsement key pin and expected values from your verifier’s records, so that no evidence from it passes verification again.
The register’s NV index 0x01818E00 stays defined in the TPM. If the
TPM goes to another use, remove the index with the owner hierarchy’s
authorization, for example with tpm2_nvundefine 0x01818E00 from
tpm2-tools.
Next steps#
Troubleshoot by symptom for messages by symptom
Respond to a tampered target when
statusreportstamperedUpgrade shirudo and the kernel to change the kernel without stranding a upatch
Files, paths and xattrs for every file shirudo keeps