marionuevo

· Software, Linux

Linux on an iMac 5K: sleep that looks like a dead board

Twice, Linux put my iMac to sleep and it woke up as what looked like a dead logic board. One board came back; the other never did. Can software really break hardware? Sometimes it can. This is what I could prove about mine, and what I couldn't.

Can software break hardware?

Yes, and it has happened often enough to sort the cases. I found five ways, from the most permanent to the least.

HowReal casesCan it be undone?
1. Overwrite what the hardware needs to startCIH (1998), Samsung laptops (2013), Ubuntu 17.10 on Lenovo laptops (2017)With an external programmer, or a new board
2. Wear it outTesla Model S and X touchscreens (2021)No
3. Push it out of its safe rangeNVIDIA driver 196.75 (2010), Intel 13th and 14th gen (2024)No
4. Pull the trigger on a weak partNew World and the RTX 3090 (2021)No, but the part was already weak
5. Leave it stuckMy iMac (2026)Yes, if you know what to reset

The first is the famous one. The CIH virus erased the BIOS of some PCs, which wouldn't start again until the chip was reprogrammed or replaced. It doesn't take a virus. In 2013, booting Linux in UEFI mode bricked some Samsung laptops whose firmware refused to start once its variable storage was more than half full. In 2017, just booting Ubuntu 17.10's live image left some Lenovo laptops unable to save BIOS settings or boot from USB. Nothing was erased there: a buggy driver for the firmware's flash chip changed protection settings, and that was enough. Canonical pulled the release for three weeks.

The second is wear. The early Tesla Model S and X kept their touchscreen's system on an 8 GB flash chip that wears out with every write, and in some build months over 30% of them failed; Tesla recalled about 158,000 cars. The third is running hardware outside its safe range. In 2010 an NVIDIA driver didn't speed the fan up under load. In 2024 Intel found that the microcode of its 13th and 14th-gen desktop CPUs was requesting voltages that aged them, and its microcode fix stops the damage but doesn't undo it. The fourth is pulling the trigger on a weak part: in 2021 the menu of Amazon's New World, with no frame-rate cap, killed RTX 3090s, mostly EVGA's, and EVGA's X-rays found poor soldering around the power MOSFETs in a 2020 batch.

The fifth is the strange one, and the one this article is about. Software leaves the hardware in a bad state, stored somewhere that survives switching it off. Nothing is damaged, but from the outside it's indistinguishable from a dead board until you find out what to reset.

The sleep it didn't wake up from

