Repository navigation
Conversation
… 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]>
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. If the level can't be saved the LED still goes off, since a hang on power-off is worse than a dark keyboard, and the failure is logged. The migration now replaces installed copies that still match a shipped version, so making old copies executable no longer spreads the bug, and repairs the root-owned copies through sudo. Co-Authored-By: Claude Opus 5.5 <[email protected]>
[High impact] The PR appears safe to merge; no outstanding findings or new actionable issues remain. SummaryThe PR makes packaged sleep hooks executable, limits keyboard-backlight handling to ASUS LEDs with restoration after resume, and migrates recognized older installed hooks through staged replacement.
|
Copying over the installed hook in place could leave a partial file if the copy failed. A retry no longer recognized it as a shipped version, so it only made it executable and marked the migration done. Stage the new hook beside the old one and rename it into place, and cover force-igpu's repair in the test. Co-Authored-By: Claude Opus 5.5 <[email protected]>
asus*::kbd_backlight* missed names such as asus:rgb:kbd_backlight, which the old *kbd_backlight* glob covered, so match asus*kbd_backlight*. The LED and state directories were environment overrides only the tests needed; a root-run hook shouldn't read those, so the tests now run a copy rewritten to fake directories, as the ownership test did. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Making root-owned 644 copies executable as they were would switch on old code: earlier force-igpu copies call supergfxctl with no timeout and miss the hibernate phase of suspend-then-hibernate. Replace any copy of a shipped keyboard-backlight or force-igpu with the current hook, staged and renamed through sudo, and leave current or administrator-written hooks, content and mode, alone. Hooks the user can't read are hashed as root, and failures exit so omarchy-migrate retries. The migration moves to a current timestamp, after the migrations that shipped since it was first written. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Thorough work on the shipped-hash migration. Two things to help review:
I checked migration |
|
Thanks for splitting this out of #9816. This pull request does two things, and they end up in different places. The keyboard-backlight fix for #12657 competes with #11669 and #13729. All three rewrite The Two smaller points in
What was checked: the diff, the hook history on Second opinion: Codex Medium read the same pull requests without my conclusion. It found no functional defect at Waiting on the maintainer: choosing which pull request carries #12657, and whether the |
|
Thanks for the follow-up in What was checked: the new commit against Second opinion: none this time. Codex Medium answers a ping, but omabot's daily review budget was spent, so the reviewer could not re-confirm the classification at this head. Until it does, this pull request's classification is recorded as unsettled; the earlier agreement that it is a bug fix still stands from the last review. Still waiting on the maintainer: nothing else changed. #13729 still carries the keyboard-backlight fix for #12657 and is waiting on the maintainer, and #11669 is still open, so the choice between the three and whether the |
Split out of #9816 so these can land independently of its ASUS sleep-configuration changes (#9816 has since been closed).
Problem
Sleep hooks installed non-executable (hibernation setup installs keyboard-backlight system-sleep hook non-executable, so it never runs #7618).
omarchy-hibernation-setupandomarchy-toggle-hybrid-gpuused to copykeyboard-backlightandforce-igpuinto/usr/lib/systemd/system-sleepwithcp -pfrom files committed as 644. systemd-sleep only runs executables, so both hooks were silently skipped: the ASUS keyboard LEDs stayed lit into S4 (whichkeyboard-backlightexists to prevent), andforce-igpunever detached the dGPU before hibernate. Seen on an ASUS ROG Strix G834JZ, where a critical-battery hibernate needed a power-button hold and the installed hook was-rw-r--r--.quattro(feb0557) has since made both installers install the hooks root-owned 0755, and migration1788662350replaces copies a user could write. It leaves root-owned copies alone, though, andcp -pfrom the root-owned packaged source produced exactly that: a root-owned 644 hook. Those stay inert, and simply making them executable would switch on old code.The keyboard-backlight hook turns off any keyboard and never restores it (Hibernate pre-sleep hook kills keyboard backlight permanently (no post-resume restore) #12657). It zeroed the first
*kbd_backlight*LED of any vendor before hibernate and had nopostbranch, so a ThinkPad's keyboard stayed dark after resume, and after reboots oncesystemd-backlightsaved the 0.Solution
keyboard-backlightonly touches ASUS keyboard LEDs (asus*kbd_backlight*, soasus::kbd_backlightand names such asasus:rgb:kbd_backlight). It saves their brightness in/run(in RAM, so part of the hibernation image) and restores it onpost. If the level can't be saved, the LED still goes off, because a hang on power-off is worse than a dark keyboard, and the failure is logged. Its paths are fixed; tests run a rewritten copy.1790960338(runs after1788662350):keyboard-backlightorforce-igputhat matches a version Omarchy shipped (sha256 of every version inquattro's history) with the current hook;sudo, so a failed copy leaves the shipped version for a retry to recognize;omarchy-migrateretries.Replacing an old
force-igputurns on the current one, which acts only while/etc/supergfxd.confis in Integrated mode, and it is only installed when the user chose Integrated throughomarchy-toggle-hybrid-gpu.Not covered
Non-ASUS keyboards that the old hook already darkened keep the 0 that
systemd-backlightsaved until the user presses the brightness keys once. Telling that apart from a user who chose 0 isn't possible, so this PR doesn't touchsystemd-backlightstate.Testing
test/shell.d/system-sleep-hooks-test.shcovers:suspend-then-hibernate; a failed save (still off, logged, nothing restored); an empty saved level.sudo; a failed rename leaves the shipped hook, removes its stage, explains, and fails; a stage that can't be created explains and fails; rerun is a no-op with no privileged calls; current and customized hooks keep their content and mode.test/shell.d/system-sleep-ownership-migration-test.sh: the compound-sleep check now runs a rewritten copy of the hook (same assertions); passes.quattro's history was checked against the migration's list.asus::kbd_backlight, fromasus-nb-wmi), the hook run by hand as root:pre hibernatesaved 2 and turned the LED off,post hibernaterestored 2 and removed the state. That's the hook, not a full hibernate cycle../test/shelland./test/cli: the only failures (9 shell files, one vscode-theme check) fail identically onquattro.Fixes #12657
Fixes #7618
🤖 Generated with Claude Code