Skip to content

Revert "Use ACPI alarm for RTC wakeup on s2idle systems for hibernation" - #14113

Open
superm1 wants to merge 5 commits into
omacom:quattrofrom
superm1:rtc-cmos
Open

superm1 wants to merge 5 commits into
omacom:quattrofrom
superm1:rtc-cmos

Conversation

@superm1

@superm1 superm1 commented Oct 3, 2026

Copy link
Copy Markdown

This reverts commit ecf48a3.

This is a misplaced change. The Linux kernel already sets policy for when RTC alarm should be used on the proper hardware.

See use_acpi_alarm_quirks() in https://github.com/torvalds/linux/blob/v7.3-rc5/drivers/rtc/rtc-cmos.c#L823

Actually setting it on hardware that it shouldn't be intended (such as older Intel or AMD systems) can cause unintended consequences. I suggest if you have hardware that isn't already supported by use_acpi_alarm_quirks() for some reason that you submit a kernel change to fix it rather than impose this setting on everyone's kernel command line.

@greptile-apps

greptile-apps Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5RetriggerView in Greptile

[Medium impact] The PR appears safe to merge.

Summary

Stops hibernation setup from forcing rtc_cmos.use_acpi_alarm=1, leaving RTC policy to the kernel.

  • Hibernation setup leaves RTC alarm policy to Linux.
  • The migration removes Omarchy's old RTC alarm setting.

No new actionable issues were found. The current migration also addresses the earlier cleanup and rebuild concerns.

Diagram

%%{init: {'theme': 'neutral', 'htmlLabels': false}}%%
flowchart TD
  A[Read RTC drop-ins] --> B{Exact stock contents?}
  B -- Yes --> C{Matching managed loader?}
  C -- Yes --> D[Save pending rebuild marker]
  C -- No --> E[Remove stock drop-ins]
  D --> E
  B -- No --> F{Pending rebuild marker?}
  E --> F
  F -- No --> G[Finish]
  F -- Yes --> H[Rebuild managed boot images]
  H -- Failure --> I[Keep marker and report failure]
  H -- Success --> J[Request reboot and clear marker]
Loading

Reviews (13) · Last reviewed commit: "Keep RTC alarm cleanup pending until boo..." · Reviewed by Greptile

Comment thread bin/omarchy-hibernation-setup Resolved
Comment thread bin/omarchy-hibernation-setup Resolved
Comment thread bin/omarchy-hibernation-setup Resolved
Comment thread bin/omarchy-hibernation-setup Resolved
Comment thread bin/omarchy-hibernation-setup Resolved
Comment thread bin/omarchy-hibernation-setup Resolved
Comment thread bin/omarchy-hibernation-setup Resolved
@jandrusk

jandrusk commented Oct 6, 2026

Copy link
Copy Markdown

Thanks Mario, deferring to the kernel's use_acpi_alarm_quirks() makes sense.

Two small things:

  • The diff does more than a pure revert: it adds clean_stale_rtc_alarm, which removes the drop-in when its hash matches. It'd be worth saying so in the description.
  • That cleanup only runs when someone re-runs omarchy-hibernation-setup. Existing installs that already got rtc-alarm.conf will keep rtc_cmos.use_acpi_alarm=1 indefinitely. A migration with the same hash check would cover them:
f=/etc/limine-entry-tool.d/rtc-alarm.conf
if [[ -f $f && $(sha256sum <"$f" | cut -d' ' -f1) == c9469cd9ba4c0f74f8ce6fe4afeac4414741a3536ce8693838047f15487fd1c8 ]]; then
  sudo rm -f -- "$f" && sudo limine-mkinitcpio
fi
  • Nit: /etc/limine-entry-tool.d is world-readable, so sudo test -f / sudo sha256sum in the "already set up" branch could be plain [[ -f ]] / sha256sum. That way that path doesn't ask for a password when there's nothing to clean up.

@superm1

superm1 commented Oct 6, 2026

Copy link
Copy Markdown
Author

Thanks Mario, deferring to the kernel's use_acpi_alarm_quirks() makes sense.

Two small things:

  • The diff does more than a pure revert: it adds clean_stale_rtc_alarm, which removes the drop-in when its hash matches. It'd be worth saying so in the description.
  • That cleanup only runs when someone re-runs omarchy-hibernation-setup. Existing installs that already got rtc-alarm.conf will keep rtc_cmos.use_acpi_alarm=1 indefinitely. A migration with the same hash check would cover them:
f=/etc/limine-entry-tool.d/rtc-alarm.conf
if [[ -f $f && $(sha256sum <"$f" | cut -d' ' -f1) == c9469cd9ba4c0f74f8ce6fe4afeac4414741a3536ce8693838047f15487fd1c8 ]]; then
  sudo rm -f -- "$f" && sudo limine-mkinitcpio
fi
  • Nit: /etc/limine-entry-tool.d is world-readable, so sudo test -f / sudo sha256sum in the "already set up" branch could be plain [[ -f ]] / sha256sum. That way that path doesn't ask for a password when there's nothing to clean up.

