“Night brings at last never-ending sleep” – Insomnium


TLDR: Disable Standby with:

sudo pmset -a standby 0

Table of Contents

  1. The Symptom
  2. What Didn’t Work
    1. Following OCLP’s Documentation
    2. Deleting Diagnostics
    3. Resetting NVRAM
    4. Disabling Hibernation
  3. What Worked
  4. Parting Words

I’m still using my 2017 MacBook Pro (MacBookPro14,1) as my personal machine. Last year, I was saddened to discover that Apple had dropped it from the list of devices supported by macOS Sonoma, and I turned to OpenCore Legacy Patcher. The patching process was smooth and I upgraded to Sonoma successfully, only to discover that every morning when I open its lid, it boots from a white apple logo and every application restarts without previous state. It’s not a deal-breaker, but certainly very annoying.

The Symptom

Specifically, the symptom is: whenever it sleeps for more than a few hours, it will not wake up and basically reboot instead. There will be a report under /Library/Logs/DiagnosticReports, named Sleep Wake Failure_2024-04-13-102603_machine-name.diag, with the following content:

Sleep Wake failure in EFI

Failure code:: 0x0171260e 0x0000001f

Please IGNORE the below stackshot

================================================================
Date/Time:        2024-04-13 10:24:29.880 +0000
OS Version:       ??? ??? (Build ???)
Architecture:     x86_64
Report Version:   47
Incident Identifier: 61B3C85B-FB16-436D-9C1A-22FD7E6187BC

Data Source:      Stackshots
Shared Cache:     5CB61D18-2D12-3A26-A536-F0B08E953CA2 slid base address 0x7ff8147e8000, slide 0x147e8000 (System Primary)
Shared Cache:     9D08E1CF-B3BB-34E5-9CF5-C92306E69752 slid base address 0x7ff81b16d000, slide 0x1b16d000 (DriverKit)

Event:            Sleep Wake Failure
Duration:         0.00s
Steps:            1

Boot args:        keepsyms=1 debug=0x100 ipc_control_port_options=0 -nokcmismatchpanic

Time Awake Since Boot: 17s

A quick search revealed that I’m not alone in this, e.g. MacRumors, Reddit.

What Didn’t Work

Following OCLP’s Documentation

I tried to follow through OCLP’s documentation on Fixing Sleep and Fixing Power Management, only to find out I lack an immense amount of domain knowledge to go through the steps. I could have learned more about how things works, but it’s obvious that the time cost would pay for multiple brand new MacBooks.

Deleting Diagnostics

The Reddit post suggested deleting the diagnostic report would fix the issue, and there are many responding that it worked for them. It doesn’t make any sense that you would fix an issue by deleting its diagnostic reports, and indeed it didn’t work for me.

Resetting NVRAM

No luck here either. NVRAM resets never work.

Disabling Hibernation

I came across a random GitHub comment claiming the following (for a different issue):

You should try disabling hibernation

sudo pmset -a hibernatemode 0

“Then my laptop will not sleep at all?”

No, it will sleep, but it will not be in hibernation mode.

Hibernation mode is when RAM is dumped to file and laptop shuts down.

Hibernation almost never works on hackintosh laptops.

That didn’t work, but it prompted me to learn more about how MacBooks sleep, which revealed these excellent StackOverflow answers by Gilby:

I first tried setting hibernatemode to 25, but it made the problem appear sooner – it reboots when it has been sleeping for less than an hour. It’s a curious kind of success, like when your test starts failing with a different error message, you know you are making progress.

What Worked

A quick summary of what we had so far:

  1. With the default configuration, the issue occurs when sleeping more than a few hours
  2. If we set hibernatemode to 25, it appears sooner than that

Combined with this excellent illustration of the macOS sleep stages (from elgcom on StackOverflow):

It’s obvious to what’s going on: “hibernate” / “standby” / “safe sleep” or whatever its called, it doesn’t work with OCLP’s Sonoma on this MacBook Pro.

Therefore, the solution is a simple:

sudo pmset -a standby 0

Now it wakes normally. The battery drain of sleeping like this is also acceptable (7% in 12 hours in its last sleep).

Parting Words

I don’t have accounts to any of the forums above, so I’ll leave this to Google to do its thing. May the gods of ranking algorithms guide anyone who suffer from this issue to this page.