Repair missing zram configuration before activating swap - #387
Conversation
|
Missing zram config is restored, /dev/zram0 activates, reruns are idempotent, and existing custom config is preserved. Good to merge. |
scottjones
left a comment
There was a problem hiding this comment.
Reviewed independently and tried to break it; it holds.
Things I checked rather than took on trust:
- The four-level detection loop matches
zram-generator.conf(5), and testing-e || -Lcorrectly treats an empty file or a/dev/nullsymlink mask as a deliberate decision to disable zram rather than something to overwrite. - The precedence argument in the description is correct, not hand-waving. The man page: "The main configuration file is read before any of the configuration directories, and has the lowest precedence." So a corrected settings package can ship
/usr/lib/systemd/zram-generator.conf.d/90-omarchy.confand it will override this fallback, with no file conflict. Leaving/usr/libpackage-owned was the right call. daemon-reloadruns beforesystemctl show, soLoadStateis read after the generator has had a chance to produce the unit. That ordering matters and it's right.- Switching the start target from
systemd-zram-setup@zram0.servicetodev-zram0.swapis the substance of the fix, not a rename: the setup service alone creates the device without enabling swap. - The real-generator integration test is doing real work. Against the installed
zram-generatoron an aarch64 Asahi machine it produced no swap unit before the repair, and afterwardsdev-zram0.swapwithRequires=systemd-zram-setup@zram0.serviceand theswap.targetlink. That's the assertion that makes the fallback content believable. - Full test file: 8/8 pass.
bin/omarchy commands --check458 commands../test/cligreen.
One correction to the description, in your favour. It says "users who already completed this migration still need the package fix." They didn't complete it — the old sudo systemctl start systemd-zram-setup@zram0.service failed non-zero on exactly the affected machines, so omarchy-migrate never wrote the marker and the queue stayed blocked. The repaired migration re-runs for precisely the population that was broken, which is a better outcome than the description claims.
Two non-blocking notes for later:
OMARCHY_ZRAM_ROOTis a test seam in production code. There's precedent in the repo and it buys a genuinely good test, so I'm not asking for a change — just flagging it as a deliberate choice rather than an accident.docs/file-layout.md:129documents/usr/lib/systemd/zram-generator.conf.d/90-omarchy.confas the canonical destination, and this fallback deliberately lands somewhere else and stays there permanently once written. A line in that doc, or in the migration comment, saying the/etcfile is a permanent unowned fallback would save the next person the reasoning.
Approving.
|
Checked this out on a MacBookPro18,1 (aarch64, omarchy-settings 4.0.3-1) and ran both suites: The approach composes correctly with One interaction worth noting (also posted on #369): on machines like mine the |
|
Pushed The regression test uses the real package helpers and migration runner with inert package/service operations. It verifies failure without a completion marker, successful recovery when the package becomes available, and no repeated work after completion. The new test fails on the original PR migration and passes with this correction. Validation:
Fresh hosted CI is still needed for this new commit. The previous ARM installation job failed on |
On an ARM install upgraded to
omarchy-settings 4.0.2-2, the zram default exists under/usr/share/omarchy/default/but no configuration is installed where zram-generator reads it. Migration1787669934.shthen startssystemd-zram-setup@zram0.service, fails withDevice zram0 not found, and leaves the migration queue blocked. Rebooting does not restore the missing configuration.Repair the existing migration so pending installations can reach the fix: copy the shipped default to
/etc/systemd/zram-generator.confonly when no main configuration or drop-in exists at any supported configuration level, then reload systemd and startdev-zram0.swap. Starting the swap unit activates swap as well as setting up the device. Existing configuration, empty files, symlink masks, and active swap are preserved; an active device with missing persistent configuration gets the fallback without being restarted.The fallback deliberately avoids an unowned
/usr/libfile. A future package can restore its vendor drop-in without a file conflict, and that drop-in takes precedence over the fallback main configuration. This is a repair for the blocked migration, not a replacement for the package payload fixes in #353 or checkout wiring in #319. Users who already completed this migration still need the package fix. Related to #369 and #311.Validation:
ZRAM_GENERATOR_ROOTintegration test: no swap unit before repair; a swap unit with the setup dependency andswap.targetlink afterward../test/all: CLI passes; 255/256 shell test files pass on both this branch and untouchedorigin/quattro(291a6989). Both fail the same unrelatedlaunch-about-test.shassertion,a roomy window animates. No green local aggregate is claimed../tests/allhas the same pre-existing piped--helpassertion failure intest-mac-setup.shon both revisions. Hosted PR CI passestest/all,tests/all, and Syntax + shellcheck.hyprtoolkit installed=0.5.4-6 expected=0.5.4-5.1), unrelated to these two changed files. An independent unchanged-quattro run on my fork reproduces the identical failure. Isolating the existing package-selection fix from Integrate Apple Silicon stabilization fixes for 4.0.3rc1 #377 yields a passing ARM run, including the real-Pacman regression and fresh/repeat installation, with all three selected compositor package versions retained. That comparison branch does not include this zram change; it establishes the independent installer defect and its existing fix.No privileged migration or swap changes were run on the host as part of testing this PR.