Thanks for reviewing. I added the second commit as a result of the robot review.

If you think existing systems should stay on keeping the conffile I can just drop the second commit.

If you would prefer to keep that cleanup path I'll adjust description and that second commit per your feedback.

Let me know which way you prefer.

@jandrusk

jandrusk commented Oct 7, 2026

Copy link
Copy Markdown

I'd keep the cleanup. The point of the revert is to let the kernel's use_acpi_alarm_quirks() decide. If existing installs keep a forced rtc_cmos.use_acpi_alarm=1, the revert only helps new installs, and the machines that hit the regression stay on it.

So my vote: keep clean_stale_rtc_alarm, mention it in the description, and add a migration with the same hash check (like the snippet above), so existing installs get the drop-in removed without re-running omarchy-hibernation-setup. The hash check means anyone who edited the file keeps their version. Dropping the sudo from the read-only checks in the "already set up" branch would avoid an unnecessary password prompt.

@superm1

superm1 commented Oct 8, 2026

Copy link
Copy Markdown
Author

OK. I've moved it to a standalone migrations shell script per your guidance.

Comment thread migrations/1791434765.sh Resolved
Comment thread migrations/1791434765.sh Resolved
@jandrusk

jandrusk commented Oct 8, 2026

Copy link
Copy Markdown

Thanks for moving it into a migration. Two small things in migrations/1791434765.sh:

  • The marker write needs sudo. /var/lib/omarchy/migrations is root-owned, so install -Dm644 /dev/null "$marker" fails after a successful rebuild, and under bash -euo pipefail the migration is reported as failed. The merged 1786605598.sh uses sudo install -Dm644 /dev/null "$rebuild_marker". Here you could also drop the marker entirely, because removing the drop-in already makes the migration a no-op for every later run and every other user.
  • Fail loudly on a rebuild failure, and flag the reboot. Right now a failed limine-mkinitcpio only prints a warning. The migration is then marked done with rtc_cmos.use_acpi_alarm=1 still in the boot entry, and it can't retry because the drop-in is gone. Something like:
[[ -f $rtc_alarm_drop_in ]] || exit 0
[[ $(sha256sum "$rtc_alarm_drop_in" | awk '{print $1}') == "$expected_hash" ]] || exit 0

echo "Removing stale ACPI RTC alarm drop-in ($rtc_alarm_drop_in)"
sudo rm -f -- "$rtc_alarm_drop_in"
if omarchy-cmd-present limine-mkinitcpio; then
  sudo limine-mkinitcpio
  omarchy-state set reboot-required
fi

