Repository navigation
Hibernation: fail when unsupported; refuse empty resume= device - #9860
chessing234 wants to merge 6 commits into
Conversation
Unsupported kernels and missing Limine previously exited 0, so install scripts treated a skipped setup as success. Return non-zero for those hard failures; keep 0 for user cancel and already-configured.
|
@dhh @ryanrhughes ready for review |
|
Reviewed at 82249c8 against What ran. Everything ran on a disposable Omarchy VM with a btrfs root and hibernation configured. Setup ran in a snapshot chrooted the way What was found.
Competing fixes. #13908 (an in-place repair) and #11477 (a full reconcile, which also covers the stale offsets in #11437) both refuse an empty device without aborting. They also write or repair the parameters when setup is re-run, including when the drop-in is missing. Neither resolves the device inside the factory-reset chroot, but neither fails the reset or strands the machine. Codex Medium agreed with both findings above; this review cannot show that it reached them independently. Waiting on the maintainer to choose between the three fixes for #12630. Nothing was pushed to this branch. |
[Medium impact] The changes reach hibernation setup and the boot resume path. The PR is not ready to merge because both previous hibernation failures remain. FindingsSummaryThe PR rejects unsupported hibernation setup and prevents new drop-ins from containing an empty
Reviews (3) · Last reviewed commit: "Drop the source-grepping hibernation tes..." · Reviewed by Greptile |
| previous=$(<"$RESUME_DROP_IN") | ||
| [[ $previous =~ ^KERNEL_CMDLINE\[default\]\+=\"\ ?resume=(/dev/[^[:space:]\"]+)\ resume_offset=([0-9]+)\"$ ]] || return 0 | ||
| [[ ${BASH_REMATCH[1]} != /dev/mapper/* ]] || return 0 | ||
| [[ $previous =~ ^KERNEL_CMDLINE\[default\]\+=\"\ ?resume=(/dev/[^[:space:]\"]+)?\ resume_offset=([0-9]+)\"$ ]] || return 0 |
There was a problem hiding this comment.
Empty offsets skip device repair
If a legacy drop-in contains resume= resume_offset= and map-swapfile still fails, this regex returns success without repairing either value. The new migration matches that line, but setup exits successfully and the migration is marked complete. Fixing the mount later will not trigger another repair.
Detect the empty device independently of the offset and return non-zero until both values can be repaired. This also satisfies the migration rule that unfinished repairs must remain pending.
File Used: agents/skills/migrations.md (source)
The factory reset runs setup in a chroot where findmnt finds no device for the swapfile, and fails the reset when setup exits non-zero, so exiting 1 there made a factory reset impossible on every machine with hibernation set up. Leave the drop-in out with a warning instead, as setup already did for an unknown offset, and still write the resume hook so omarchy-hibernation-remove can undo it. The already-set-up check now needs the drop-in, so a rerun on the booted system adds the parameters. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Codex Medium <noreply@openai.com>
omarchy-hibernation-remove leaves resume.conf behind. Without the resume hook, setup --force takes the fresh path, recreates the swapfile and its fstab entry, writes the hook and rebuilds, and keeps the broken drop-in. Require the hook, as migration 1792965062 does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Codex Medium <noreply@openai.com> Co-Authored-By: Muse Wonder High <noreply@meta.com>
It checked that the guard was spelled as written and tested the migration against a stub, both of which AGENTS.md rules out. hibernation-setup-test.sh runs the real setup through both cases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Muse Wonder High <noreply@meta.com>
| # An empty device writes `resume= resume_offset=N`. The factory reset's chroot finds | ||
| # no device, so leave the drop-in out without failing; a rerun adds it. | ||
| if [[ -n $RESUME_DEVICE && -n $RESUME_OFFSET ]]; then | ||
| sudo mkdir -p /etc/limine-entry-tool.d | ||
| echo "KERNEL_CMDLINE[default]+=\" resume=$RESUME_DEVICE resume_offset=$RESUME_OFFSET\"" | sudo tee "$RESUME_DROP_IN" >/dev/null | ||
| else | ||
| echo "Warning: Could not determine resume offset for $SWAP_FILE" >&2 | ||
| echo "Warning: Could not determine resume device and offset for $SWAP_FILE (device='$RESUME_DEVICE' offset='$RESUME_OFFSET'); re-run omarchy-hibernation-setup to add them" >&2 |
There was a problem hiding this comment.
Reset leaves resume settings missing
When findmnt finds no device in the factory-reset chroot, setup now succeeds without writing resume.conf. The reset accepts that success and rebuilds the boot files, but no later step reruns setup to add the missing resume parameters.
Setup still writes omarchy_resume.conf, so omarchy-hibernation-available can offer Hibernate even though the boot files lack the parameters needed to restore the session. Determine the device before completing the reset, or arrange a required repair before hibernation becomes available.
|
Re-reviewed at 6dd5097, the merge with What ran. Everything ran on a disposable Omarchy VM with a btrfs root and hibernation set up.
Pushed.
Still open. Codex, muse-wonder and Greptile each point out the same thing: a factory reset now finishes, but its boot image carries no resume parameters, and nothing re-runs setup to add them. On Competing fixes. #11477 and #13908 also fix #12630 and now conflict with Waiting on the maintainer: whether to keep the exit-code change, and how the factory reset should name the resume device. |
Summary
resume=deviceTest plan
bash test/shell.d/hibernation-empty-resume-test.shFixes #12630