Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions install/config/all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ run_logged $OMARCHY_INSTALL/config/hardware/framework/qmk-hid.sh

run_logged $OMARCHY_INSTALL/config/hardware/apple/fix-spi-keyboard.sh
run_logged $OMARCHY_INSTALL/config/hardware/apple/fix-suspend-nvme.sh
run_logged $OMARCHY_INSTALL/config/hardware/apple/fix-suspend-async.sh
run_logged $OMARCHY_INSTALL/config/hardware/apple/fix-t2.sh

run_logged $OMARCHY_INSTALL/config/hardware/lenovo/fix-yoga-pro7-bass-speakers.sh
Expand Down
31 changes: 31 additions & 0 deletions install/config/hardware/apple/fix-suspend-async.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Fix intermittent suspend hang on T2 MacBooks caused by async device suspend.
#
# On T2 Macs the kernel default of asynchronous (parallel) device suspend
# (/sys/power/pm_async=1) intermittently HARD-HANGS the machine the instant it
# enters suspend: black screen, dead keyboard/trackpad/Touch Bar, no wake, only
# a forced power-off recovers. pm_trace fingerprints the hang in the async
# device-suspend core (drivers/base/power/main.c), not in any single driver.
# Forcing synchronous device suspend serialises it and resolves the hang.
#
# Confirmed on MacBookPro16,2 (5/5 clean suspend cycles with the fix vs 5/5
# hangs without). Independent of suspend mode (deep or s2idle). See
# basecamp/omarchy#1840 for the broader set of affected T2 models.
if lspci -nn | grep -q "106b:180[12]"; then
echo "Detected MacBook with T2 chip. Applying synchronous device-suspend fix..."

cat <<EOF | sudo tee /etc/systemd/system/omarchy-pm-async-suspend-fix.service >/dev/null
[Unit]
Description=Omarchy synchronous device-suspend fix for T2 MacBook
ConditionPathExists=/sys/power/pm_async

[Service]
Type=oneshot
ExecStart=/bin/bash -c 'echo 0 > /sys/power/pm_async'

[Install]
WantedBy=multi-user.target
EOF

chrootable_systemctl_enable omarchy-pm-async-suspend-fix.service

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This script is also sourced by the migration, but chrootable_systemctl_enable is only defined when the installer loads install/helpers/all.sh. omarchy-migrate runs each migration in a fresh shell, so the function is unavailable on existing installations.

On a T2 Mac, this produces chrootable_systemctl_enable: command not found. The following systemctl daemon-reload can still succeed, causing the migration to exit successfully and be marked complete even though the service was never enabled or started.

Could you make this script self-contained for the migration path, or explicitly load the helper and ensure an enable failure propagates as a non-zero exit?

sudo systemctl daemon-reload
fi
3 changes: 3 additions & 0 deletions migrations/1782742549.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
echo "Fix intermittent suspend hang on T2 MacBooks (force synchronous device suspend)"

source $OMARCHY_PATH/install/config/hardware/apple/fix-suspend-async.sh