Repository navigation
Conversation
3bfeb5b to
139fb29
Compare
139fb29 to
3ac6854
Compare
3ac6854 to
3c7c5ab
Compare
…d conditional S3 - Route RTC alarm via ACPI Fixed Event handlers (rtc_cmos.use_acpi_alarm=1) on all ASUS motherboards to prevent RTC alarm wake hangs. - Blacklist spd5118 DDR5 SPD temperature sensor driver to avoid async resume failures and SMBus lockups on DDR5 systems. - Only configure S3 (deep) sleep if firmware exposes "deep" in /sys/power/mem_sleep AND the lid switch is registered as an ACPI wakeup device in /proc/acpi/wakeup. Modern ASUS laptops (such as ROG Strix) drop S3 GPE wake routing for the lid switch in favor of Modern Standby (s2idle), leaving lid-open wake completely broken in S3 deep sleep, and cause black screens due to failed ACPI D-notifier transitions on discrete NVIDIA GPUs. - Clean up any stale deep sleep drop-ins when S3 lid wake is unsupported so systemd and the kernel default to s2idle.
… them omarchy-hibernation-setup and omarchy-toggle-hybrid-gpu used to copy keyboard-backlight and force-igpu into /usr/lib/systemd/system-sleep with cp -p from files committed as 644. systemd-sleep only executes files with the executable bit, so both hooks were silently skipped: the keyboard LEDs stayed lit into S4, which keyboard-backlight exists to prevent on ASUS keyboards, and force-igpu never detached the dGPU before hibernate. Seen on an ASUS ROG Strix G834JZ, where a critical-battery suspend-then-hibernate went straight to hibernate and the machine had to be power-cycled: /usr/lib/systemd/system-sleep/keyboard-backlight was -rw-r--r--. The installers now install the hooks 0755, and migration 1788662350 replaces copies a user could write. It leaves root-owned copies alone, which is what cp -p from the root-owned packaged source produced, so those stay 644. Add a migration that makes them executable, mark the hooks executable in the repo, and cover both with a shell test. Co-Authored-By: Claude Opus 5.5 <[email protected]>
3c7c5ab to
9e6d565
Compare
|
| run_logged "$OMARCHY_INSTALL/hardware/asus/fix-asus-ptl-b9406-display.sh" | ||
| run_logged "$OMARCHY_INSTALL/hardware/asus/fix-asus-ptl-b9406-touchpad.sh" | ||
| run_logged "$OMARCHY_INSTALL/hardware/asus/fix-z13-touchpad.sh" | ||
| run_logged "$OMARCHY_INSTALL/hardware/asus/fix-deep-sleep.sh" |
There was a problem hiding this comment.
Existing ASUS systems miss fixes
On an existing ASUS installation, a normal omarchy update runs migrations but does not rerun the hardware stage. This script is only called from that stage, while the new migration only repairs hook permissions. Updating therefore does not apply the RTC alarm, spd5118, or sleep-mode fixes to existing machines.
Knowledge Base Used:
| # ASUS motherboards route RTC alarm via ACPI Fixed Event handlers | ||
| KERNEL_CMDLINE[default]+=" rtc_cmos.use_acpi_alarm=1" | ||
| EOF | ||
|
|
There was a problem hiding this comment.
Boot settings remain unchanged
Writing these Limine fragments does not regenerate the boot entries, and the hardware stage does not run limine-mkinitcpio afterward. After a standalone hardware rerun, the RTC parameter remains absent from the boot entry, and a removed stale mem_sleep_default=deep setting can remain active until an unrelated rebuild.
Knowledge Base Used: Hardware, devices, and power
|
|
||
| # 3. Check for ACPI S3 deep sleep support AND lid wake capability | ||
| has_s3=$(grep -qw "deep" /sys/power/mem_sleep 2>/dev/null && echo true || echo false) | ||
| has_lid_s3_wake=$(grep -qi "LID" /proc/acpi/wakeup 2>/dev/null && echo true || echo false) |
|
|
||
| # 3. Check for ACPI S3 deep sleep support AND lid wake capability | ||
| has_s3=$(grep -qw "deep" /sys/power/mem_sleep 2>/dev/null && echo true || echo false) | ||
| has_lid_s3_wake=$(grep -qi "LID" /proc/acpi/wakeup 2>/dev/null && echo true || echo false) |
There was a problem hiding this comment.
Desktop sleep override removed
If an ASUS desktop has working S3 and an existing 10-mem-sleep-deep.conf override, it has no lid entry for this check to find. The script therefore deletes the override and changes the desktop's sleep mode, although lid-open wake is not relevant to that machine.
Knowledge Base Used: Hardware, devices, and power
| if lsmod | grep -qw "spd5118" 2>/dev/null || modinfo spd5118 >/dev/null 2>&1; then | ||
| mkdir -p /etc/modprobe.d | ||
| cat > /etc/modprobe.d/spd5118.conf <<'EOF' | ||
| # Prevent spd5118 async resume failures and SMBus lockups on DDR5 systems | ||
| blacklist spd5118 | ||
| EOF | ||
| fi |
There was a problem hiding this comment.
Blacklist affects unaffected machines
modinfo spd5118 shows that the kernel ships the driver, not that this ASUS machine has the SMBus suspend defect. On unaffected ASUS systems with DDR5, this check still blacklists the driver, unnecessarily removing DIMM temperature telemetry.
Knowledge Base Used: Hardware, devices, and power
| mkdir -p "$tmp_dir/system-sleep" | ||
| install -m644 "$hooks_dir/keyboard-backlight" "$tmp_dir/system-sleep/keyboard-backlight" | ||
| install -m644 /dev/null "$tmp_dir/system-sleep/unrelated" | ||
|
|
||
| OMARCHY_SYSTEM_SLEEP_DIR="$tmp_dir/system-sleep" bash -euo pipefail "$ROOT/migrations/1788695343.sh" >/dev/null || | ||
| fail "migration completes on a 644 hook" |
There was a problem hiding this comment.
Production repair path untested
The test creates a user-owned hook, so it exercises only the direct chmod branch. The migration's intended repair of a root-owned, nonexecutable hook uses sudo chmod instead. Without a test for that path, the actual upgrade repair could regress unnoticed.
Knowledge Base Used: Migration framework
The hook zeroed the first *kbd_backlight* LED before hibernate and had no post branch, so on non-ASUS laptops (tpacpi::kbd_backlight on a ThinkPad) the keyboard stayed dark after resume, and systemd-backlight then saved the 0 so it stayed dark after reboots too (omacom#12657). Only touch asus*::kbd_backlight* LEDs, which are the ones with the S4 hang, save their brightness in /run (part of the hibernation image), and put it back on post. The migration now replaces installed copies that still match a shipped version, so making old copies executable no longer spreads the bug. Co-Authored-By: Claude Opus 5.5 <[email protected]>
| cat "$led/brightness" >"$state_dir/${led##*/}" | ||
| echo 0 >"$led/brightness" |
There was a problem hiding this comment.
If saving an ASUS keyboard’s brightness fails—for example, because /run is full—the hook still sets the LED to 0 and exits successfully. It then has no valid brightness to restore on resume, so the keyboard can remain dark. Save the prior value successfully before turning the LED off.
Knowledge Base Used: Hardware, devices, and power
|
Closing this. The sleep-hook fixes moved to #14066, and re-checking the ASUS sleep configuration against the review left nothing in it that should merge:
Thanks to the reviewers. If S3 on a specific ASUS model turns out to need a fix, it'll come as a narrow PR with logs from that machine. |
Problem
On modern ASUS laptops (ROG, TUF, ZenBook, ExpertBook), sleep and wake behavior require several firmware-level workarounds under Linux:
rtc_cmos.use_acpi_alarm=1, timer wakeups either fail to fire or hang during suspend entry/exit.spd5118encounters firmware write-protection during async resume (spd5118 ... returns -6/ENXIO), locking the SMBus and freezing suspend transitions.deep) in/sys/power/mem_sleep, ASUS dropped ACPI S3 GPE wake routing for the lid switch (LID0lacks_PRWand is absent from/proc/acpi/wakeup) in favor of Microsoft Modern Standby (s2idle).MemorySleepMode=deepormem_sleep_default=deepon these machines means opening the lid cannot wake the laptop at all.status=0x11), producing black screens.Solution
install/hardware/asus/fix-deep-sleep.shand wired it intoinstall/hardware/all.sh.rtc_cmos.use_acpi_alarm=1via/etc/limine-entry-tool.d/asus-rtc-alarm.confon all ASUS systems.spd5118via/etc/modprobe.d/spd5118.confif the module/driver is present, eliminating SMBus bus locks and suspend/resume freezes.MemorySleepMode=deepandmem_sleep_default=deepif bothgrep -qw "deep" /sys/power/mem_sleepandgrep -qi "LID" /proc/acpi/wakeupare satisfied.s2idlewhere lid-open wake is fully functional, and cleans up any stale S3 overrides that break lid-open wake.Update 2026-09-06: the system-sleep hooks were never executable
A critical-battery
suspend-then-hibernateon this ROG Strix G834JZ (upowerd at 1 %, so systemd-sleep skipped the suspend leg and hibernated directly) ended with a 10 s power-button hold. Two separate defects were involved; the second commit here fixes the one in this PR's scope.default/systemd/system-sleep/keyboard-backlightandforce-igpuwere committed as 644 andomarchy-hibernation-setup/omarchy-toggle-hybrid-gpucopied them withcp -p, so systemd-sleep silently skipped both (/usr/lib/systemd/system-sleep/keyboard-backlightwas-rw-r--r--on this machine).keyboard-backlightexists precisely to stop the ASUS keyboard controller from blocking S4 power-off (hibernation setup installs keyboard-backlight system-sleep hook non-executable, so it never runs #7618). Since this PR was opened,quattro(feb0557) made both installers install the hooks root-owned 0755, so the installer edits were dropped when rebasing. What remains: the hooks are executable in the repo, and migration1788695343makes existing root-owned 644 copies executable. Upstream's1788662350only replaces copies a user could write, andcp -pfrom the root-owned packaged source produced root-owned 644 copies, so those were left inert.install/hardware/nvidia.shearly-loads nvidia in the initramfs (nv_pmops_freeze returns -5→PM: hibernation: resume failed (-5)). That is Hibernation resume fails on hybrid Intel+NVIDIA laptops — nvidia.sh's early-KMS module bundling races the resume hook #8352 / Hibernate resume fails (nv_pmops_freeze → -EIO) on single-NVIDIA-GPU desktops — initramfs nvidia load blocks the resume hook #10039 and is fixed generically by Stop early-loading the NVIDIA driver on hybrid GPU machines so hibernation can resume #8263; this PR intentionally does not duplicate it. Together they make battery sleep survivable on ROG Strix hybrids.Update 2026-10-02: scope keyboard-backlight to ASUS and restore it on resume (#12657)
Making the old hook copies executable would have spread #12657: the hook zeroed the first
*kbd_backlight*LED of any vendor before hibernate and never restored it, so a ThinkPad's keyboard stayed dark after resume and, oncesystemd-backlightsaved the 0, after reboots too. The third commit:asus*::kbd_backlight*LEDs, the ones with the S4 hang;/run(part of the hibernation image) and restores it onpost;suspend-then-hibernate, and the migration, and updates the compound-sleep check insystem-sleep-ownership-migration-test.shto the new interface.Tested on the ROG Strix G834JZ (
asus::kbd_backlight): running the hook as root,pre hibernatesaved brightness 2 and set the LED to 0, andpost hibernaterestored 2 and removed the state. That was the hook run by hand, not a full hibernate cycle.system-sleep-hooks-test.shandsystem-sleep-ownership-migration-test.shpass../test/shellhas 9 other failing files that fail identically onquattro(environment-dependent).Fixes #12657
Fixes #7618