omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

Omarchy lid/sleep/suspend issue on MacBook (bug + solution to be tested)

Open nunix opened this issue 3 months ago • 12 comments

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 🏴‍☠️

nunix avatar Sep 20 '25 21:09 nunix

I made the changes, but when I close the lid and then try to resume (also have to press power button), the touchbar will come back but not the screen. The touch bar does respond to the fn key though. I have to hard power off and power back on. 2019 MacBookPro16,1

Thanks for working on this!

davidguttman avatar Sep 21 '25 04:09 davidguttman

i have an A2141 2019, 16 inch tried these changes and mine will not wake from sleep at all :( I guess the hardware is different enough between those model years :(

scottdavis avatar Sep 21 '25 19:09 scottdavis

Due to another potential issue with the kernel command line drop-in not being loaded (/etc/limine-entry-tool.d/t2-mac.conf),

Because you use KERNEL_CMDLINE[default]= in /etc/default/limine, it overwrites any drop-in config

You should change all KERNEL_CMDLINE[default]= entries to KERNEL_CMDLINE[default]+= in /etc/default/limine. This way, the cmdline options from drop-in configs will be added instead of replaced.

Zesko avatar Sep 22 '25 08:09 Zesko

I have a Macbook T2 13" 2020 with touchbar as well. I performed the changes you described on my system. I can report that for me it works the first time I test it but if I close the lid a second time it doesn't.

Upon opening the lid the second time and hitting the power button, I am unable to type in my password for some reason. I am presented with the prompt to enter my password but I am unable to type anything. I will dig in a bit more this weekend and see what I can figure out.

Thank you for your work on this.

RecklezzNexus avatar Oct 05 '25 01:10 RecklezzNexus

I have the "MacBook Pro 13-inch (2018, four Thunderbolt 3 ports) – Model: A1989" with the touchbar.

I followed the file changes and I can now suspend the laptop after a restart and it will wake back up. However, if I then suspend the laptop again it won't come back and will hard shut down. Additionally, closing the lid will act the same as the initial suspend except it also stops the wifi from working (then on second suspend it doesn't work at all).

Will also take a further look, but thank you for starting this off.

MountVesuvius avatar Oct 11 '25 09:10 MountVesuvius

Thank you very much! I am on 2017 MacBook (not air, not pro), which has neither a T1 nor T2 chip as far as I know. Nevertheless, same disk issues upon suspend.

Edited logins.conf, sleep.conf, and limine as described. I did not bother with the T2 related change. I did however have to run sudo limine-update for the changes to take effect.

After this, I see /sys/power/mem_sleep set to s2idle and I can close and open the lid without disk issues.

fbreuer avatar Oct 21 '25 18:10 fbreuer

I have followed pretty much everything in this thread and still stuck on s2idle deep with no wake at all usually and then sometimes the (otherwise dead) touchbar comes to life 🤷🏻‍♂️

2019 MBP

erzz avatar Nov 10 '25 18:11 erzz

Omarchy 3.17, MacBook Pro 15,3 A1990. Same problem as @erzz and my TouchBar sometimes works, sometimes does not. Running sudo tiny-dfr manually at the terminal just faults.

skeptomai avatar Nov 12 '25 15:11 skeptomai

2019 MacBook Pro 13" (MacBookPro15,2 1.0) Omarchy 3.1.7

No wake up at all. I have to kill it with a long press of the power button to perform a fresh boot. After that, the touch bar does not come up.

running tiny-dfr just leads to errors

DerFuchs avatar Nov 20 '25 21:11 DerFuchs

Hi, I just did a fresh install on a MacBook Pro 13-inch Model: A1989 and am running into the same issues. When I close the lid the Mac freezes and touchbar stops working.

fbermel avatar Nov 26 '25 10:11 fbermel

Hi All, I have the same issues with a fresh install of 3.2.0 on a MacBook Pro model A1708, this unit has no touchbar.

kstarrSCW avatar Nov 26 '25 14:11 kstarrSCW

Thank you! For my MBP 2015 A1398 (without touchbar) worked perfectly changes you described for:

  1. /etc/systemd/logind.conf
  2. /etc/systemd/sleep.conf
  3. /etc/default/limine

I don't touched the /etc/systemd/system/suspend-t2.service file.

PS. Also, I did limine-update after changing /etc/default/limine

drakmail avatar Nov 28 '25 20:11 drakmail

Same issue here. Tried the solution. Updated all the files as per instructions. No effect. My Mac is - Macbook Pro 2019 16.1 Omarchy is latest 3.2 version

Behavior is that it goes black, does not come back from sleep and if you leave it like that then eventually it will just shutdown like halt with fans doing a quick loud sound (like when in Mac you have a serious issues, probably kernel panic in Linux)

rasbml avatar Dec 03 '25 14:12 rasbml

Omarchy 3.2 Macbook Pro 2019 16

Did not fix the problem for me. I was unable to get it to change from s2idle [deep] to s2idle despite doing all changes listed which possibly contributed, but who knows.

Suspend would sit there with fans wiring either:

  • No resume at all with black screen.
  • Resume with lock screen and non-responsive trackpad/keyboard.

The suspend workaround was a net improvement even just removing and probing the bce module, the touchbar only ever worked first Omarchy boot post-install and never again. With the bce rmmod and modprobe it came back. After installing the service it is present on boot.

Now suspend sits there with fans wiring. But now keyboard and trackpad enable and I can re-enter desktop.

rmtew avatar Dec 19 '25 03:12 rmtew