Skip to content

Integrate snapshot, snapper, and update-space fixes - #21027

Closed
chessing234 wants to merge 14 commits into
omacom:quattrofrom
chessing234:integrate/snapshot-update
Closed

chessing234 wants to merge 14 commits into
omacom:quattrofrom
chessing234:integrate/snapshot-update

Conversation

@chessing234

Copy link
Copy Markdown
Contributor

Why this is one review

These ten open PRs all change the path from "an update takes a snapshot" through "that snapshot can actually boot" and "a restore does not lose migrations or nested subvolumes." Reviewed apart, they conflict in bin/omarchy-snapshot, bin/omarchy-update-requires-free-space, install/config/snapper.sh, and the shell tests around them. Each one is a real failure mode (a regular .snapshots directory, a snapshot boot that looks like a full disk, metadata ENOSPC while df still shows space, a Limine sync that rejects the entry, snapper missing on aarch64, pins left behind after snapper deletes a snapshot, nested subvolumes flattened on restore, migrations not rerun after a restore, and an update that prunes the cache before it notices OMARCHY_PATH is wrong). Together they are one snapshot/update story.

Incorporated PRs

Authorship is the original commits, cherry-picked onto current quattro. Nothing here squashes another author's work onto this branch's owner.

PR Author What landed
#11287 @hussainanjar omarchy-snapshot create explains a .snapshots directory that is not a btrfs subvolume, and still prints the snapper number (-p) so the systemd-boot boot-entry check can see it. Cleanup does not run after a failed create.
#9893 @nontradition A low-space update still uses update.needsFreeSpace. When / is mounted from .snapshots/*/snapshot, it also says to reboot into the regular entry. No new i18n key.
#17399 @patcito tmpfiles plus a migration that lets btrfs reclaim partly used data chunks so metadata can get a new chunk.
#19674 @AnPod Snapper setup exits 0, with a reason, when snapper is missing or / is not btrfs. systemd-boot still enables cleanup without limine-snapper-sync.
#20278 @vovarbv Boot image pins for snapshots snapper has already deleted are dropped.
#16510 @AnPod On Limine, create runs limine-snapper-sync and only says the snapshot is bootable when that sync accepts it. A rejected sync warns and does not fail the update. systemd-boot still requires the new boot entry before the update continues.
#15590 @AnPod An update stops when a btrfs root has under 1 GiB unallocated and under 1 GiB of metadata headroom, even if df looks fine.
#20876 @Cynnamoroll Snapshot restore keeps nested subvolume paths, including names with spaces.
#21021 @photuris After a restore rolls migration records back, those migrations run again. The records are documented.
#19389 @Jitheswar omarchy-update checks OMARCHY_PATH before it prunes the package cache or takes a snapshot.

How the overlaps were resolved

  • Snapshot create keeps both the number capture from current quattro and the directory recovery text from Explain snapshot failures caused by regular directories #11287. stderr is a temp file so -p still lands in root_number.
  • The free-space script keeps the translated 10 GiB line, then the snapshot-boot sentence, then the unallocated-chunk check. The test stub answers findmnt for OPTIONS, FSTYPE, and SOURCE so those cases do not clobber each other. Default fstype stays ext4 so the older df cases do not enter the btrfs branch.
  • Limine sync success is not reported on systemd-boot. That path still waits for omarchy-boot-sync and the snapshot-N entry. The Limine test stubs omarchy-cmd-missing, omarchy-boot-backend, and omarchy-version, which current omarchy-snapshot calls before the sync.
  • Snapper configure tests keep the systemd-boot assertion and the missing-binary / non-btrfs skips.
  • The update sequence test keeps the Hyprland deleted-executable case and the missing-OMARCHY_PATH case.

Testing

On macOS, with GNU bash 5.3 (system bash 3.2 has no mapfile):

  • test/shell.d/snapshot-create-test.sh: pass, including the directory explanation, the systemd-boot boot entry, and the quiet 127 when snapper is absent.
  • test/shell.d/snapper-test.sh: pass, including Limine sync success and the warning when the sync rejects the entry, the missing snapper binary, and a non-btrfs root.
  • test/shell.d/migrate-scope-test.sh: the migration runner cases pass. The last case dies on BSD find (-printf), which this machine does not have.
  • test/shell.d/update-disk-space-test.sh: the helper's own low-space exit passes. The update-wrapper cases stop on BSD readlink (-e), which Check OMARCHY_PATH before an update prunes the cache and takes a snapshot #19389 uses and GNU readlink provides on Omarchy.
  • test/shell.d/update-sequence-test.sh and test/shell.d/boot-sync-test.sh: the harness hits BSD sed and missing flock before the new assertions.
  • test/shell.d/boot-restore-commit-test.sh: the snapshot-boot wait passes. The commit case dies in date '+%b %-d' (%-d is GNU date). Nested-subvolume assertions sit after that.

Those gaps are this machine, not dropped behavior. I did not run this on an Omarchy install (no btrfs root, no Limine, no snapper here).

Closure of the original PRs is the maintainers' call, after this is accepted.

Made with Cursor

