Skip to content

Fix lid-close suspend on the MacBookPro14,1 - #14409

Open
sdpursley wants to merge 7 commits into
omacom:quattrofrom
sdpursley:fix-apple-s3x-suspend
Open

sdpursley wants to merge 7 commits into
omacom:quattrofrom
sdpursley:fix-apple-s3x-suspend

Conversation

@sdpursley

Copy link
Copy Markdown

Problem

On a MacBookPro14,1 (2017, Apple S3X NVMe 106b:2003), closing the lid suspends and never resumes. The machine has to be forced off and cold-booted. It looks like the laptop shut down.

Omarchy already installs fix-suspend-nvme.sh for this model class. That script only sets d3cold_allowed=0 on 0000:01:00.0. The service was already installed and active on the test machine, and suspend still never woke.

Before this change the journal had five suspend entries (two deep, then s2idle) and no PM: suspend exit. After the kernel parameters below, the same boot woke from a 60-second rtcwake and from a real lid close. suspend_stats went to success 2, fail 0. The root filesystem stayed writable, and the kernel log had no NVMe identify or timeout errors.

Change

For the models this script already matches (MacBook 8,1 / 9,1 / 10,1 and MacBookPro 13,1–13,3 and 14,1–14,3):

  • Add a udev rule matched on 106b:2003, so D3cold stays off when the controller is not at 0000:01:00.0.
  • Add a Limine drop-in: mem_sleep_default=s2idle nvme_core.default_ps_max_latency_us=0 intel_idle.max_cstate=1.
  • Leave the existing D3cold systemd service in place.
  • Migration 1790589912.sh applies the same script on existing installs and rebuilds the UKI only when the running command line does not already contain those parameters.

Fresh installs write the drop-in before limine-snapper.sh builds the boot image, so the parameters are picked up with the other hardware drop-ins.

Limits

  • Tested on one MacBookPro14,1. The three parameters were applied together. intel_idle.max_cstate=1 raises idle power and heat the whole time the machine is on, and it was not tested by itself.
  • Only short sleeps were tested: about 60 seconds, and a lid close of about two and a half minutes. A multi-hour sleep was not tested. Notes for this SSD say a long s2idle can still wedge.
  • The first wake on this machine stalled for about two minutes because the Thunderbolt USB controller did not resume. That is a separate bug. The later lid-close wake took a few seconds.
  • This is not the T2 suspend hang (106b:1801 / 106b:1802). Async suspend was left on, and these short cycles still resumed.

@greptile-apps

greptile-apps Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The changes since the previous review appear safe to merge.

Summary

This PR adds a suspend workaround for MacBookPro14,1 and keeps Apple's S3X storage controller out of D3cold on selected MacBooks.

  • Apple MacBooks use safer NVMe settings for lid-close sleep.

Both numbered findings from the previous review are addressed. No new actionable issues were found.

Reviews (9) · Last reviewed commit: "Cover the MacBook suspend leaf in the ha..." · Reviewed by Greptile

Comment thread migrations/1791387391.sh Resolved
@jandrusk

jandrusk commented Oct 7, 2026

Copy link
Copy Markdown

Thanks for testing this on real hardware. One blocker before review:

BLOCKING: this targets dev, which is ~2,450 commits behind quattro. On quattro the script lives at install/hardware/apple/fix-suspend-nvme.sh (not install/config/hardware/apple/), and the installer no longer defines chrootable_systemctl_enable (current code calls sudo systemctl enable directly). Could you rebase onto quattro and retarget the PR? That means:

  • applying the change to install/hardware/apple/fix-suspend-nvme.sh
  • source "$OMARCHY_PATH/install/hardware/apple/fix-suspend-nvme.sh" in the migration and dropping the chrootable_systemctl_enable shim
  • a fresh migration timestamp (date +%s)

Nit: under bash -e, sudo limine-mkinitcpio && omarchy-state set reboot-required won't abort if the rebuild fails, so the migration gets marked done without the new cmdline. Splitting it fails loudly instead:

if (( needs_rebuild )) && omarchy-cmd-present limine-mkinitcpio; then
  sudo limine-mkinitcpio
  omarchy-state set reboot-required
fi

Also related: #11624 scopes the same script's D3cold fix to Apple's NVMe controller (your 106b:2003 udev rule covers similar ground), and #12194 covers MacBookPro14,2 S3 wake. intel_idle.max_cstate=1 raises idle power on every matching model, so it probably needs a maintainer call.

@sdpursley
sdpursley force-pushed the fix-apple-s3x-suspend branch from d0d5b1a to 47adc16 Compare October 7, 2026 15:38
@sdpursley
sdpursley changed the base branch from dev to quattro October 7, 2026 15:38
@sdpursley

