Repository navigation
Conversation
[Medium impact] The PR appears safe to merge. SummaryRemoves boot-image pins left behind after Snapper deletes snapshots.
Reviews (2) · Last reviewed commit: "Drop the boot image pins of snapshots sn..." · Reviewed by Greptile |
|
No blocking defects found at On a disposable Omarchy ISO worker, a separate retention reproduction failed on |
|
@dhh @omarchybot dropping boot image pins for snapshots snapper has deleted is in #21027, on current Please consider closing this as superseded only after #21027 is accepted. Leaving the close to you. |
What changes
On systemd-boot,
omarchy-boot-sync pinrecords a snapshot's boot image in/.snapshots/N/omarchy-boot-image, next to snapper'sinfo.xml. When snapper deletes the snapshot it removes the subvolume and its own files and thenrmdirs the directory, which fails because the pin is still in it (Snapshot.cc(deleteSnapshot): rmdir '1' failed errno: 39 (Directory not empty)). The directory stays, holding only the pin.Nothing removes that pin, and
gc_imageskeeps the image of every*/omarchy-boot-imageit finds, so each image that was current when an update took its snapshot stays in/var/lib/omarchy/boot/imagesfor good: a kernel and an initramfs for every time either changed./.snapshotsalso collects one leftover directory per deleted snapshot. Boot entries, the ESP and restores are not affected, sincebootable_snapshotsalready asks forsnapshot/.The sync now drops the pin of a snapshot whose subvolume is gone, and the directory with it, before it publishes.
cmd_pinonly writes a pin oncesnapshot/exists, so a pin without one is always a deleted snapshot. The highest-numbered directory is left in place without its pin: snapper keeps that one on purpose so a snapshot number is never used twice. Machines that already have leftover pins are cleaned up by their next sync.Snapper still logs its failed
rmdirwhen it deletes a pinned snapshot. Removing the pin before the deletion (delete-snapshot-pre) would avoid that, but a deletion that then failed would leave a snapshot without its boot image.Verification
bash test/shell.d/boot-sync-test.sh: 9 ok. The existing tests modelled a deletion asrm -rf .snapshots/12, which is why this didn't show; the new one removes what snapper removes, and fails onquattrowith "a deleted snapshot's pin and the image only it named go".boot-restore-commit-test.shandboot-rebuild-test.shpass as before.Real snapper 0.13.2 on a loop-mounted btrfs in a throwaway container,
NUMBER_LIMIT=2, five pinned snapshots, with the boot store in a directory andukifystubbed as the shell test does:snapper cleanup number,1/,2/and3/remain with only their pin, and a sync keeps their three images5/, and the next snapshot is 6Not checked on a machine that boots systemd-boot: the store, the ESP and the btrfs top level were directories or a loop device throughout.
Screenshots
No visible change: boot entries and the snapshot menu list the same snapshots; only leftover pins and unused boot images go.