hussainanjar and others added 13 commits December 1, 2026 08:16
install/config/snapper.sh called snapper unconditionally, so on aarch64
(where snapper is only a dependency on x86_64) 'omarchy apply system
--first-install' aborted with exit 127 before enable-services.sh,
firewall.sh, install/login and post-install ever ran. On ext4/xfs roots it
also installed a config claiming FSTYPE=btrfs and enabled a cleanup timer
that then failed daily.

The step now exits 0 with a reason line when snapper is not installed or
the root filesystem is not btrfs, matching the guard pattern migration
1784809452 already uses. Fixes omacom#19666, fixes omacom#6683.
omarchy-snapshot create printed 'Snapshots can be selected during boot.'
without ever running limine-snapper-sync, so a mismatched
/etc/default/limine left the snapshot out of the boot menu while every
omarchy-update reported the safety net as present (omacom#16498). Run the sync
after creating the snapshots and warn, pointing at its journal entries,
when it fails; the snapshot itself still exists, so this warns without
failing the update.
df's free space on btrfs can sit entirely inside partly-used data chunks,
where metadata chunks cannot go. When the device is fully allocated and
metadata headroom is nearly gone, an update dies with ENOSPC while df still
shows gigabytes free, and the pre-update guard never noticed because it
reads only df. Read the chunk accounting from btrfs and stop with the
balance remedy once unallocated device space and metadata headroom are both
nearly gone.

Fixes omacom#15528
Read each path from the restore journal without splitting on spaces.
Use the same reader when rolling back an interrupted restore so a
moved child goes back to the original root.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
…shot

omarchy-update-stay-awake refuses an OMARCHY_PATH that does not name its
install, so an update from a shell without the session environment pruned
the package cache and took a snapshot before aborting. Run the same check
on omarchy-update itself before any step.

Refs omacom#19343
@greptile-apps

greptile-apps Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5RetriggerView in Greptile

[High impact] The latest changes appear safe to merge, with all four previous findings addressed.

Summary

This PR joins fixes across snapshot creation, boot entries, restores, migration records, and update-space checks.

  • Snapshot creation explains setup failures and checks whether boot entries sync.
  • Updates stop when Btrfs lacks room for new chunks and metadata.
  • Migrations run again when a snapshot restore rolls back their changes.
  • Snapshot restores preserve nested subvolumes, including paths with spaces.
  • Boot sync drops image pins left by snapshots Snapper has deleted.
  • Snapper setup skips cleanly when Snapper or a Btrfs root is missing.
  • Updates check their Omarchy install path before pruning or snapshotting.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Check update path] --> B[Check free space and Btrfs allocation]
  B --> C[Authorize and prune cache]
  C --> D[Create snapshot]
  D --> E{Boot loader}
  E -->|systemd-boot| F[Build and check snapshot entry]
  E -->|Limine| G[Sync menu and warn on failure]
  F --> H[Update packages and run migrations]
  G --> H
  H --> I[Write migration records and receipts]
Loading

Reviews (2) · Last reviewed commit: "Use physical Btrfs allocation when check..." · Reviewed by Greptile

Comment thread bin/omarchy-update-requires-free-space Resolved
Comment thread test/shell.d/update-disk-space-test.sh Resolved
Comment thread migrations/1793660099.sh Resolved
Comment thread bin/omarchy-update-requires-free-space Resolved
@Cynnamoroll

Copy link
Copy Markdown
Contributor

Thanks for bringing the snapshot and update fixes together, @chessing234. Would you be willing to take responsibility for keeping my nested-subvolume restore fix (#20876) current with quattro here, including merge conflicts, maintainer and reviewer feedback, and follow-up fixes? Until you explicitly confirm, I’ll keep #20876 open and maintain it separately, as I’m doing for #20879 and #21006 in #21013.

Before I’d support handing off upkeep to the combined branches, I’d like the outstanding Greptile findings on both PRs fixed or answered with evidence. Two examples are Btrfs allocation accounting here and the queued battery warning in #21013.

@Jitheswar

Copy link
Copy Markdown

Thanks for folding this in, @chessing234. The OMARCHY_PATH check and its test in #21027 match #19389 line for line, and my commit is kept as is. I'm happy for #19389 to be closed as superseded once #21027 is merged. Until then I'll leave it open, since it's verified on its own.

@omarchybot

Copy link
Copy Markdown
Collaborator

Codex High classified this as a bug fix after reading the diff against quattro, including the restore fix for nested subvolume paths with spaces. DeepSeek (deepseek-v4p1-flash, default effort) classified it as an enhancement. The same branch also enables dynamic and periodic Btrfs data reclaim at boot. Verification is pending an agreed classification.

@chessing234

Copy link
Copy Markdown
Contributor Author

ready for a look @dhh @ryanrhughes

@omarchybot omarchybot added the enhancement New feature or request label Dec 2, 2026
@emirb

emirb commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Thanks for the time you put into this. Some of the fixes you added on top catch real bugs in the original PRs. I'm closing it anyway, along with the other Integrate PRs.

Each bundle puts several people's work in one branch. We can't review it one change at a time or revert a single piece. Merging it would also leave every original PR open. That's why our PR template asks for one problem per PR.

None of the bundles ran on an Omarchy install either.

Please post each fix on the PR it belongs to, so its author can pick it up. If two PRs conflict, a comment on the later one helps us most. A small fix of your own, tested on a real install, is always welcome. Smaller and proven gets merged. Thanks!

@emirb emirb closed this Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants