Skip to content

feat: prune old UKI .efi files during upgrade - #6

Merged
henrywang merged 2 commits into
mainfrom
clean-esp
Jun 4, 2026
Merged

henrywang merged 2 commits into
mainfrom
clean-esp

Conversation

@henrywang

Copy link
Copy Markdown
Owner

Keep only the current (new default) and previously-running UKI on the ESP; delete anything older. Without this, every upgrade added ~60-100 MB to the ESP until ukify failed writing a new image.

Pruning errors are non-fatal — the upgrade has already committed its boot entry by the time pruning runs, so a permission error on a stale file should not roll back a successful upgrade.

Add e2e test that plants a stale .efi before upgrade and asserts it is gone afterward with exactly 2 files remaining.

henrywang added 2 commits June 4, 2026 06:08
Keep only the current (new default) and previously-running UKI on the
ESP; delete anything older. Without this, every upgrade added ~60-100 MB
to the ESP until ukify failed writing a new image.

Pruning errors are non-fatal — the upgrade has already committed its
boot entry by the time pruning runs, so a permission error on a stale
file should not roll back a successful upgrade.

Add e2e test that plants a stale .efi before upgrade and asserts it is
gone afterward with exactly 2 files remaining.
The stage-specific pacman steps (rootfs-grub, rootfs-uki, rootfs-uki-sb)
used -Syu which performs a full system upgrade. When the Arch repos publish
a new kernel between the rootfs-common and rootfs-grub build steps, pacman
installs the new kernel's modules tree — including a vmlinuz placed there by
the linux package itself — but without a matching initramfs (dracut only ran
in rootfs-common for the original kernel).

cfsctl's UsrLibModulesVmlinuz::load_all then finds two kernel directories:
the original with initramfs and the upgraded one without. If the upgraded
kernel sorts first alphabetically, cfsctl panics at self.initramfs.unwrap()
in prepare-boot (upstream bug: should return a clear error instead).

Switch to -S --needed in the stage-specific steps so only the listed
packages are installed, leaving the kernel unchanged from rootfs-common.
@henrywang
henrywang merged commit 9dc62b1 into main Jun 4, 2026
4 checks passed
@henrywang
henrywang deleted the clean-esp branch June 4, 2026 14:08
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