(The next kernel update's rebuild would also pick it up if that ever failed.) The hash check matches the old file exactly. I checked c9469cd9… against the line the old setup wrote.

Comment thread migrations/1791434765.sh Resolved
Comment thread migrations/1791434765.sh Resolved
@greptile-apps

greptile-apps Bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Want your agent to iterate on Greptile's feedback? Try greploops.

@omarchybot omarchybot added the ready Good to merge label Oct 15, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed and tested on a disposable Omarchy VM, with mem_sleep switched to [s2idle]. With quattro's omarchy-hibernation-setup, the setup writes /etc/limine-entry-tool.d/rtc-alarm.conf and puts rtc_cmos.use_acpi_alarm=1 in /boot/limine.conf. With this branch it writes neither. That matches use_acpi_alarm_quirks() in drivers/rtc/rtc-cmos.c: it already turns the ACPI alarm on for Intel with a BIOS from 2015 on and AMD/Hygon from 2021 on, so the forced parameter only changes anything on the machines the kernel deliberately leaves out.

The migration does what it says on that VM. It removes the stock drop-in, rebuilds the boot entries and sets reboot-required. It leaves an edited drop-in alone, and a second run does nothing. The hash matches the exact line the old setup wrote.

I pushed one fix to your branch, 5ec2313. If limine-mkinitcpio failed, the migration had already deleted the drop-in. It exited 1, but the retry found nothing to remove and was marked complete, leaving the parameter in the boot entry. Now it puts the stock drop-in back before exiting, so the migration stays pending until a rebuild succeeds; this is tested on the VM both ways. The same commit corrects the header comment, which said omarchy-hibernation-setup removes the file on a re-run. Nothing does, which is why the migration is needed.

./test/cli and the hibernation, mkinitcpio-hooks, system-sleep-ownership and unowned-system-paths shell tests pass on this branch merged into current quattro. Codex Medium reviewed it as a second opinion. It found the same failed-rebuild problem, with the stale comment as well, and on a second round it had nothing open on the fix. It can read this review's working notes, so its agreement is not guaranteed to be independent.

Nothing is left for you. It is waiting on the maintainer.

@omarchybot omarchybot removed verified Omarchy Triage has verified that this issue is ready for final review ready Good to merge labels Oct 15, 2026
@omarchybot omarchybot added verified Omarchy Triage has verified that this issue is ready for final review ready Good to merge labels Oct 15, 2026
@superm1

superm1 commented Nov 17, 2026

Copy link
Copy Markdown
Author

@jandrusk anything else you need for this PR?

@omarchybot omarchybot removed ready Good to merge verified Omarchy Triage has verified that this issue is ready for final review labels Nov 18, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

I checked the recorded translation-check failure on 5ec2313. GitHub has expired the log and job details for that run, so its original cause could not be established.

On a disposable Omarchy VM, the historical structural translation test fails with the same locale-generation permission error both on this branch merged with its previously recorded test base, 246f33a, and on that base alone. Current quattro passes the structural test and English-literal extraction check. This comparison establishes no CI defect in this PR; it does not recover the missing GitHub failure or test the effect on affected hardware. I pushed no changes.

Codex High checked this, and Opus 5.5 High and muse-wonder via pi (high thinking) reviewed the evidence and agreed that no branch fix is established. Their independence is not guaranteed because reviewers can read the session's working notes. The branch also currently conflicts with quattro in bin/omarchy-hibernation-setup. It remains with the maintainer for the decision on removing the RTC workaround and the hardware evidence needed for that decision.

@kwilczynski kwilczynski self-assigned this Dec 5, 2026
@kwilczynski
kwilczynski self-requested a review December 5, 2026 19:55
@kwilczynski kwilczynski removed their assignment Dec 5, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Recommend: Hold — the maintainer needs affected-hardware results before deciding whether to remove the RTC override.

The PR conflicts with quattro after #19667. On an ISO worker, its migration exited successfully while the stock /etc/cmdline.d/rtc-alarm.conf still supplied rtc_cmos.use_acpi_alarm=1. It also calls Limine directly, bypassing the rebuild helper that handles both managed loaders and detects partial Limine failures.

Codex Medium, Opus 5.5 High and muse-wonder via pi, thinking high checked this. The boot command-line tests passed. The PR and its original base hit the same VS Code theme assertion in the CLI suite. The reviewers agreed on the hold and could read this session’s notes.

superm1 and others added 4 commits December 5, 2026 20:04
This reverts commit ecf48a3.

This is a misplaced change.  The Linux kernel already sets policy
for when RTC alarm should be used on the proper hardware.

See use_acpi_alarm_quirks() in https://github.com/torvalds/linux/blob/v7.3-rc5/drivers/rtc/rtc-cmos.c#L823

Signed-off-by: Mario Limonciello <superm1@gmail.com>
The migration deleted the drop-in before rebuilding the boot entries, so a failed limine-mkinitcpio left nothing for the retry to find: the next run exited 0, was marked complete, and the boot entry kept rtc_cmos.use_acpi_alarm=1. Putting the stock drop-in back on failure keeps the migration pending until a rebuild succeeds, as the migrations guide requires.

The header also said omarchy-hibernation-setup removes the file on a re-run; nothing does, which is why the migration exists.

Co-Authored-By: Codex Medium <noreply@openai.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ation

After omacom#19667, systemd-boot installs store kernel command-line drop-ins in /etc/cmdline.d/rtc-alarm.conf rather than /etc/limine-entry-tool.d/rtc-alarm.conf, and boot rebuilds must go through omarchy-boot-rebuild so both managed loaders are updated and partial Limine failures are detected.

Check both drop-in locations by exact stock content hash (preserving edited files), remove any matching stock drop-ins, rebuild via omarchy-boot-rebuild when an affected loader is managed, and restore removed stock drop-ins if the rebuild fails so the migration remains pending.
An interrupted rebuild can leave boot images using the RTC override after both stock drop-ins have been deleted. Record the pending rebuild before removing a managed loader's file and clear it once the rebuild succeeds. This also covers ordinary failures without writing the removed drop-ins back.

Check stock files and the pending marker with sudo when their directories are inaccessible. Query the managed loaders with the same privileges used by the rebuild so a root-only boot state cannot hide a managed loader.

Co-Authored-By: Codex High <noreply@openai.com>
Co-Authored-By: Opus 5.5 High <noreply@anthropic.com>
Co-Authored-By: muse-wonder via pi, thinking high <noreply@meta.com>
@omarchybot

Copy link
Copy Markdown
Collaborator

Recommend: Hold — a maintainer needs to approve the Actions runs and confirm suspend-then-hibernate on an s2idle machine that needed the original RTC override. Tests · Check translation structure

I pushed 27c6534 to handle root-only stock drop-ins and retry failed or interrupted boot rebuilds. The CLI suite, six focused shell tests, and migration probes passed on a disposable Omarchy worker, including a real Limine rebuild. Codex High, Opus 5.5 High and muse-wonder via pi, thinking high, checked the fix. The reviewers could read the session notes.

On the affected test machine, record whether systemctl suspend-then-hibernate works with the override. Fetch #14113, check out 27c65349d90de89d5f2ef53d58b2e115887b4cc3, run omarchy dev link /path/to/checkout, reboot, run omarchy migrate, and reboot again. Confirm rtc_cmos.use_acpi_alarm=1 is gone from /proc/cmdline, then repeat the test and reply with the machine model, kernel version, and both outcomes.

@omarchybot omarchybot removed the bug Something isn't working label Dec 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants