Skip to content

Drop the boot image pins of snapshots snapper has deleted - #20278

Open
vovarbv wants to merge 1 commit into
omacom:quattrofrom
vovarbv:openclaw/drop-deleted-snapshot-pins
Open

vovarbv wants to merge 1 commit into
omacom:quattrofrom
vovarbv:openclaw/drop-deleted-snapshot-pins

Conversation

@vovarbv

@vovarbv vovarbv commented Nov 26, 2026

Copy link
Copy Markdown

What changes

On systemd-boot, omarchy-boot-sync pin records a snapshot's boot image in /.snapshots/N/omarchy-boot-image, next to snapper's info.xml. When snapper deletes the snapshot it removes the subvolume and its own files and then rmdirs 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_images keeps the image of every */omarchy-boot-image it finds, so each image that was current when an update took its snapshot stays in /var/lib/omarchy/boot/images for good: a kernel and an initramfs for every time either changed. /.snapshots also collects one leftover directory per deleted snapshot. Boot entries, the ESP and restores are not affected, since bootable_snapshots already asks for snapshot/.

The sync now drops the pin of a snapshot whose subvolume is gone, and the directory with it, before it publishes. cmd_pin only writes a pin once snapshot/ 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 rmdir when 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 as rm -rf .snapshots/12, which is why this didn't show; the new one removes what snapper removes, and fails on quattro with "a deleted snapshot's pin and the image only it named go". boot-restore-commit-test.sh and boot-rebuild-test.sh pass 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 and ukify stubbed as the shell test does:

  • before: after snapper cleanup number, 1/, 2/ and 3/ remain with only their pin, and a sync keeps their three images
  • after: the sync removes the three directories and drops the three images; snapshots 4 and 5 keep their entries
  • deleting snapshot 5 as well leaves an empty 5/, and the next snapshot is 6

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

@greptile-apps

greptile-apps Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The PR appears safe to merge.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Removes boot-image pins left behind after Snapper deletes snapshots.

  • Boot sync removes pins left by deleted snapshots.

Reviews (2) · Last reviewed commit: "Drop the boot image pins of snapshots sn..." · Reviewed by Greptile

@omarchybot omarchybot added bug Something isn't working verified Omarchy Triage has verified that this issue is ready for final review labels Nov 26, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

No blocking defects found at 723f305dc6e7466c97035befe01221dc140d018b. GPT-6 in Codex (reasoning effort not reported), Opus 5.5 High, and muse-wonder via pi (thinking high) reviewed the change. The panel agreed the fix is proportionate; review independence is not guaranteed.

On a disposable Omarchy ISO worker, a separate retention reproduction failed on quattro, passed on this head, and failed with the fix reverted. The CLI suite and 23 focused boot checks passed. Real Snapper 0.13.2 on loop-mounted Btrfs confirmed orphan-pin cleanup, live-pin preservation, and correct snapshot numbering, including deletion of the two newest snapshots before syncing. UKI building was stubbed; firmware boot was not tested. No branch changes were needed. The Tests and Check translation structure workflows require maintainer approval before CI can run.

@chessing234

Copy link
Copy Markdown
Contributor

@dhh @omarchybot dropping boot image pins for snapshots snapper has deleted is in #21027, on current omarchy-boot-sync and boot-sync-test.sh. It sits with the Limine sync check (#16510) and the nested restore path (#20876), which all touch the same boot/snapshot files.

Please consider closing this as superseded only after #21027 is accepted. Leaving the close to you.

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

Labels

bug Something isn't working verified Omarchy Triage has verified that this issue is ready for final review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants