Skip to content

The committed slot's firmware entry keeps its place in BootOrder - #679

Open
DevomB wants to merge 2 commits into
zbook-batch-5from
efiboot-keeps-place
Open

DevomB wants to merge 2 commits into
zbook-batch-5from
efiboot-keeps-place

Conversation

@DevomB

@DevomB DevomB commented Oct 29, 2026

Copy link
Copy Markdown
Owner

Every trial ended with kryptik-efiboot forget and then ensure. ensure appended the committed slot's entry last in BootOrder (kryptik-efiboot.c:338-347 before this change). A firmware that lists its network boot after the disks therefore put Kryptik's entry behind it, so each boot waited on the network first. Every update also undid any order the user had set in the firmware's setup.

  • kryptik-efiboot keep SLOT [ESP] runs forget, then puts the committed slot's entry where Kryptik's first entry stood in BootOrder, counted among the entries left. The entry is attempted even when forgetting fails, as forget-then-ensure did. It exits 1 when forgetting failed, 3 when only the entry failed, and 2 for a slot other than a or b, before anything is touched.
  • A new entry, from ensure, set-next, or keep with no Kryptik entry in the order, goes after the last BootOrder entry that does not boot from the network. An entry counts as network boot when its device path has a MAC, IPv4, IPv6 or URI node (type 3, subtype 11/12/13/24). So a new entry lands ahead of network boot that ends the order, but never ahead of another system's entry, wherever that entry is listed.
  • boot-success.sh (forget_entries) and kryptik-recover (commit_slot) call keep and map its status to their two existing messages. kryptik-recover runs under set -e, so it captures the status rather than letting a non-zero exit end the script. The installer still runs forget and then ensure, so a fresh install's entry gets the new placement.
  • Tests:
    • tools/tests/efiboot.sh: a new entry goes ahead of two network entries, behind another system's entry listed after the network, and first in an order that holds only network boot.
    • tools/tests/efiboot.sh: a trial entry goes behind the committed one, and after the commit slot b stands where slot a stood. An entry the user moved first stays first. keep exits 3 when the entry can't be made and 2 for slot c.
    • tools/tests/boot-success.sh: the stub takes keep, and the recorded calls are now efiboot keep a.
  • docs/design/boot-and-updates.md describes both rules.

The writes are the same as before (one BootOrder write for the forget, one for the entry), so what PCR 1 sees per trial is unchanged (tpm-unlock.md). Secure Boot, BOOTX64.EFI and BootNext handling are untouched.

Testing on physical hardware is planned for October 2026.

Every trial ended with forget and then ensure, and ensure appended the
committed slot's entry last in BootOrder. A firmware that lists network
boot after the disks put Kryptik behind it, so each boot waited on the
network first, and every update undid an order set in the firmware's
setup.

kryptik-efiboot gains keep SLOT [ESP]: forget, then the entry where
Kryptik's first entry stood. It exits 1 when the forgetting failed and 3
when only the entry did, so boot-success and kryptik-recover keep their
two messages. A new entry, from ensure or set-next, goes after the last
BootOrder entry that does not boot from the network (a MAC, IPv4, IPv6
or URI node), and so never ahead of another system's entry.
@DevomB
DevomB marked this pull request as ready for review October 29, 2026 15:10
DevomB added a commit that referenced this pull request Oct 29, 2026
…e in the boot order its slot's entry had, rather than going last

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant