Skip to content

A script that does a bunch of things to make suspend/sleep work on T2 Macs running T2Linux

Notifications You must be signed in to change notification settings

deqrocks/T2Linux-Suspend-Fix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 

Repository files navigation

T2Linux MacBook Suspend Fix

This script configures your system to properly suspend and resume by managing the Broadcom WiFi driver and Apple BCE keyboard backlight driver. It creates systemd services to handle driver unloading before suspend and reloading after resume in correct sequence. Keyboard backlight not working on boot is also taken care of.

For now the script is final

We can't continue developing this script. It showed that people with the same hardware and same distro have varying results. It leads to the conclusion that we are either dealing with different hardware or firmware revisions. This is impossible to handle. Please try the script. If it's working - yay! If not, use the uninstaller and call it a day until T2Linux devs come up with a better solution.

Important Notes / Known Issues

  • The system needs more time to resume than you're used to from MacOS. The script takes between 1.5 to 3 seconds to run through. The longest waiting times is userland re-initializing.
  • Some systems don't work with the script. It's unclear if this is related to the specific hardware, firmware or distro.
  • There is an uninstall option when running the script. If the script doesn't work for you, just reboot and run it again. It will restore your previous settings and files.
  • Note that using powertop --auto-tune or any related script enabling/forcing ASPM will block "optimized" PCI devices from transitioning to D3 power state. Or in other words: If you want to enjoy working suspend, remove such scripts.
  • The script uses deep sleep. Hibernate and hybrid sleep will also work, but require further manual steps like creating a swap partition.

Installation

  1. Download the script:
wget https://raw.githubusercontent.com/deqrocks/T2Linux-Suspend-Fix/refs/heads/main/t2-suspend-fix.sh
  1. Make it executable:
chmod +x t2-suspend-fix.sh
  1. Run it:
./t2-suspend-fix.sh
  1. Choose install or uninstall

  2. Check the prompts and Reboot

Changes on your system

The script performs the following actions:

  1. Configures the system to use deep sleep mode
  2. Creates systemd services
  3. Backups, disables or removes conflicting services (thermald/override.conf)
  4. Sets ASPM to off if needed
  5. Installs libnotify (if notify-send is missing) to show desktop notifications for failed resume steps

Systemd Services

/etc/systemd/system/suspend-wifi-unload.service
Runs before suspend to aggressively unload WiFi and BCE drivers:

  • Deactivates WiFi interface via NetworkManager
  • Unloads brcmfmac_wcc and brcmfmac modules
  • Removes the apple-bce module

/etc/systemd/system/resume-wifi-reload.service
Runs after resume to restore WiFi and BCE:

  • Loads apple-bce module
  • Waits up to 15s for apple-bce to appear; if it doesn't, resume-wifi-reload aborts and logs a message (desktop notification when notify-send is available)
  • Loads brcmfmac module
  • Reactivates WiFi interface
  • After 5 seconds, checks if brcmfmac is bound; if not, reloads brcmfmac

/etc/systemd/system/fix-kbd-backlight.service
Runs on boot and after resume to restore keyboard backlight:

  • Checks if keyboard backlight path exists
  • Reloads apple-bce driver if needed
  • Sets keyboard backlight brightness

Helper Script

/usr/local/bin/fix-kbd-backlight.sh
Shell script called by the keyboard backlight service to handle driver reload logic.

System Changes

The script also modifies the following system settings:

  • Sets mem_sleep_default=deep kernel parameter via grubby
  • Disables thermald service if present
  • Sets pcie_aspm=off
  • Backups and removes systemd-suspend override.conf if present

Uninstallation

To remove the suspend fix run the script again and choose the uninstall option.

Debugging

Download debug-suspend.sh

Make script executable:

chmod +x debug-suspend.sh

Execute BEFORE suspend:

./debug-suspend.sh

Then suspend and execute again AFTER suspend:

./debug-suspend.sh

The script will show you the output location of the log files like this:

=== Debug information collected ===
Log saved to: /tmp/t2-suspend-debug-20260202-230441.log

Please post both log files when reporting issues.

Contributing

Yes please!

License

Use at your own risk.

About

A script that does a bunch of things to make suspend/sleep work on T2 Macs running T2Linux

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages