Skip to content

Keep Snapper off non-Btrfs roots - #6730

Closed
yashranaway wants to merge 10 commits into
omacom:quattrofrom
yashranaway:fix/non-btrfs-snapper
Closed

yashranaway wants to merge 10 commits into
omacom:quattrofrom
yashranaway:fix/non-btrfs-snapper

Conversation

@yashranaway

@yashranaway yashranaway commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Keeps the Btrfs-only Snapper root config and Limine integration off ext4 and other non-Btrfs installs. Existing affected machines are repaired without disturbing other Snapper configs.

<<<< AI wording below >>>>

Problem

install/config/snapper.sh installs a root config with FSTYPE="btrfs" and enables Snapper cleanup plus Limine snapshot sync on every filesystem. On a non-Btrfs root, both services fail repeatedly and the phantom root config also makes pre-update snapshot creation abort.

Fix

Gate automatic root snapshot setup on Btrfs. On other filesystems, remove the invalid root config and stale root registration, including partially cleaned installs, while preserving other shared settings and comments. Keep cleanup only for remaining registered config files. Give unconfigured non-Btrfs users accurate filesystem guidance.

Verification

bash test/shell.d/snapper-test.sh passes. Changed Bash files pass syntax checks and git diff --check passes. Snapshot creation tests also pass. Package and ISO assertions use the companion checkouts; no live filesystem setup was changed.

Review follow-up, 1 October

The registration parser handles literal single-quoted, double-quoted, and unquoted SNAPPER_CONFIGS values. An embedded hash in an unquoted config name stays literal; only a whitespace-separated hash starts a comment. Cleanup remains available for registered config files, and removing stale root registration preserves unrelated settings.

Focused regressions, Bash syntax, command metadata, and diff checks pass. Hardware and live Hyprland behavior were not exercised on this host.

Fixes #6683

Copilot AI balanced review requested due to automatic review settings August 12, 2026 07:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Guards Snapper’s Btrfs-only root setup and repairs affected non-Btrfs installations.

Changes:

  • Detects the root filesystem before configuring Snapper.
  • Adds non-Btrfs cleanup and service disablement.
  • Adds migration and shell-test coverage.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
install/config/snapper.sh Gates setup and removes invalid configuration.
migrations/1786482992.sh Repairs existing non-Btrfs installations.
test/shell.d/snapper-test.sh Tests filesystem-specific behavior and migration.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread install/config/snapper.sh Resolved
Copilot AI review requested due to automatic review settings August 12, 2026 07:20
@yashranaway
yashranaway force-pushed the fix/non-btrfs-snapper branch from abadc77 to b5d583f Compare August 12, 2026 07:20
Snapper's root configuration and Limine integration only work on Btrfs, but system setup installed and enabled them on every filesystem. Gate setup on the root filesystem and remove the impossible Btrfs root config from affected machines while preserving any other Snapper configuration.\n\nAdd an idempotent migration and regression coverage for Btrfs, non-Btrfs, and mixed-config systems.
@yashranaway
yashranaway force-pushed the fix/non-btrfs-snapper branch from b5d583f to 6899005 Compare August 12, 2026 07:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings August 12, 2026 07:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@AmiZya

AmiZya commented Aug 16, 2026

Copy link
Copy Markdown

Can we tag this as high priority since it's breaking the upgrade and leaves it in a limbo state?

@yashranaway

Copy link
Copy Markdown
Contributor Author

I do not have permission to add upstream labels, but the upgrade-blocking impact is documented in the PR.

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

Copy link
Copy Markdown
Collaborator

Reviewed at 581304e0 and tested on a disposable Omarchy worker. The fix works: verified.

Reproduction, on a real ext4 root (a chroot into an ext4 image on the worker, running the real snapper and systemctl rather than a stubbed findmnt):

  • Base, fresh machine: install/config/snapper.sh aborts at create-config, which is the upgrade failure reported in snapper.sh installs a btrfs snapper config on non-btrfs roots, so snapper-cleanup fails daily #6683's comments. Base, once past that step (the reporter's state): /etc/snapper/configs/root says FSTYPE="btrfs", snapper-cleanup.timer and limine-snapper-sync.service are enabled, and snapper -c root create fails with IO error (subvolume is not a btrfs subvolume). The existing migration 1781984677.sh leaves all of that in place.
  • This head, fresh machine: the script exits 0, writes no root config and leaves both units disabled. This head on the reporter's state: migration 1786517763.sh removes the config and its SNAPPER_CONFIGS entry and disables both units, and running it a second time changes nothing.
  • On the worker's own Btrfs root the script still installs the retention template, registers root, enables both units, and snapper create succeeds.

Tests: test/shell.d/snapper-test.sh passes 11/11 on the worker, and its new assertions fail with snapper.sh reverted. ./test/cli passes 113/113 with the branch merged onto current quattro. That run includes #13133's fix for vscode generated theme references current theme file, which fails on quattro without it and has nothing to do with this change.

Second opinion: Codex at medium effort reviewed the same head and found no execution defect in the setup or migration paths. It also found, as I did, one gap that this change leaves open:

  • bin/omarchy-snapshot:30: once the phantom config is gone, an ext4 user has no Snapper configs, so every omarchy update prints "No Snapper configs found, so no snapshot was created" and tells them to run install/config/snapper.sh. On their machine that script now correctly does nothing. The update carries on, so nothing is blocked, but the advice is wrong for them. Whether that warning should stay (they really have no snapshot) or give way to a note that snapshots need a Btrfs root is a product decision, and Distinguish sudo failure from missing Snapper configs #10428 is rewriting the same lines, so I've left it for the maintainer rather than pushing it here.

Waiting on the maintainer: to merge this, and to decide on that warning.

@greptile-apps

greptile-apps Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Snapshot system now checks filesystem type before setup.

The PR appears safe to merge; no outstanding or new actionable issue was identified.

Summary

The PR limits automatic root Snapper setup to Btrfs, repairs stale root configuration on non-Btrfs systems, and updates snapshot guidance and regression tests.

Reviews (6) · Last reviewed commit: "Read an empty registration before a comm..."

Comment thread install/config/snapper.sh Resolved
Comment thread install/config/snapper.sh Resolved
Comment thread install/config/snapper.sh Resolved
@yashranaway

Copy link
Copy Markdown
Contributor Author

Fixed the remaining guidance issue: unconfigured ext4 users now see that automatic snapshots require Btrfs, while Btrfs users retain setup advice. Snapshot creation and Snapper regressions pass.

@omarchybot omarchybot removed the verified Omarchy Triage has verified that this issue is ready for final review label Oct 1, 2026
Comment thread install/config/snapper.sh Resolved
Comment thread install/config/snapper.sh Resolved
@omarchybot omarchybot added the verified Omarchy Triage has verified that this issue is ready for final review label Oct 1, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Re-reviewed at fbdfae9b, covering the three commits since our last look: the ext4 hint in omarchy-snapshot, the partial-repair rework, and the quoted-registration parser. Tested on a disposable Omarchy worker. The fix still works, and it stays verified.

Reproduction, on a real ext4 root (a chroot whose / is an ext4 loop image on the worker, running the real snapper and systemctl):

  • Fresh ext4 machine: base and this head with install/config/snapper.sh reverted both abort at create-config. This head exits 0, writes no root config, and leaves both units disabled.
  • The snapper.sh installs a btrfs snapper config on non-btrfs roots, so snapper-cleanup fails daily #6683 state (the Btrfs root config on ext4, SNAPPER_CONFIGS="root", both units enabled, snapper create failing with IO error (subvolume is not a btrfs subvolume)): base and the revert leave all of it in place. Migration 1786517763.sh removes the config and its registration and disables both units. Running it again, or running 1781984677.sh after it, changes nothing.
  • A hand-edited /etc/conf.d/snapper (a comment, SNAPPER_DEBUG="yes", SNAPPER_CONFIGS='root home') with a home config present: base rewrites the file to SNAPPER_CONFIGS="root", dropping home and the other lines. This head removes only root, keeps the comment and the setting, keeps snapper-cleanup.timer enabled for home, and disables limine-snapper-sync.service.
  • On the worker's Btrfs root, the script still installs the retention template, registers root, and enables and starts both units, and omarchy-snapshot create succeeds.

Tests: test/shell.d/snapper-test.sh passes 13/13 and snapshot-create-test.sh 5/5 on the worker. ./test/cli passes 118/118 once #13133's fix for vscode generated theme references current theme file is applied. That test fails on quattro without it and is unrelated to this change. The new omarchy-snapshot hint was checked through its test only, since snapper list-configs needs D-Bus, which the chroot lacks.

Second opinion: Codex at medium effort reviewed the same head. It agreed that the change is proportionate, that the ISO, upgrade and migration callers all see the target's own root, and that the Btrfs path is unchanged; its independence is not guaranteed. It also found something I checked against snapper on the worker:

  • install/config/snapper.sh:39 reads SNAPPER_CONFIGS the way a shell would: the last assignment wins, and spaces around = are accepted. snapper itself takes the first assignment and ignores a line with spaces around =. So on a file with two SNAPPER_CONFIGS= lines, the script can de-register or stop cleaning a config that Snapper considers registered. Snapper and Omarchy never write a file like that, so I've not pushed more parser code for it. A rewritten assignment also loses an inline comment on that line.

Fixes #6683, now linked. #9633 and #10428 change the same lines in install/config/snapper.sh and bin/omarchy-snapshot but fix different bugs, so whichever lands second needs a rebase.

Waiting on the maintainer.

@omarchybot omarchybot removed the verified Omarchy Triage has verified that this issue is ready for final review label Oct 1, 2026
`SNAPPER_CONFIGS= # root home` is an empty assignment to bash and to snapper. The parser stripped the whitespace after `=` before looking for a comment, so the value became `# root home`, and with no root config present the repair rewrote it as `SNAPPER_CONFIGS="# home"`, registering whatever the comment named.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Codex Medium <noreply@openai.com>
@omarchybot omarchybot added the verified Omarchy Triage has verified that this issue is ready for final review label Oct 1, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Re-reviewed at eef56858, the hash-in-name parser change, and tested on a disposable Omarchy worker. That change introduced one regression, which I've fixed in 3037dd1e on your branch. The fix still works at the new head, and it stays verified.

Pushed: 3037dd1e Read an empty registration before a comment as empty. Bash and snapper read SNAPPER_CONFIGS= # root home as an empty assignment. Since eef56858, the parser stripped the space after = before checking for a comment, so the value became # root home. With no root config present, the repair then rewrote the line to SNAPPER_CONFIGS="# home" and kept the cleanup timer on, which registered a home config the user had left unregistered. Line 42 of install/config/snapper.sh now treats whitespace followed by # right after = as an empty value. A regression at the end of test/shell.d/snapper-test.sh fails without the fix. root#daily, #x, home # x and the quoted forms still read the way bash reads them.

Reproduction, on a real ext4 root (a chroot whose / is an ext4 loop image on the worker, running the real snapper and systemctl), with the same results as at fbdfae9b:

  • Fresh ext4 machine: base and the head with install/config/snapper.sh reverted both abort at create-config. The head exits 0 and leaves no root config and both units disabled.
  • The snapper.sh installs a btrfs snapper config on non-btrfs roots, so snapper-cleanup fails daily #6683 state: base and the revert leave the Btrfs root config and both units in place. Migration 1786517763.sh removes the config and its registration, disables both units, and a second run changes nothing.
  • Hand-edited /etc/conf.d/snapper with a home config: only root is removed, the comment and SNAPPER_DEBUG survive, and cleanup stays enabled for home.
  • Worker's Btrfs root: root is registered, both units are enabled, and snapper create succeeds.

Tests: snapper-test.sh passes 15/15 and snapshot-create-test.sh 5/5 on the worker. ./test/cli passes 118/118 with #13133's unrelated test fix applied, as before.

Second opinion: Codex at medium effort reviewed eef56858 and found the regression above, which I reproduced before fixing. A second round on 3037dd1e found nothing new, and its independence is not guaranteed. It also raised that both for config in $snapper_configs loops pathname-expand their names. A config named [ab]in could be read as bin, de-registered, or have its cleanup turned off. Like the first-versus-last assignment point from the last review, this needs a hand-written conf.d that neither Snapper nor Omarchy writes, so I've left both for the maintainer rather than adding more parser code.

Fixes #6683, linked again since the description was edited. Waiting on the maintainer.

@omarchybot

Copy link
Copy Markdown
Collaborator

Closing as out of scope: Omarchy now supports only installs made from the official Omarchy ISO, and this change exists for a root filesystem other than Btrfs, which the ISO doesn't produce. We aren't taking on code paths for setups outside that, because nobody here can test or maintain them. Thanks for the work that went into this. (Checked by Claude Opus 5.5; no second review.)

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.

snapper.sh installs a btrfs snapper config on non-btrfs roots, so snapper-cleanup fails daily

4 participants