[FIX]Zorin 18 on MacBook Air 2012: 15-45 s black screen after resume

Hi all,

I run Zorin OS 18 on a MacBook Air 5,2 (mid 2012, i5-3427U Ivy Bridge). Since installation, waking from suspend (lid open) left the screen black for roughly 15-45 seconds. For about three weeks it was suddenly fine, and after the latest update the problem came back. Seems Kernel 7.0.0-31 had a solution, with -38 it's back to the black screen time.

Cause: the delay seems to sit entirely in the kernel. On resume, bringing CPU1 back online ("smpboot: Booting Node 0 Processor 1" -> "CPU1 is up") takes 10-45 seconds. GNOME and the graphics stack are not involved.

Results by kernel (all stock Ubuntu HWE kernels):

  • 7.0.0-28 and 7.0.0-30: slow (7-45 s)
  • 7.0.0-31: fast (about 0.5 s, 19 resumes)
  • 7.0.0-38 (current): slow again (11-39 s)
  • 7.0.0-38 + workaround below: 0.9 s

Workaround: a systemd sleep hook that takes CPUs 1-3 offline before suspend and brings them back after resume. That way the kernel skips the slow CPU bring-up during early resume; onlining them afterwards takes about 0.05 s. Save as /usr/lib/systemd/system-sleep/cpu-sleep-workaround and make it executable (sudo chmod 755):

#!/bin/sh
case "$1" in
  pre)
    for f in /sys/devices/system/cpu/cpu[1-9]*/online; do
      [ -w "$f" ] && echo 0 > "$f"
    done
    logger -t cpu-sleep-workaround "pre/$2: secondary CPUs offline"
    ;;
  post)
    for f in /sys/devices/system/cpu/cpu[1-9]*/online; do
      [ -w "$f" ] && echo 1 > "$f"
    done
    logger -t cpu-sleep-workaround "post/$2: secondary CPUs online"
    ;;
esac
exit 0

To undo: delete the file. So far I've only tested it for a short time on my machine, so treat it as "works for me". I'll update this thread after a few more days.

I've also filed a bug against the Ubuntu kernel:

To check whether your Mac is affected, run after a resume:
journalctl -k -b | grep -E "Booting Node 0 Processor 1|CPU1 is up"
and compare the timestamps of the two lines. More than a fraction of a second means you're hitting the same issue.

Is anyone else with an older Intel MacBook (2012-2015) seeing this?

Thanks!
Alex

3 Likes