omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

omarchy hibernation remove leaves /etc/limine-entry-tool.d/resume.conf behind, so the rebuilt UKI still boots with resume= pointing at the deleted swapfile

Open brenodyego opened this issue 3 months ago • 5 comments

What happened

omarchy hibernation remove reports Hibernation removed, but it only removes the mkinitcpio resume hook. It never removes /etc/limine-entry-tool.d/resume.conf, which omarchy-hibernation-setup created. Because the removal script ends with sudo limine-mkinitcpio, the drop-in is still on disk during that rebuild, so the freshly generated UKI and every entry in /boot/limine.conf come out carrying:

resume=/dev/mapper/root resume_offset=1909033

At that point the swapfile has already been deleted and the /swap Btrfs subvolume destroyed, so the kernel command line points at an offset inside blocks Btrfs is now free to hand to any other file.

Expected

omarchy hibernation remove should delete the drop-in it created before rebuilding, so the resulting cmdline has no resume= / resume_offset=.

Steps to reproduce

  1. omarchy hibernation setup on a Btrfs + LUKS install using Limine/UKI.
  2. omarchy hibernation remove, confirm the prompt.
  3. Inspect the result:
$ ls /etc/limine-entry-tool.d/
omarchy-defaults.conf  omarchy-uki.conf  resume.conf        # <-- still there

$ grep -c "resume=" /boot/limine.conf
5

$ sudo grep -aoE "resume(_offset)?=[^ ]+" /boot/EFI/Linux/omarchy_linux.efi | sort -u
resume=/dev/mapper/root
resume_offset=1909033

$ swapon --show                 # the swapfile it points at is gone
NAME       TYPE      SIZE USED PRIO
/dev/zram0 partition  15G   0B  100

$ ls -d /swap
ls: cannot access '/swap': No such file or directory

Where the asymmetry is

omarchy-hibernation-setup creates the drop-in:

RESUME_DROP_IN="/etc/limine-entry-tool.d/resume.conf"                                 # line 31
...
echo "KERNEL_CMDLINE[default]+=\" resume=$RESUME_DEVICE resume_offset=$RESUME_OFFSET\"" \
  | sudo tee "$RESUME_DROP_IN" >/dev/null                                             # line 103

omarchy-hibernation-remove never references RESUME_DROP_IN at all — its only rm calls are:

sudo rm "$SWAP_FILE"          # line 30
sudo rm "$MKINITCPIO_CONF"    # line 49
sudo limine-mkinitcpio        # line 52

The same gap applies to /etc/limine-entry-tool.d/rtc-alarm.conf, which omarchy-hibernation-setup creates on s2idle systems (line 111-114) and remove also leaves behind. (Not present on my machine, so I only verified resume.conf end to end.)

Second-order: the snapshot entries cache the stale cmdline

Deleting the drop-in and re-running limine-mkinitcpio cleans the default entry and the UKI, but the Snapper snapshot entries keep the old cmdline, because it is cached in /boot/<machine-id>/limine_history/snapshots.json. Restarting limine-snapper-sync.service regenerates the entries from that cache, so it does not help. The stale resume= has to be stripped from snapshots.json as well.

Impact

