System details
Macbook T2 13" 2020 with touchbar
What's wrong?
As many other owners of Intel MacBooks, I'm facing a "sleep/suspend" issue with Omarchy.
Once installed, when I close the lid or choose suspend from the system menu, my session either freezes or it reboots without loading the touchbar drivers.
I need to perform another reboot to have a session working as intended.
Discoveries
After (quite) long debugging sessions, I found the following:
- By default, Omarchy (and Archlinux) trigger the
suspend action and not sleep
- The
suspend action has an impact on the usb devices by being unable to unbind correctly the devices
- This can be seen by running
for dev in "dev-tiny_dfr_display.device dev-tiny_dfr_backlight.device dev-tiny_dfr_display_backlight.device"; do systemctl status $dev; done after a suspend. Some devices will appear as dead status and when trying to run sudo systemctl restart tiny-dfr, it will fail stating that the device doesn't exist or is actually busy (either way, it's an improper state)
- According to the Archlinux wiki, the
suspend action has different modes and the one by default in Omarchy is set to deep.
- However, this seems to not work as intended and
s2idle should be the one selected by default (see solution to be tested below)
- The solution provided in T2Linux.org suspend workaround brings some stabilization as to be able to come out of suspend, however the touchbar doesn't work anymore and a reboot is needed
Solution to be tested
Based on the discoveries above and on the different documentation found a bit everywhere, I could reach a first step of "normal sleep behavior" with the following configuration changes:
/etc/systemd/logind.conf
[Login]
#NAutoVTs=6
#ReserveVT=6
#KillUserProcesses=no
#KillOnlyUsers=
#KillExcludeUsers=root
#InhibitDelayMaxSec=5
#UserStopDelaySec=10
#SleepOperation=suspend
HandlePowerKey=ignore
#HandlePowerKeyLongPress=ignore
#HandleRebootKey=reboot
#HandleRebootKeyLongPress=poweroff
#HandleSuspendKey=suspend
#HandleSuspendKeyLongPress=suspend
#HandleHibernateKey=hibernate
#HandleHibernateKeyLongPress=ignore
HandleLidSwitch=sleep
HandleLidSwitchExternalPower=sleep
#HandleLidSwitchDocked=ignore
#HandleSecureAttentionKey=secure-attention-key
#PowerKeyIgnoreInhibited=no
#SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no
#LidSwitchIgnoreInhibited=yes
#RebootKeyIgnoreInhibited=no
#HoldoffTimeoutSec=30s
#IdleAction=ignore
#IdleActionSec=30min
#RuntimeDirectorySize=10%
#RuntimeDirectoryInodesMax=
#RemoveIPC=yes
#InhibitorsMax=8192
#SessionsMax=8192
#StopIdleSessionSec=infinity
#DesignatedMaintenanceTime=
Description
The important settings here are:
HandleLidSwitch=sleep
HandleLidSwitchExternalPower=sleep
This will switch the suspend action to the sleep action when the lid is close, both on battery and external power.
Tip
The option HandlePowerKey=ignore allows the power button to display the Omarchy system menu directly. It can be seen as a small quality of life modification.
/etc/systemd/sleep.conf
[Sleep]
#AllowSuspend=yes
#AllowHibernation=yes
#AllowSuspendThenHibernate=yes
#AllowHybridSleep=yes
SuspendState=freeze
#HibernateMode=platform shutdown
MemorySleepMode=s2idle
#HibernateDelaySec=
#HibernateOnACPower=yes
#SuspendEstimationSec=60min
Description
This file is a first part of the solution and might need some adjustments, and even have the changes transferred as a drop-in in /etc/systemd/sleep.conf.d/ directory.
As stated before, the major change here is to set MemorySleepMode=s2idle for changing the way the power management is handled and be compatible with the MacBook hardware (at least, that's how I understand it).
The other option SuspendState=freeze is a requirement to s2idle based on the Archlinux documentation link above).
Note
While the documentation clearly states that this file is the way to change the power management, I faced another issue that the settings were not correctly applied (don't know the reason).
More concretely, even with the file modified, a sudo systemctl daemon-reload applied, once I rebooted, when running cat /sys/power/mem_sleep, I had the result s2idle [deep], meaning deep was the power management method selected and not s2idle.
To change this behavior permanently, I had to change the kernel command line directly as described below.
/etc/default/limine
TARGET_OS_NAME="Omarchy"
ESP_PATH="/boot"
KERNEL_CMDLINE[default]="cryptdevice=PARTUUID=c782d706-2a06-463d-bfdf-d41247dde676:root root=/dev/mapper/root zswap.enabled=0 rootflags=subvol=@ rw rootfstype=btrfs"
KERNEL_CMDLINE[default]+="quiet splash intel_iommu=on iommu=pt pcie_ports=compat mem_sleep_default=s2idle"
ENABLE_UKI=yes
ENABLE_LIMINE_FALLBACK=yes
# Find and add other bootloaders
FIND_BOOTLOADERS=yes
BOOT_ORDER="*, *fallback, Snapshots"
MAX_SNAPSHOT_ENTRIES=5
SNAPSHOT_FORMAT_CHOICE=5
Description
The important modification here is the line:
KERNEL_CMDLINE[default]+="quiet splash intel_iommu=on iommu=pt pcie_ports=compat mem_sleep_default=s2idle"
Due to another potential issue with the kernel command line drop-in not being loaded (/etc/limine-entry-tool.d/t2-mac.conf), I added its content directly to this file and added the option mem_sleep_default=s2idle at the end.
This allowed the power management method to be permanently changed as intended.
/etc/systemd/system/suspend-t2.service
[Unit]
Description=Disable and Re-Enable Apple BCE Module (and Wi-Fi)
Before=sleep.target
StopWhenUnneeded=yes
[Service]
User=root
Type=oneshot
RemainAfterExit=yes
#ExecStart=/usr/bin/modprobe -r brcmfmac_wcc
#ExecStart=/usr/bin/modprobe -r brcmfmac
ExecStart=/usr/bin/systemctl stop tiny-dfr
#ExecStart=/usr/bin/rmmod -f appletbdrm
#ExecStart=/usr/bin/rmmod -f hid_appletb_kbd
#ExecStart=/usr/bin/rmmod -f hid_appletb_bl
#ExecStart=/usr/bin/rmmod -f apple-bce
#ExecStop=/usr/bin/modprobe apple-bce
#ExecStop=/usr/bin/modprobe hid_appletb_bl
#ExecStop=/usr/bin/modprobe hid_appletb_kbd
#ExecStop=/usr/bin/modprobe appletbdrm
ExecStop=/usr/bin/systemctl start tiny-dfr
#ExecStop=/usr/bin/modprobe brcmfmac
#ExecStop=/usr/bin/modprobe brcmfmac_wcc
[Install]
WantedBy=sleep.target
Description
The last file modified is a modified service file from the T2Linux.org suspend file (link above), which I only kept the stop and start of the tiny-dfr service.
For testing purpose, I kept commented all the kernel modules used by the apple components (keyboard/touchbar/wifi).
They should not be needed normally, as the sleep method doesn't seem to unbind the devices like suspend does.
Call to help
As said initially, this could be the begin of a solution but it's not perfect and I only have 1 MacBook, so I'm not sure if other models will behave the same and if this solution is actually applicable to them.
So in order to help the Omarchy amazing maintainers, please try to apply the changes to the files above, reboot, and see how your system behaves when picking Suspend from the Omarchy system menu and when closing the lid.
Please note that it might take few seconds before seeing something appearing on the screen when trying to wake-up and in my case, I have to always click the power button to resume from sleep.
Hope this helps finding a solution and I didn't perform any battery drain testing, so hopefully the sleep method will not have a huge impact.
Last but not least, you can find me in the Omarchy Discord (same alias, Nunix) if you have any questions or feedback.
The sleep rabbit hole Corsair 🏴☠️
System details
Macbook T2 13" 2020 with touchbar
What's wrong?
As many other owners of Intel MacBooks, I'm facing a "sleep/suspend" issue with Omarchy.
Once installed, when I close the lid or choose suspend from the system menu, my session either freezes or it reboots without loading the touchbar drivers.
I need to perform another reboot to have a session working as intended.
Discoveries
After (quite) long debugging sessions, I found the following:
suspendaction and notsleepsuspendaction has an impact on theusb devicesby being unable to unbind correctly the devicesfor dev in "dev-tiny_dfr_display.device dev-tiny_dfr_backlight.device dev-tiny_dfr_display_backlight.device"; do systemctl status $dev; doneafter a suspend. Some devices will appear asdeadstatus and when trying to runsudo systemctl restart tiny-dfr, it will fail stating that the device doesn't exist or is actually busy (either way, it's an improper state)suspendaction has different modes and the one by default in Omarchy is set todeep.s2idleshould be the one selected by default (see solution to be tested below)Solution to be tested
Based on the discoveries above and on the different documentation found a bit everywhere, I could reach a first step of "normal sleep behavior" with the following configuration changes:
/etc/systemd/logind.conf
Description
The important settings here are:
This will switch the
suspendaction to thesleepaction when the lid is close, both on battery and external power.Tip
The option
HandlePowerKey=ignoreallows the power button to display the Omarchy system menu directly. It can be seen as a small quality of life modification./etc/systemd/sleep.conf
Description
This file is a first part of the solution and might need some adjustments, and even have the changes transferred as a drop-in in
/etc/systemd/sleep.conf.d/directory.As stated before, the major change here is to set
MemorySleepMode=s2idlefor changing the way the power management is handled and be compatible with the MacBook hardware (at least, that's how I understand it).The other option
SuspendState=freezeis a requirement tos2idlebased on the Archlinux documentation link above).Note
While the documentation clearly states that this file is the way to change the power management, I faced another issue that the settings were not correctly applied (don't know the reason).
More concretely, even with the file modified, a
sudo systemctl daemon-reloadapplied, once I rebooted, when runningcat /sys/power/mem_sleep, I had the results2idle [deep], meaningdeepwas the power management method selected and nots2idle.To change this behavior permanently, I had to change the kernel command line directly as described below.
/etc/default/limine
Description
The important modification here is the line:
KERNEL_CMDLINE[default]+="quiet splash intel_iommu=on iommu=pt pcie_ports=compat mem_sleep_default=s2idle"Due to another potential issue with the kernel command line drop-in not being loaded (
/etc/limine-entry-tool.d/t2-mac.conf), I added its content directly to this file and added the optionmem_sleep_default=s2idleat the end.This allowed the power management method to be permanently changed as intended.
/etc/systemd/system/suspend-t2.service
Description
The last file modified is a modified service file from the T2Linux.org suspend file (link above), which I only kept the stop and start of the
tiny-dfrservice.For testing purpose, I kept commented all the kernel modules used by the apple components (keyboard/touchbar/wifi).
They should not be needed normally, as the sleep method doesn't seem to unbind the devices like suspend does.
Call to help
As said initially, this could be the begin of a solution but it's not perfect and I only have 1 MacBook, so I'm not sure if other models will behave the same and if this solution is actually applicable to them.
So in order to help the Omarchy amazing maintainers, please try to apply the changes to the files above, reboot, and see how your system behaves when picking
Suspendfrom the Omarchy system menu and when closing the lid.Please note that it might take few seconds before seeing something appearing on the screen when trying to wake-up and in my case, I have to always click the power button to resume from sleep.
Hope this helps finding a solution and I didn't perform any battery drain testing, so hopefully the
sleepmethod will not have a huge impact.Last but not least, you can find me in the Omarchy Discord (same alias, Nunix) if you have any questions or feedback.
The sleep rabbit hole Corsair 🏴☠️