My iMac is a late-2014 Retina 5K (iMac15,1, Radeon R9 M290X) that Apple no longer updates, running Omarchy. In the previous article I explained how it shut itself down because nothing was watching its RAM. This is the other thing that happened that month. On October 8 I put it to sleep, ordinary S3 sleep (deep in Linux's terms), and it never came back. The last lines that board ever wrote:

Oct 08 08:04:20 systemd-sleep: Successfully froze unit 'user.slice'.
Oct 08 08:04:20 systemd-sleep: Performing sleep operation 'suspend'...

After that it rebooted in a loop before printing a single kernel message, even from the installation USB stick. With ACPI disabled (acpi=off) it didn't loop, which already pointed at something between Linux and the firmware. Soon it showed nothing at all. With the display removed, the diagnostic LEDs on the board told the story.

  1. 1Standby power
  2. 2Computer on
  3. 3Computer and GPU talking
  4. 4Video reaching the panel
What the board showed after every failed sleep: powered and running, but no GPU. Apple's service manual, for exactly this pattern: “the backup battery (on back of logic board) may need to be reseated or the video card might be installed incorrectly or need replacement.”

That GPU had a history (it had failed like this once before, months earlier, and it ran hot), so I took it for dead and bought a replacement board on eBay for €93. On October 19 I gave the new board 30 minutes of GPU load at 86°C and 12 minutes of video-memory tests, without a single error. Then I tested sleep, which was the whole point:

16:16:15 PM: suspend entry (deep)
16:16:42 ACPI: PM: Preparing to enter system sleep state S3
16:16:42 ACPI: PM: Waking up from system sleep state S3
16:16:42 ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
16:16:43 PM: suspend exit
16:19:52 PM: suspend entry (deep)

The first cycle woke up in 27 seconds. The second didn't: the lock screen came back, but the keyboard didn't respond over USB or Bluetooth, and nothing else ever reached the journal. That time a few minutes switched off were enough. After a kernel update I tried once more, from cold. Same ending, and after a forced power-off the new board sat in exactly the same state as the old one: LEDs 1 and 2, nothing else.

What it took to bring it back

  • Forced power-off and back on: LEDs 1 and 2.
  • 10 to 15 minutes unplugged, and an SMC reset: LEDs 1 and 2.
  • NVRAM reset: the startup chime came back, nothing else.
  • 30 minutes unplugged: all four LEDs and the backlight. Booting Linux took it back to 1 and 2.
  • A whole night unplugged: the firmware drew the boot menu. Booting Linux reset the machine, and the GPU was gone again.
  • Taking the board out (without its battery while it was out, every connector reseated, fresh thermal paste) and putting it back: it booted. It has booted normally about 40 times since, and it hasn't slept once.

Two things stand out. Once the board was in that state it no longer needed a sleep to fail: the firmware could use the GPU, and booting Linux brought the problem back. And whatever held the state survived everything short of taking the iMac apart.

The old board did come back once on its own, after eleven days unused: the firmware showed video. But it never booted Linux again, and the last time I tried it, it didn't get past LEDs 1 and 2 even with its CMOS cleared. Before closing the iMac for good I tried it once more, after days without a battery: a fresh coin cell (3.04 V, measured on the board's battery pads), then the manual's RTC reset. Still LEDs 1 and 2. Whatever is wrong with it, it's beyond anything an owner can reset, and with that GPU's history, I can't blame that one on software.

Where a switched-off Mac keeps state

“Off” isn't one state. Several parts of the iMac stay alive at different levels, and each is cleared by something different:

PartWhat it keepsWhat clears it
CPU, RAM, GPUEverything you're working onSwitching off
Standby power (while plugged in)The SMC (power, fans, sensors), the chipset's standby side, the Intel MEUnplugging for 15 seconds (an SMC reset)
Coin cell (CR2032)The clock, 256 bytes of CMOS memory (Apple's firmware keeps a record there that reads “BOOT”), chipset register bitsRemoving the battery, or shorting the RTC reset pads
FlashFirmware, NVRAM settings, the SMC's and the GPU's firmwareRewriting it (an NVRAM reset clears part of it)
PhysicalHeat, cracked solder jointsTime, cooling, reseating, reflow

Apple's service manual points at the coin cell twice. For startup problems: “a no video symptom may also be fixed by temporarily removing/replacing the backup battery.” And it has a procedure for the board's RTC reset pads: unplug, wait about two minutes, and short them with the tip of a screwdriver. On this iMac the battery is on the back of the board, so reaching it means taking everything apart. The pads, though, are on the side that faces the display, next to the LEDs: removing the display is enough. The manual's photo doesn't match every board, so here they are on mine:

The display side of the iMac 5K logic board, with three areas circled: A, the four diagnostic LEDs on the lower left edge; B, two square battery test pads just above the lower right screw of the CPU bracket; C, two small square RTC reset pads above a two-row connector footprint, near the bottom centre. Below, close-ups of B and C
The display side of the original board (iMac15,1, Late 2014). A: diagnostic LEDs. B: coin-cell test pads, negative on the left and positive on the right, which read the battery's voltage (Apple's manual says to replace it at 2.7 V or less). C: RTC reset pads. Located by matching Apple's figure; on my board B read the coin cell's 3.04 V.

Intel documents what that reset touches. Its chipsets have a signal called RTCRST# that, in Intel's words, “resets register bits in the RTC well”: the part of the chipset the coin cell powers, with the clock, the CMOS memory and some register bits. And Google built it into a laptop. On the 2015 Chromebook Pixel, from the same era as my iMac, the controller on the board pulls that signal on its own if power-up stalls for four seconds. The commit message says why:

EVT boards will have RTCRST connected to PCH that we can use to clear RTC backed state in the PCH when power sequencing fails.Duncan Laurie, ChromiumOS embedded controller, 2014

So battery-backed state that stops a computer from starting is a known failure, and what an iMac technician does by taking the machine apart, Google's firmware did automatically.

That would be a neat ending, but my own data doesn't fully support it. The old board stayed dead both without its battery and with a fresh one and the RTC pads shorted, while the new one once came back to four LEDs with its battery in place. Clearing the CMOS was neither necessary nor sufficient. The state lives in something that outlasts an SMC reset and minutes without power, and the final fix changed several things at once (hours unplugged, no battery, reseated connectors), so I can't say which one did it.

Why Linux takes macOS's path

One detail makes sleep riskier on a Mac than it looks. Apple's firmware asks the operating system whether it's macOS, through an ACPI query called _OSI("Darwin"), and behaves differently depending on the answer. Since Linux 3.18, in 2014, Linux says yes on every Mac. Matthew Garrett's patch explains why:

The most obvious difference in behaviour is that Thunderbolt hardware is forcibly powered down unless the system is running OS X.Matthew Garrett, Linux kernel mailing list, 2014

Saying yes keeps Thunderbolt working, but it also means the firmware leaves to the operating system the jobs that macOS's own drivers would do. You can see it in the code the firmware runs just before sleeping. My iMac's ACPI tables are identical, byte for byte, to a 2014 dump of the same model in DarwinDumped, where the method reads like this (the comments are mine):

Method (_PTS, 1)                          // runs just before sleep
{
    ...
    If (LNot (OSDW ()))                   // if the OS is NOT macOS
    {
        If (LGreaterEqual (Arg0, 0x03))   // and it's S3 or deeper
        {
            ...
            \_SB.PCI0.TBTC (0x05)         // prepare Thunderbolt
        }
    }
}

Linux covers part of that. Its Thunderbolt driver makes sure the controller wakes before the ports that hang from it, and on my iMac the four real ports have those links (the warning it prints about a fifth one is harmless: that port is the controller's own parent). But the Linux workaround that cuts Thunderbolt power during sleep on Macs only covers an older controller, not this one. Whether that matters here, I don't know.

The drivers involved aren't the usual ones either. Since Linux 6.19 this GPU runs on amdgpu instead of the old radeon driver (Phoronix), so its sleep path is recent. The Wi-Fi uses Broadcom's wl, a closed binary that has been stuck at the same version for years and that distributions patch for each new kernel; in the last failed attempt it threw a warning one second before the sleep. The patched driver I use now for the native 5K panel came later, so it played no part. None of this is proof, just context.

So, did Linux break it?

What I could verify:

  • S3 sleep fails on this iMac under Linux, with two boards and two kernels.
  • After a failed sleep, the board stops finding its GPU, and that survives power-offs, an SMC reset, an NVRAM reset and a night unplugged.
  • The replacement board came back after being taken apart and has worked normally since, without sleeping.

What I couldn't: where exactly the state lives, what killed the original board, and whether the RTC pads of the manual are wired to Intel's RTCRST# (the name suggests so; I don't have the schematic).

For the replacement board, the honest answer is no: nothing in it was permanently damaged. But bringing it back meant taking the iMac apart: cutting the display's adhesive and removing the speakers, the drive, the power supply and the fan before the board comes out (iFixit rates it Difficult, two hours). Most owners would call that a dead board and replace it. A board that software left stuck can cost as much as one that software broke.

So on this iMac, sleep is gone for good:

sudo systemctl mask sleep.target suspend.target hibernate.target \
    hybrid-sleep.target suspend-then-hibernate.target

It's a desktop that also works as a display for my other computers, so it doesn't need to sleep. If you run Linux on an Intel iMac from this era, I'd do the same. The Arch Wiki says a 2015 iMac only wakes up properly with s2idle instead of deep; I haven't tried it, and I won't.

What would settle it is shorting the RTC pads first, the next time a board gets stuck, before trying anything else. On this iMac there won't be a next time. If you've seen something like this on another Mac, I'd like to hear about it.