Low probability, but it is exactly the failure class hibernation removal is meant to end: a kernel command line telling the kernel to resume from freed, reallocated blocks. It also makes a later omarchy hibernation setup start from a half-configured state (see #7619).

Suggested fix

In omarchy-hibernation-remove, before sudo limine-mkinitcpio:

RESUME_DROP_IN="/etc/limine-entry-tool.d/resume.conf"
RTC_DROP_IN="/etc/limine-entry-tool.d/rtc-alarm.conf"
[[ -f $RESUME_DROP_IN ]] && { echo "Removing resume kernel parameters"; sudo rm "$RESUME_DROP_IN"; }
[[ -f $RTC_DROP_IN ]] && sudo rm "$RTC_DROP_IN"

and additionally strip resume=/resume_offset= from /boot/<machine-id>/limine_history/snapshots.json so the snapshot entries stop resurrecting it.

System

Omarchy 4.0.2-1
Kernel 7.1.9-arch1-2
CPU AMD Ryzen 5 5600G
GPU NVIDIA GeForce GTX 1660 SUPER (nvidia-open-dkms 610.57.04)
RAM 15 GiB
Root Btrfs on LUKS, Limine + UKI
limine 12.6.0-1, limine-mkinitcpio-hook 1.37.1-1, limine-snapper-sync 1.31.0-1

PARTUUIDs redacted from the pasted cmdline above; full omarchy debug output available on request.

brenodyego avatar Sep 03 '26 17:09 brenodyego

Confirmed on a second machine and version: iMac17,1 (Btrfs + LUKS, Limine/UKI), Omarchy 4.0.1-1 — the omarchy-hibernation-remove shipped in 4.0.1 has the same gap: it never references /etc/limine-entry-tool.d/resume.conf, so the drop-in survives the removal and the closing limine-mkinitcpio bakes resume=/resume_offset= back into every regenerated entry.

One addition that the suggested fix does not cover yet: current master's omarchy-hibernation-setup writes the resume parameters to a second location. Right after creating the drop-in, it also appends it to /etc/default/limine:

echo "KERNEL_CMDLINE[default]+=\" resume=$RESUME_DEVICE resume_offset=$RESUME_OFFSET\"" | sudo tee "$RESUME_DROP_IN" >/dev/null
sudo tee -a /etc/default/limine < "$RESUME_DROP_IN" >/dev/null   # bin/omarchy-hibernation-setup, master, line 103

Consequences on a master-based install:

  • Deleting only $RESUME_DROP_IN (the fix proposed above) still leaves resume=/resume_offset= on the generated cmdline, via /etc/default/limine.
  • Setup's idempotency guard is [[ ! -f $RESUME_DROP_IN ]], so after a remove-then-setup cycle a second copy of the line is appended to /etc/default/limine — the recreated swapfile gets a fresh offset while the stale line stays in the file.

So a symmetric remove needs, in addition to the two drop-ins:

sudo sed -i '/resume=.*resume_offset=/d' /etc/default/limine

(The /etc/default/limine append does not exist in 4.0.1 — verified absent on my machine — so this part is master-only.)

Filed by Claude Fable 5 via Claude Code.

madakas avatar Sep 03 '26 20:09 madakas

Confirming on Omarchy 4.0.3-1 (btrfs on LUKS desktop, 7.2.3-arch1-3): after a successful omarchy hibernation remove, /etc/limine-entry-tool.d/resume.conf survived and all limine.conf cmdlines kept stale resume=/resume_offset= pointing at the deleted swapfile. /etc/default/limine on this release build has no resume line, consistent with the master-only note above.

Filed by muse-spark-1.3-contributor.

exergonic avatar Sep 09 '26 02:09 exergonic

Confirmed in source on current quattro (a3d4bea9d). Nothing was run: the mechanism can be read directly from the two scripts. bin/omarchy-hibernation-remove deletes the swapfile, the /swap subvolume, the fstab entry and omarchy_resume.conf, then runs limine-mkinitcpio with /etc/limine-entry-tool.d/resume.conf still in place, so the rebuilt entries keep resume=/resume_offset= for a swapfile that no longer exists. rtc-alarm.conf is left behind the same way. There is a second consequence: omarchy-hibernation-setup only writes resume.conf when it is absent, so after a remove-then-setup cycle the new swapfile is paired with the old offset. omarchy-system-factory-reset already works around exactly this.

The fix for the core defect is already open as #13584. It deletes resume.conf before the rebuild, and it makes setup always recompute the offset and drop a stale drop-in when it can't. #13768 makes the same change to remove, but on a failed offset lookup it keeps the old drop-in, so #13584, the older of the two, is the one to prefer. This issue isn't yet linked to #13584 as one it closes: #13584 has been pushed to since it was last classified, and it is being reviewed again on its own. #10374, #12096 and #13583 report this same bug and are newer than this one.

What neither pull request covers, for the maintainer to decide:

  • rtc-alarm.conf is not removed. #14113 drops that drop-in from setup and removes it with a migration.
  • Machines that already ran the old remove keep their stale resume.conf. Running remove again won't clean it up, because it exits as soon as omarchy_resume.conf is gone. A migration would be needed.
  • Snapper snapshot entries that cache the old cmdline aren't touched. That limine-snapper-sync keeps reusing the old cmdline is the reporter's observation; I could not confirm it from the source.
  • The /etc/default/limine append mentioned above exists only on dev (3.x), not on quattro.

Reviewed by Claude Opus 5.5, with a second opinion from Codex Medium. Codex agreed on the mechanism and independently found the #13768 stale-offset case and the gap for machines already affected. Its independence from this review is not guaranteed. This now waits on the maintainer's decision on #13584 and the follow-ups above.

omarchybot avatar Oct 11 '26 03:10 omarchybot

Confirming on Omarchy 4.0.4-1 (fresh install, btrfs on LUKS, Limine, i9-13900K / RTX 4090). After omarchy hibernation remove, /etc/limine-entry-tool.d/resume.conf survived with resume=/dev/mapper/root resume_offset=1889153. Removing it by hand and running sudo limine-mkinitcpio cleaned it up.

zkellsworth avatar Oct 13 '26 06:10 zkellsworth

Rechecked in source on quattro at 4574aa8bb5350141542166b9d09206cc7413702c. The normal removal path is now fixed by #19969: bin/omarchy-hibernation-remove:51 deletes resume.conf before rebuilding. This has not shipped in the latest published release, v4.5.0.

#20000 is the existing follow-up, and I linked this issue to it. It makes remove clean up a stale drop-in even when the hook is already gone, makes fresh setup replace the old offset, and stops removal before rebuilding if deletion fails. It adds no automatic cleanup migration. It also leaves an already-configured machine's non-empty offset unchanged: if old remove and old setup have both already run, repairing that state still requires removing hibernation and setting it up again. The current device-renaming migration does not repair that offset.

rtc-alarm.conf remains separate in #14113. Neither #19969 nor #20000 changes snapshot entries; the reported snapshots.json behaviour could not be confirmed from Omarchy's source, so that part remains unresolved.

Reviewed by Codex High, with second opinions from Opus 5.5 High and muse-wonder via pi, thinking high. Both agreed on the source mechanisms; Opus also traced the already-configured stale-offset case above. Their independence from this review is not guaranteed. Nothing was executed or reproduced on a worker in this re-triage. This remains open, waiting on the maintainer's decision on #20000 and whether already-affected machines need automatic repair.

omarchybot avatar Nov 24 '26 07:11 omarchybot