Desktop power button not responding and random sleep issues

November 16, 2021

A few days ago I started having issues with my computer. When I was putting it to sleep (or hibernating), it would either crash and turn off immediately, or would fail to power the GPU and USB ports after waking up, leaving me with a black screen and unresponsive keyboard and mouse, and forcing me to hard reset it.

More notably, when it crashed instantly as it entered sleep state, the power button didnā€™t work anymore and I needed to unplug the machine for a minute or so before being able to start it again. This didnā€™t always work the first shot though but usually after doing it a few times, it would eventually boot up again.

Itā€™s something that had already happened to me in rare occurrences during the past year, enough to get me frustrated and somewhat anxious when my machine effectively appeared to be bricked (thatā€™s how I found the unplug replug trick by despair), but not to a point where I spent the time to understand and fix the root cause, as it always kinda fixed itself without my intervention.

I remember one time where the unplug replug trick didnā€™t work to a point where I decided to open the machine and see what I can do inside, but interestingly just the sheer fact of opening it and moving it around so that I can work on it fixed the problem, so I was just happy to have a working computer again and didnā€™t question it much.

Thatā€™s until this week, coincidentally right before I upgrade to macOS Monterey.

Kernel panic: sleep wake failure in EFI

I was still running Big Sur back then and itā€™s been running smooth the whole year, but the day before I decide to upgrade to Monterey, I get those sleep issues again, mainly lack of GPU and USB power on wake (manifested by a black screen and unresponsive keyboard and mouse).

I figured it wasnā€™t worth fixing it now, and I might as well upgrade and see if it still happens. And while the upgrade goes smooth AF, I notice even more of those sleep issues after the fact. Theyā€™re not occasional anymore, they happen pretty much 90% of the time the computer sleeps, seemingly at random. It either fails to power the connected devices on wake or just crashes right away when being put to sleep and causes the unresponsive power button issue.

At that point I assume that it comes from the upgrade to Monterey, especially because Iā€™m running a Hackintosh and I suspect that it must be for sure the culprit. After all, thereā€™s ā€œhackā€ in the name, even though itā€™s been impressively stable since I use OpenCore.

I spend more time than Iā€™m willing to admit trying everything to fix power management and sleep, including using CPUFriend and CPUFriendFriend to fix the ā€œsleep wake failure in EFIā€ system panics. But none of that changes anything. I try to understand the different macOS sleep modes and various pmset settings to tune them and make things work but without any luck.

I also try to see if itā€™s related to any of my external devices, and while the issues seem to happen less frequently when I unplug my 3 external drives and my external sound card, they still happen somewhat randomly in a way that I canā€™t reliably isolate any of those as being the problem.

Questioning the hardware

At that point I lost more than 12 hours on this issue and Iā€™m going on my second day of relentless debugging. I feel like Iā€™ve tried everything possible and documented online about fixing sleep at the software, drivers and configuration level, and the precise issues and symptoms I run into donā€™t seem to exactly match any of the topics I find online.

I have a TP-Link PCI Wi-Fi card in there and Iā€™m thinking maybe itā€™s unsupported in a way that somehow causes the crashes with the new OS? I open the case and remove it, but this doesnā€™t seem to change anything.

I start questioning my actual hardware, looking more precisely at the ssue where the power button is unresponsive. I find a number of pages stating that a weak or dead CMOS battery could cause it (or also a faulty power supply šŸ˜…).

The CMOS battery is easier to test and cheaper to replace than the power supply, so I start with that. My machine is now 5 years old so itā€™s not exactly brand new, even though Iā€™ve kept desktop computers much longer than that in the past without needing to replace a CMOS battery once in my life. Regardless, I take it out and test it with a multimeter only to find that it delivers a solid 3 volts as itā€™s supposed to. I even test a brand new battery to compare and get the same results! Not the issue here, even though I wish it would have been as easy as replacing a CR2032 battery.

But when I put the battery back in place, my computer still doesnā€™t start! And turning off and on the PSU again doesnā€™t seem to work anymore. Did I accidentally fry the motherboard while manipulating the battery? I try one more time to be relieved by the sound of my machine booting, and welcoming me with a fresh BIOS reset screen. I configure everything again and boot macOS. At that point, all the USB devices are unplugged and Iā€™m on a freshly configured BIOS. I try the sleep again but sadly it keeps crashing.

Very specific googling, and final fix

As a last resort, I try searching the very specific symptom Iā€™m having and the hack I found to work around it: ā€œneed to unplug and replug computer for it to startā€. This sound so ridiculous and far fetched that Iā€™ve never thought about searching just that before, but Iā€™m pretty desperate at that point.

To my whole surprise, Iā€™m not the only one to have this issue, and in those two pages from respectively 5 and 10 years ago, the pinned solution is the same:

Open up the computer and look at all the extra cables inside make sure theyā€™re all neatly bundled away from any part of the case they may be shorting it out.

ā€” Why do I have to first unplug my computer to start?

After trying just about everything software wise (except a complete Windows reinstall) I was able to track the problem down to my PSU as many forums had suggested. It tuned out that some of the many extra connectors I had on my PSU I had stuffed into an extra empty drive bay in order to reduce the clutter inside the case. Somehow one of them had been causing a short. After moving the cables around and tiding them up neat and proper the problem has completely gone away (went from daily occurrence to two weeks so far with no problem).

ā€” Computer shuts off and wonā€™t turn back on until I unplug it

I did also stuff all my dangling PSU cables in an empty bay, and I thought I was doing myself a service by doing so, preventing a mess of cables in the middle of the case! I took the cables out of there, tidied them up differently and put them back in there in a way where they shouldnā€™t move around too much or touch anything.

After that? The computer boots just fine and I havenā€™t noticed a single crash or any of the issues I was having around sleep and wake. I progressively started to plug my sound card, then my external drives, testing the sleep every time (to more easily identify a culprit if it wasnā€™t fixed), and it kept working. Iā€™ve restored all of my original ā€œcleanā€ drivers, bootloader and system configuration (that I had modified during my attempts to fix the issue earlier), none of them caused any problem again.

Iā€™ve performed more than 20 successful sleep and wake cycles since then, whether I explicitly put the computer to sleep or let it hibernates by itself after a period of inactivity.

Conclusion

At that point Iā€™m somewhat confident that like in the two posts above, the dangling PSU cables in the unit were shorting and causes those issues. The fact they caused instability specifically at the sleep and wake level were probably very specific to me and the precise way the cables where shorting each other.

And the reason why the problem appeared to fix itself when unplugging and replugging the machine, or sometimes by just opening it and looking at it, doing no particular change inside? Those mere manipulations probably bumped the dangling wires inside just enough so that they werenā€™t shorting anymore, until they do again.

Itā€™s still hard for me to precisely explain why this was happening especially around sleep, and how the machine would otherwise be perfectly stable and never crash as long as it didnā€™t hit a sleep and wake cycle. Maybe something to do with the fans slightly moving the dangling cables while blowing at them? Iā€™m not technical enough in hardware and electronics to make sense of that, so if any of you reading that have a better idea, please let me know!

And at the very least I hope that if youā€™re reading this because of a similar issue, that helped you sort this problem out as well!

Want to leave a comment?

Join the discussion on Twitter or send me an email! šŸ’Œ
This post helped you? Buy me a coffee! šŸ»