Repository navigation
Conversation
hibernation-setup only writes resume.conf when it is absent, so leaving it behind pins a later setup to the old swapfile's resume_offset. Fixes omacom#13583 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U2bEgE2TAqMqbeQqZK6jfc
Automated AI review
Outcome: Machines that already ran the old remove keep the stale Existing leftover
|
A machine that removed hibernation before remove cleaned up still carries the old resume.conf, and setup kept it because it only wrote the drop-in when absent, so a later setup baked the deleted swapfile's offset into the UKI. Setup reaches this path only when hibernation is not configured, so an existing drop-in is always stale: rewrite it, and drop it when no offset can be found. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Codex Medium <noreply@openai.com>
Rejecting only the old existence guard passed with the whole rewrite block deleted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Codex Medium <noreply@openai.com>
|
| if [[ -f $RESUME_DROP_IN ]]; then | ||
| echo "Removing resume kernel parameters" | ||
| sudo rm "$RESUME_DROP_IN" | ||
| fi |
There was a problem hiding this comment.
Cleanup cannot be retried If removal is interrupted after deleting the resume hook but before deleting
resume.conf, a second run exits because the hook is missing. It never removes the old resume parameters or rebuilds the UKI, so rerunning removal leaves boot settings for the deleted swapfile in place.
| else | ||
| sudo rm -f "$RESUME_DROP_IN" | ||
| echo "Warning: Could not determine resume offset for $SWAP_FILE" >&2 | ||
| fi |
There was a problem hiding this comment.
Offset failure prevents recovery If a valid
resume.conf remains after the hook configuration was removed and map-swapfile temporarily fails, this branch deletes the valid parameters. Setup then rebuilds without them. Because it has already written the hook, a later setup run exits before recalculating the offset, leaving hibernation unable to resume until the partial configuration is repaired.
| remove_line=$(grep -n 'sudo rm "$RESUME_DROP_IN"' "$ROOT/bin/omarchy-hibernation-remove" | cut -d: -f1) | ||
| rebuild_line=$(grep -n '^sudo limine-mkinitcpio' "$ROOT/bin/omarchy-hibernation-remove" | cut -d: -f1) | ||
| [[ -n $remove_line && -n $rebuild_line ]] || | ||
| fail "hibernation remove keeps recognizable drop-in removal and rebuild steps" | ||
| (( remove_line < rebuild_line )) || | ||
| fail "hibernation remove drops resume parameters before rebuilding the UKI" | ||
| pass "hibernation remove drops resume parameters before rebuilding the UKI" |
There was a problem hiding this comment.
Test misses skipped cleanup This test checks that deletion appears before the rebuild in the source, but never runs the removal script. It passes even when a missing hook makes the script exit before deleting a stale
resume.conf, so it cannot catch that cleanup regression. A behavioral test of the partial state would cover it.
| # Remove resume kernel parameters. hibernation-setup only writes these when the | ||
| # drop-in is absent, so a stale one would pin a later setup to this swapfile's offset. |
There was a problem hiding this comment.
Comment describes outdated setup behavior Setup now rewrites
resume.conf whenever it reaches the resume-parameter step, rather than writing it only when absent. This comment gives future maintainers the wrong reason for deleting the file and makes the cleanup harder to understand.
| # Remove resume kernel parameters. hibernation-setup only writes these when the | |
| # drop-in is absent, so a stale one would pin a later setup to this swapfile's offset. | |
| # Remove resume kernel parameters so the rebuilt UKI no longer points to | |
| # the deleted swapfile. |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
Reviewed and reproduced on a disposable VM built from the Omarchy ISO (btrfs root, Limine UKI), with a second opinion from Codex Medium. The bug is real and this fixes it. On Pushed one fix to your branch (9007748, plus 0e2b5a2 tightening its test). Fixing remove only helps machines that remove hibernation from now on. A machine that already ran the old remove still has the stale drop-in, and setup skipped writing one that existed, so #13583's step 5 still failed there. I reproduced that on the VM (old remove, then this branch's setup: drop-in Tests on the VM: Second opinion: Codex Medium independently raised that the test only matched source text, which led to 0e2b5a2. On the stale drop-in it agreed with a finding already in its brief, so its independence there is not guaranteed. Its last round, on this head, found nothing left to act on. Competing fix: #13768 fixes the same issue with the same two script changes and a larger behavioural test. Asked to compare them without being given an answer, Codex Medium preferred this one, as did I. This one deletes a stale drop-in when the offset can't be found, which #13768 keeps. #13768's test does run the scripts, which this one's doesn't. #13908 rewrites the same block in setup for #12630, so whichever lands second will need a merge. Waiting on the maintainer. |
Fixes #13583
omarchy-hibernation-removedeleted the swapfile and the mkinitcpio resume hook but left/etc/limine-entry-tool.d/resume.conf, so the rebuilt UKI keptresume=/resume_offset=for a swapfile that no longer exists. Becauseomarchy-hibernation-setuponly writes that drop-in when it's absent, setting hibernation up again kept the old offset and resume silently failed. (omarchy-system-factory-resetalready works around this same trap.)resume.confbeforelimine-mkinitcpiorunstest/shell.d/hibernation-remove-test.sh, which fails without the fix./test/clihas one failure (vscode generated theme references current theme file), which also fails onquattrowithout this change.🤖 Generated with Claude Code
https://claude.ai/code/session_01U2bEgE2TAqMqbeQqZK6jfc