Fedora Linux on Apple MacBook might not be able to wake from sleep.
(Or it might eventually wake up, but it can take several minutes.)
This package apple_sleep is a workaround using isolation of CPUs, that allows the laptop to wake up from
sleep within a normal timeframe.
I have no idea why it works, but I found the trick online - and polished the implementation as far as my Linux-fu allows. And it helps my Fedora-ized MacBooks wake up from sleep.
There was some uncertainty about which cpu-num to isolate, so I made a script that isolates all but the first cpu; cpu0, and this seems to work ... speedily.
The package consists of a systemd service unit-file and a Bash script.
Put the files where you prefer, and edit the service file to point to the script.
Enable the service, and sleep.target will trigger the service to source the script when the laptop goes to sleep, and
again when it wakes up.
In my case I simply "link-enable" like so:
[root@sofa /]# systemctl enable /opt/optulation/mixed/apple_sleep/apple_sleep.service
Created symlink /etc/systemd/system/apple_sleep.service → /opt/optulation/mixed/apple_sleep/apple_sleep.service.
Created symlink /etc/systemd/system/sleep.target.wants/apple_sleep.service → /opt/optulation/mixed/apple_sleep/apple_sleep.service.The Bash script does not need to be executable.
The script logs to /tmp/apple_sleep.log.
The log shows the status of the CPUs after the script has modified the cpu-online-files.
21:24:17 START. cpu_statuses: 1:0 2:0 3:0 4:0 5:0 6:0 7:0
21:24:23 STOP. cpu_statuses: 1:1 2:1 3:1 4:1 5:1 6:1 7:1
"START" is when sleep.target is triggered -i.e. when the laptop goes to sleep.
- Original inspiration:
- Redhat on 'isolcpus':
- On Systemd 'sleep':
- systemd - How does systemctl suspend work? - Unix & Linux Stack Exchange
- [systemd] sleep.target and suspend.target. What is the difference? :archlinux
I thought "sleep" was a generic term that covers all possible sleep states, including "suspend" and " hibernate". So "suspend" is a type of sleep and "hibernate" is a different type of sleep. At least that's how the kernel uses the word. See admin-guide/pm/sleep-states.rst in the kernel docs.
Fedora 39on MacBook Pro (Retina, 15-inch, Late 2013),MacBookPro11,2Fedora 38on MacBook Pro (Retina, 13-inch, Late 2013),MacBookPro11,1