Copy link
Copy Markdown
Author

Moved onto quattro.

  • The change is now in install/hardware/apple/fix-suspend-nvme.sh. The existing D3cold service is unchanged, including sudo systemctl enable.
  • The migration sources $OMARCHY_PATH/install/hardware/apple/fix-suspend-nvme.sh and no longer defines chrootable_systemctl_enable. Its timestamp is 1791387391.
  • The rebuild and the reboot flag are separate commands. omarchy-migrate runs migrations with bash -euo pipefail, and a failure on the left of && does not abort, so a failed limine-mkinitcpio would have been marked done. A failed rebuild now stops the migration before reboot-required is set.

The udev rule matches 106b:2003 only, so it does not write D3cold onto the GPU at 0000:01:00.0 on the 15-inch models in #11624. The kernel parameters still use this script's existing model list. intel_idle.max_cstate=1 is part of the combo that resumed the MacBookPro14,1 and was not tested alone; it does raise idle power. Happy to limit those parameters to MacBookPro14,1 if that is the call, including relative to the MacBookPro14,2 S3 wake loop in #12194.

The pull request base is now quattro.

@jandrusk

jandrusk commented Oct 8, 2026

Copy link
Copy Markdown

Thanks for moving this onto quattro so quickly. Re-checked at 47adc16: the change is in install/hardware/apple/fix-suspend-nvme.sh, the migration sources it with no chrootable_systemctl_enable shim, 1791387391.sh doesn't collide with anything on quattro, and a failed limine-mkinitcpio now stops the migration before reboot-required is set. That clears my blocker. LGTM from my side.

The one open question is the maintainers' call: whether intel_idle.max_cstate=1 should apply to the whole model list or only to MacBookPro14,1, where the combo was actually tested (see #12194 for the 14,2 wake loop).

@angellindo

Copy link
Copy Markdown

Heads-up from a MacBookPro14,3 (15-inch, 2017). It is in this script's model list, but its NVMe is a Samsung 144d:a804 at 02:00.0, not the Apple S3X 106b:2003; 01:00.0 is the Radeon. So the udev rule correctly skips it, but the Limine drop-in still applies, because it is gated by model, not by the NVMe ID.

On the 14,3 that would be a regression:

  • S3 (deep) works here (amdgpu unbound before sleep, see Suspend on 2016-2017 MacBook Pros: keep USB-C and Thunderbolt working across S3 #11570). mem_sleep_default=s2idle would move it back to s2idle, where the package never goes past PC3, even on a stock Arch kernel.
  • intel_idle.max_cstate=1 caps the cores at C1. Today they spend almost all idle time in C7/C10. I have not measured with max_cstate=1, but as you note, idle power should go up.
S3, 8 h 11 min on battery, charge_now before/after: 0.22-0.29 W
s2idle (same machine, battery/RAPL): 7-13 W system
Stock Arch 7.2.2 live, idle (turbostat): CPU%c7 99.6 %, package stuck at PC3
intel_idle residency, cpu0 since boot: C10 1323 s vs C1 5 s

Suggestion: write the drop-in only when 106b:2003 is present (or only for MacBookPro14,1, where it was tested). Note that the migration also sources the older block, which writes d3cold_allowed=0 to 0000:01:00.0; on the 14,3 that is the GPU.

Happy to test a revised version on the 14,3 if useful.

@sdpursley

Copy link
Copy Markdown
Author

The three boot parameters are now installed only on the MacBookPro14,1, in 98a8df5.

That is the only machine where this combination was tested. A 60-second suspend and a real lid close both resumed there. Applying the same settings from the SSD id alone would still change the MacBookPro14,2, which has 106b:2003 and should stay on deep sleep, and it would have changed the 15-inch models that do not have that SSD. Other models keep their current sleep mode. A maintainer can widen the match after the same test on another machine.

The udev rule is unchanged and still matches only 106b:2003, so it does not write D3cold onto the 14,3 GPU.

@sdpursley sdpursley changed the title Fix lid-close suspend on 2016-2017 MacBooks with Apple S3X NVMe Fix lid-close suspend on the MacBookPro14,1 Oct 9, 2026
@niconistal

Copy link
Copy Markdown

A data point for the 14,3 end of this gate. MacBookPro14,3 with a Samsung SM961 NVMe (144d:a804, not 106b:2003), so the new udev rule doesn't match it.

mem_sleep_default=s2idle is also the right mode there: S3 never resumes, because amdgpu fails SMU reload with -22 and the Radeon drives the panel. But s2idle alone wasn't enough on the stock linux-omarchy 7.2.5-3. Resume stalled about 65 s on the Alpine Ridge controllers, then Wi-Fi (BCM43602, err=-19) and Thunderbolt (-108) were dead. With omarchy-pkgs#596 + #544 it resumed 18 of 18 in about 0.5 s, with no nvme_core.default_ps_max_latency_us=0 and no intel_idle.max_cstate=1.

intel_idle.max_cstate=1 costs idle power all the time, not only during sleep, so it may be worth limiting it to the models that need it (the 14,1 here). I haven't measured its effect on the 14,3. Details: omacom/omarchy-pkgs#596 (comment) and #12211.

@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed by Claude Opus 5.5, with Codex Medium as a second opinion over three rounds. Both read the change against quattro, and its scripts were run on an Omarchy worker with the MacBook model, /proc/cmdline, sudo and limine-mkinitcpio stubbed. A worker has no MacBookPro14,1, so the suspend failure itself was not reproduced. Whether this fixes it still rests on a test on that machine.

What was checked. The leaf writes the udev rule on every model in its match and the Limine drop-in only on the MacBookPro14,1. udevadm verify accepts the rule. The drop-in reaches fresh installs, because install/hardware/all.sh runs this leaf before the installer's final limine-update builds the UKIs. The migration rebuilds the UKI only when the booted command line lacks the three parameters, and a failed rebuild stops it before reboot-required is set. The 14,2, 14,3, 13,3 and 12-inch models get no boot parameters, and a non-Mac gets nothing. ./test/cli (117 checks), privileged-heredoc-test.sh, t2-hardware-test.sh and bin-style-test.sh pass on the worker.

Fixed on your branch, in 88d7956. Codex found this and I confirmed it. The migration sourced the whole leaf, which also rewrote and re-enabled the older omarchy-nvme-suspend-fix.service on every model in the match. On the 15-inch MacBookPro13,3 and 14,3, that service writes to the GPU at 0000:01:00.0 (#10826), so anyone who had disabled it would have had it switched back on. A second user on the same machine would also have rebuilt the UKI again before the reboot. The migration now writes only the udev rule and, on the 14,1, the drop-in, each only when the file doesn't already hold its setting. That way a second run changes nothing, and a file an interrupted run left half-written is rewritten. A marker under /var/lib/omarchy/migrations/ records the rebuild once per machine. Codex's last round on this commit found nothing open.

What it waits on: a test on a MacBookPro14,1. It needs to come from someone other than the author, or a maintainer. @orospakr, you reported the 14,1's suspend failures in #10593. If you can, please try commit 88d79567c8c59489bac284427357fcd7351ba4a6:

git clone https://github.com/omacom/omarchy.git /tmp/omarchy-14409
git -C /tmp/omarchy-14409 fetch origin pull/14409/head
git -C /tmp/omarchy-14409 checkout 88d79567c8c59489bac284427357fcd7351ba4a6
OMARCHY_PATH=/tmp/omarchy-14409 bash -euo pipefail /tmp/omarchy-14409/migrations/1791387391.sh
# reboot, then:
cat /proc/cmdline /sys/power/mem_sleep
sudo rtcwake -m mem -s 60
journalctl -b | grep -E 'PM: suspend (entry|exit)'

Then reply with that commit, the output, and whether a real lid close of a few minutes also resumed. Take out /etc/limine-entry-tool.d/apple-s3x-suspend.conf and rebuild with sudo limine-mkinitcpio afterwards if you'd rather not keep it.

For the maintainer. intel_idle.max_cstate=1 holds the cores at C1 the whole time the 14,1 is on, and it wasn't tested apart from the other two parameters. Whether that cost is acceptable is a decision only the maintainer can make. Two other pull requests touch the same ground. #11624 rewrites the same leaf, scoping its D3cold service to Apple's controller and dropping the 13,3 and 14,3, so whichever lands second needs merging. #10758 also moves the 14,1 to s2idle, through its own drop-in, macbookpro14-1-thunderbolt.conf. The two drop-ins set the same mem_sleep_default and do not conflict.

Comment thread migrations/1791387391.sh Resolved
@omarchybot

Copy link
Copy Markdown
Collaborator

One more fix on your branch, in d58c00a. Greptile's review of 88d7956 was right: omarchy-state keeps reboot-required under each user's home, and the migration skipped it along with the rebuild once the machine-wide marker existed. A second user who updated before the reboot never saw the notice. Now the UKI is still rebuilt once per machine, and every user whose booted command line lacks the three parameters gets the reboot notice. Reviewed by Claude Opus 5.5 and by Codex Medium, which agreed and found nothing else. Its independence is not guaranteed. On an Omarchy worker the stubbed migration harness passes with the fix and fails the new second-user check without it. ./test/cli (117 checks), privileged-heredoc-test.sh, t2-hardware-test.sh and bin-style-test.sh also pass.

It still waits on a test on a MacBookPro14,1, now at the new head. @orospakr, if you can try it, please use commit d58c00a131b641f0b36264b5c2dc7ef4847a5ba1 in place of 88d79567 in the steps above. Nothing else in those steps changes. The maintainer's decision about intel_idle.max_cstate=1 stands as described above.

Spencer Pursley and others added 5 commits November 18, 2026 08:29
Disabling D3cold does not wake a MacBookPro14,1. Force s2idle and keep the
106b:2003 controller out of the power states it cannot leave. The migration
aborts if the boot image rebuild fails, then asks for a reboot.
That is the only model where this sleep combo was tested. Other models keep their current sleep mode.
Sourcing the whole leaf also rewrote and re-enabled the older D3cold service on every model in its match. On the 15-inch MacBookPro13,3 and 14,3 that service writes to the GPU at 0000:01:00.0 (omacom#10826), so a user who had disabled it got it back. The migration now writes just the udev rule and, on the MacBookPro14,1, the Limine drop-in, each only when the file does not already hold its setting, so a second user's run changes nothing and a file an interrupted run left empty or cut short is rewritten. The UKI rebuild is recorded in a machine-wide marker so a second user's run before the reboot does not rebuild again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Codex Medium <noreply@openai.com>
omarchy-state keeps reboot-required under the user's home, so skipping it along with the machine-wide rebuild left a second user who updated before the reboot without the notice. The rebuild still runs once per machine; the notice is set on every run that finds the booted command line without the parameters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The MacBook8,1 and the 15-inch 13,3 and 14,3 no longer get the service
that writes d3cold_allowed at 0000:01:00.0. The unit no longer escapes
colons. The udev rule and the MacBookPro14,1 boot parameters stay.
@sdpursley

Copy link
Copy Markdown
Author

@dhh Rebased onto current quattro and reconciled install/hardware/apple/fix-suspend-nvme.sh with #11624. The old D3cold service now uses that pull request's model list and only runs when 0000:01:00.0 is Apple's controller. The udev rule and the MacBookPro14,1 boot parameters are unchanged. #11624 still owns the migration that removes the service from machines where it already points at the GPU. #10758 sets the same mem_sleep_default=s2idle for this model from its own drop-in.

A month has passed since the request for a second MacBookPro14,1 test, and nobody has run one. Those three parameters were tested here: a 60-second rtcwake and a lid close of about two and a half minutes both resumed. Could a maintainer decide on that evidence? The open call is whether intel_idle.max_cstate=1 is an acceptable idle-power cost on the 14,1.

@sdpursley
sdpursley force-pushed the fix-apple-s3x-suspend branch from d58c00a to ae181ce Compare November 18, 2026 14:29
Comment thread migrations/1791387391.sh Resolved
@omarchybot

Copy link
Copy Markdown
Collaborator

I read the revised hardware script, migration and review discussion against quattro at ae181ce618f3466e085bd585578fba054f22d986. The review in this pass was by GPT-6 in Codex; its reasoning effort is not exposed. No scripts or tests ran in this pass.

My classification is a hardware compatibility fix, but the configured second classifier, deepseek-v4p1-flash, returned no usable classification. This leaves the current revision unreviewed by the classification pair, so the queue workflow stops here at disagree until classification can be completed. The separate review service answered its availability check, but no second review of this revision ran. No code or labels were changed.

limine-mkinitcpio can report a kernel it failed to rebuild and still exit
0. The migration now notices that and stays pending. Model checks go
through omarchy-hw-match, anchored so a longer product name does not match.
Comment thread test/shell.d/apple-s3x-suspend-test.sh Resolved
Comment thread test/shell.d/apple-s3x-suspend-test.sh Resolved
@omarchybot omarchybot removed bug Something isn't working compatibility Make Omarchy work better on everything! labels Nov 18, 2026
A migration gets no suite test: it runs once and is frozen once it ships.
The installer script is checked by the existing quirk harness, whose sudo
stub logs systemctl instead of running it.
@omarchybot

Copy link
Copy Markdown
Collaborator

I read the revised diff at 9caf967a45fcb794c2c33ab007e2560e5388efcb, including the rebuild-failure handling and the tests added to the existing hardware quirk suite, along with the discussion and quattro's install and migration rules. This pass was by GPT-6 in Codex; its reasoning effort is not exposed. No scripts or tests ran in this pass.

My classification remains a hardware compatibility fix. The configured second classifier, deepseek-v4p1-flash, again returned no usable classification for this revision. The queue workflow therefore stops at disagree, pending completion of classification. No second review of this revision ran, and no code or labels were changed in this pass.

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.

5 participants