Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

6.5.7-t2 does not wake from suspend #53

Open
aboulfad opened this issue Oct 18, 2023 · 86 comments
Open

6.5.7-t2 does not wake from suspend #53

aboulfad opened this issue Oct 18, 2023 · 86 comments

Comments

@aboulfad
Copy link

Issue
MacBook Pro (MBP) always freezes/crashes when using suspend in Linux-t2-ubuntu. This is evident when re-starting, the boot screen shows fsck (or equivalent) running as well as the MBP bong & login to Linux. I included dmesg log as well screenshot from boot process.

MBP Info
MacBook Pro 2018, i7
Model ID: MacBookPro15,2
Controller Firmware version: 21P365
OS: Sonoma (14.0)

T2Linux Info
kernel: 6.5.7-t2
OS: Ubuntu 23.10 (Mantic Minotaur)

dmesg.log
bootlog

@AdityaGarg8
Copy link
Member

Suspend has been broken since macOS Sonoma

@aboulfad
Copy link
Author

aboulfad commented Oct 18, 2023

Thanks, should I keep this issue open ? For other who may have trouble with this, in the meantime the behavior can be changed for lid close = ignore or lock. reference

@AdityaGarg8
Copy link
Member

Can be kept open

@rydymth
Copy link

rydymth commented Nov 13, 2023

Hi there!,
I am having a similar problem but for some reason, before apple decided to screw up the wifi and bluetooth firmware packages with the macos sonoma, i believe i have taken a backup of the previous firmware packages. You can download from here.
I am yet to figure out a way to do these things. With the latest kernel that is 6.6 something, my bluetooth stops working so i go back to previous kernel that was working very well for me before sonoma that was 6.3.6.
I will keep on trying to get my suspend working. I think ill replace my current OS with a new one with the older kernel.
Ill update if this worked for me.

@AdityaGarg8
Copy link
Member

I guess there is a regression in kernel 6.5 that broke Bluetooth for some models. Can you see if you get Bluetooth working on a 6.4.x and a 6.5 kernel @rydymth

@rydymth
Copy link

rydymth commented Nov 13, 2023

Hi!
The bluetooth works on all 6.4.* kernel. I tested on 6.4.7 and 6.4.8. It works just fine.
It however doesnt work on 6.5.*. I have tested on 6.5.2 and 6.5.8...
And it does not work on 6.6.1 either...

@AdityaGarg8
Copy link
Member

Can you share your complete journalctl -k from a 6.4 and 6.5 kernel. You can use pastebin to share

@rydymth
Copy link

rydymth commented Nov 13, 2023

HI!
Yes for sure!
Here is the journalctl for linux6.4.8 where everythin works except suspend.
And here is the journalctl for linux6.5.2 where bluetooth and suspend are not working.
There is an array index out of bounds error in both of them. Im not able to understand much but will attempt to debug more. There is a reference to this: try_to_wake_up+0x292/0x6c0 in the stack trace. Would this be the issue?
I am unable to find why bluetooth isnt working in the 6.5.2 one...

@AdityaGarg8
Copy link
Member

I've filed a bug report upstream:

https://lkml.org/lkml/2023/11/13/722

@AdityaGarg8
Copy link
Member

AdityaGarg8 commented Nov 14, 2023

Hi @rydymth

Kernel 6.6.1-2 has a patch sent by upstream maintainers to fix Bluetooth on your model. Can you give it a test when it compiles. It should compile after 2.5-3hrs after I send this message.

@rydymth
Copy link

rydymth commented Nov 14, 2023

Hi @AdityaGarg8!
Just tried the new commit. Still no luck...
It is showing this error everytime i try to load/reload the hci_bcm4377 module:
[ 386.052230] hci_bcm4377 0000:73:00.1: can't disable ASPM; OS doesn't have ASPM control
Dmesg Log Link
Journalctl Log Link

@aboulfad
Copy link
Author

Hi, I am a bit confused as to how @rydymth BT’s issue is related to the suspend issue I reported ? Thanks.

@AdityaGarg8
Copy link
Member

Hi, I am a bit confused as to how @rydymth BT’s issue is related to the suspend issue I reported ? Thanks.

Its not related to suspend, but is an issue that deserves to be fixed

@aboulfad
Copy link
Author

Ok, I guess @rydymth could have created another GH issue, hence my confusion.

@AdityaGarg8
Copy link
Member

Hi @AdityaGarg8! Just tried the new commit. Still no luck... It is showing this error everytime i try to load/reload the hci_bcm4377 module: [ 386.052230] hci_bcm4377 0000:73:00.1: can't disable ASPM; OS doesn't have ASPM control Dmesg Log Link Journalctl Log Link

Looks like the UBSAN error got fixed. Got another patch, try 6.6.1-3

@rydymth
Copy link

rydymth commented Nov 14, 2023

Yes UBSAN error is fixed. For the ASPM error i put pcie_aspm=off pcie_port_pm=off in grub's GRUB_CMDLINE_LINUX.
But bluetooth still isnt working and suspend is still the same.
Here is the dmesg and the journalctl
I zgree with you @aboulfad I should create another issue indeed but hear me out.
I believe suspend has some relation to bluetooth not working and the buggy brcmfmac_wcc module. I blieve this is because of the updated macos firmware. When i tried to suspend on the live environment without installing the firmware.tar.gz, it suspended just fine no problem. I forgot to take the dmesg from that, will take the dmesg tonight.
So then i booted into 6.4.8 and this latest one 6.6.1-3 and i use this rmmod.sh script to remove the wifi and bluetooth modules via this script so that while suspend the wifi/bluetooth dont get in the way.
Here is the code:

#!/usr/bin/env bash
if [ "${1}" = "pre" ]; then
systemctl stop NetworkManager
modprobe -r brcmfmac_wcc brcmfmac hci_bcm4377
dmesg >> /home/rudy/logs/suspendPre.txt
elif [ "${1}" = "post" ]; then
modprobe brcmfmac_wcc brcmfmac hci_bcm4377
dmesg >> /home/rudy/logs/suspendPost.txt
systemctl start NetworkManager
fi

It shuts the display and i believe it suspends tasks and processes just fine. I have the USB-C connector attached to this laptop and while the screen is off the light on the USB-C connector still lights up, thats how i know my macbook didnt shut itself down.
So thats why i piped the dmesg right before suspend and right after suspend.
The post suspend did not update.
However this is the pre suspend log.
It says it suspends and then our brcmfmac driver doesnt sleep and then it resumes but then it never shows up on screen. My laptop always gets back up if i dont do the modprobe -r brcmfmac_wcc brcmfmac hci_bcm4377 either on the terminal or on rmmod.sh.
But here it doesnt.
I dont understand whats going on here.
Bluetooth isnt being discovered at all. Using bluetoothctl show, i get this No default controller available. So maybe the bluetooth isnt related to the suspend?
So should i open a new issue for bluetooth @AdityaGarg8 ?

@AdityaGarg8
Copy link
Member

Suspend is related to apple-bce so please don't mix it with Bluetooth.

But cause your Bluetooth issue has been introduced here, let it be here

@AdityaGarg8
Copy link
Member

I would prefer a log without the ASPM parameters you added and before suspending.

@AdityaGarg8
Copy link
Member

Suspend may break Bluetooth, but rn the priority is to make it working before suspending.

@aboulfad
Copy link
Author

No worries @rydymth , I was trying to find some correlation or understanding, thanks.

@rydymth
Copy link

rydymth commented Nov 15, 2023

Suspend is related to apple-bce so please don't mix it with Bluetooth.

But cause your Bluetooth issue has been introduced here, let it be here

Got It!
Removed the ASPM parameters.
Here are the Dmesg, journalctl and preSuspend

@AdityaGarg8
Copy link
Member

AdityaGarg8 commented Nov 15, 2023

So no errors, but Bluetooth still broken?

@rydymth
Copy link

rydymth commented Nov 15, 2023

Yes...
No errors
But no luck with bluetooth...

@AdityaGarg8
Copy link
Member

Is journalctl you sent post suspend?

@AdityaGarg8
Copy link
Member

And what is presuspend

@rydymth
Copy link

rydymth commented Nov 15, 2023

Is journalctl you sent post suspend?

No, This is journalctl normally after booting up.

And what is presuspend

This one is just a scirpt i wrote above. Before going to suspend i put the dmesg into this preSuspend.txt. So everytime i do systemctl suspend the dmesg gets is written to the file. In the scrpit i also have written the postSuspend script but that doesnt work...

@AdityaGarg8
Copy link
Member

AdityaGarg8 commented Nov 15, 2023

Why your journalctl does not have the kernel parameters.

I want journalctl -k after you boot and attempt to start Bluetooth. Probably run sudo modprobe -r brcmfmac_wcc; sudo modprobe -r brcmfmac; sudo modprobe -r hci_bcm4377; sudo modprobe hci_bcm4377 then share journalctl -k

@AdityaGarg8
Copy link
Member

And please, no suspend

@AdityaGarg8
Copy link
Member

I need to talk to upstream, so would prefer keeping suspend out of this. Suspend is an issue which we need to handle, not upstream.

@rydymth
Copy link

rydymth commented Nov 15, 2023

I need to talk to upstream, so would prefer keeping suspend out of this. Suspend is an issue which we need to handle, not upstream.

Got it
Here is the journalctl -k and the dmesg after removing and loading the brcmfmac_wcc brcmfmac and hci_bcm4377 modules.

@Redecorating
Copy link
Member

apple-bce desync's so i don't think loading the other modules work in that state. This also happens for me (as far as i can remember from when i tested it) so i think its an issue with the patch being used to test.

@aboulfad
Copy link
Author

aboulfad commented Dec 16, 2023

apple-bce desync's so i don't think loading the other modules work in that state. This also happens for me (as far as i can remember from when i tested it) so i think its an issue with the patch being used to test.

I was just completing loading all other modules, but I realized that it also has no impact (no crash) and loading the modules doesn't actually activate their corresponding devices... So what's the conclusion to-date :( ?

PS: desync --> ce-vhci: Possible desync, cmd cancel timed out

@Redecorating
Copy link
Member

i think the delayed resume fails here somewhere before it hits whatever causes the crashing.

commenting out the bit registering the usb controller might help but that's just a guess and i cant test that right now. https://github.com/Redecorating/apple-bce-drv/blob/642a27091c16967da54ee344847c3fb417190cc6/vhci/vhci.c#L92
if ((status = usb_add_hcd(vhci->hcd, 0, 0)))
goto fail_hcd;
these two lines ^

@aboulfad
Copy link
Author

aboulfad commented Dec 16, 2023

No worries, I can try it, commented out those two lines, recompiled,... No dice, same behaviour as before.

@mdsheraj123
Copy link

mdsheraj123 commented Jan 1, 2024

I want to mention that I am facing this issue too on my 2018 Intel T2 MacBook Air.
I use the latest LTS Ubuntu and everything works including wifi and bluetooth but not the suspend on lid close https://mdsheraj123.github.io/2023/11/11/Installing-Ubuntu-22.04-LTS-on-a-Intel-MacBook-air-2018-with-T2-chip/html. This is a problem because I have assigned lid close to lock my screen and often forget to manually shut down. This leads to my battery draining out when I reopen my laptop making it unreliable and losing the charm of the MacBook battery life.

If this is fixed, I won't buy a dedicated Linux laptop.

@AdityaGarg8
Copy link
Member

I want to mention that I am facing this issue too on my 2018 Intel T2 MacBook Air. I use the latest LTS Ubuntu and everything works including wifi and bluetooth but not the suspend on lid close https://mdsheraj123.github.io/2023/11/11/Installing-Ubuntu-22.04-LTS-on-a-Intel-MacBook-air-2018-with-T2-chip/html. This is a problem because I have assigned lid close to lock my screen and often forget to manually shut down. This leads to my battery draining out when I reopen my laptop making it unreliable and losing the charm of the MacBook battery life.

If this is fixed, I won't buy a dedicated Linux laptop.

I don't find suspend getting fixed anytime soon. Also, the camera fix in your article is not relevant at all.

@mdsheraj123
Copy link

mdsheraj123 commented Jan 7, 2024

My MacBook webcam was not working and https://devicetests.com/fix-webcam-issues-ubuntu-macbook-air actually fixed my webcam. It worked for me.

MacBooks are popular and last a long time. Linux support on MacBooks will definitely boost Linux adoption. Although, yes, open source hardware is the best. I hope for the suspend fix for my current daily driver.

@nicovell3
Copy link

I'm currently affected by this issue in a MacBook I've recently acquired, with Sonoma installed. Is there any way to downgrade my running MacOS to get the sleep and bluetooth features working? Which was the latest working version?

@AdityaGarg8
Copy link
Member

Even if you downgrade, the sleep issue won't get fixed. People have got success with s2idle sleep, you can try that.

@aboulfad
Copy link
Author

aboulfad commented Jan 12, 2024

You can search in the discord general channel « s2idle », I think it works for some & not others & it isn’t true deep sleep so battery consumption may still be an issue. I haven’t tried it yet as I am rarely using Ubuntu on my MBP 2018.

echo freeze | sudo tee /sys/power/state

@nicovell3
Copy link

S2 will not be enough to have the MBP disconnected for many hours... Maybe a solution could be to have it configured to hibernate after a few minutes. I hope this suspend issue gets fixed.

@Simon-Martens
Copy link

Simon-Martens commented Feb 1, 2024

Does not work for me, either.

Macbook Pro 2018 15,1
Hybrid graphics with an Radeon Pro 555X
Kernel: Linux 6.6.8-t2-mantic (on Ubuntu 23.10)

This seems like a hard one, bc after trying to wake the macbook from deep sleep, it does not turn on the screen or log any messages (?? if it was bce_vhci it would at least be able to write something to the disk or am I mistaken here??); although something appears to be happening:

  1. In a suspended state I press any key to wake the macbook
  2. The touchbar turns on, but is non responsive.
  3. 5-10 seconds nothing else happens, screen is black.
  4. The fans start spinning for a second and the laptop is shut down (sometimes i have to manually shut it down pressing the power button, after waiting a bit).

S2Idle does not work for me, same behavior (maybe I need to switch to Intel graphics, haven't tried it yet).

Hibernation (suspend to disk) also doesn't work, since bce_vhci does not resume, so touchpad & keyboard won't work (but I think it might be a different issue).

I can not confirm @aboulfad s findings since if I blacklist all the modules suspend shows the exact same behavior.

EDIT: If somebody needs any help debugging this, recompiling an testing a module etc etc I've got time and motivation to do it :)

@AdityaGarg8
Copy link
Member

I've noticed s2idle works only with Intel GPU.

@aboulfad
Copy link
Author

aboulfad commented Feb 2, 2024

I've noticed s2idle works only with Intel GPU.

Sadly, not on my 2018 MBP i7 (Intel Iris Plus Graphics 655), s2idle also results in a frozen system requiring a hard reset.

@Simon-Martens
Copy link

Simon-Martens commented Feb 2, 2024

I can confirm, still not working when setting my Intel UHD Graphics 630 as the main graphics and blacklisting the amdgpu kernel module. Maybe it's macbooks with ONLY integrated GPUs, like many 13 inch models? Can somebody with a working s2idle state post system configuration / specs? Maybe also a boot log?

Maybe it would be helpful to compare boot logs of a working (old firmware?) system in general, since there are some ACPI errors in mine; and given the system doesn't boot enough to even log anything it could be some power management issue.

Also apple_bce resumes normally if the suspend is aborted just before power off (sometimes the wifi card does prevent suspending, but this is also a seperate issue I think). apple_bce shuts down, then resumes correctly in that case, when power was not fully off.

@AdityaGarg8
Copy link
Member

Contact the discord if you want to chat with people who have this working.

@aboulfad
Copy link
Author

aboulfad commented Feb 2, 2024

@Simon-Martens s2idle doesn’t work on my 2018 MBP 13” intel integrated gpu only. I’ve already checked many of the discord suggestions to no avail, good luck for your setup.

@riddlework
Copy link

Have there been any updates to this issue in the last two months? I have a 16' 2019 MBP with BRCM Wi-Fi card and AMD graphics card and have been troubleshooting this issue all weekend to no avail.

@AdityaGarg8
Copy link
Member

Have there been any updates to this issue in the last two months? I have a 16' 2019 MBP with BRCM Wi-Fi card and AMD graphics card and have been troubleshooting this issue all weekend to no avail.

Not yet

@POMATu
Copy link

POMATu commented Apr 29, 2024

dmesg.log
hi everyone, while its not suspend, i was somehow able to make it hibernate. Neither was working for me before.
I edited /etc/systemd/sleep.conf and found out that there is some "shutdown type" for hibernation

[Sleep]
AllowSuspend=no
AllowHibernation=yes
#AllowSuspendThenHibernate=yes
AllowHybridSleep=no
#SuspendMode=
#SuspendState=mem standby freeze
#HibernateMode=platform shutdown
HibernateMode=shutdown
HibernateState=disk
#HybridSleepMode=suspend platform shutdown
#HybridSleepState=disk
#HibernateDelaySec=
#SuspendEstimationSec=60min

I also blocked non-working suspend. I had resume kernel arguments preset in grub cmdline before and it actually worked. It was able to save image, then turn off properly without reset, then i booted it back and it actually restored image
Just few issues make system unusable:

  1. internal macbook keyboard not working, but external USB does work, thats how i was able to unlock lockscreen
  2. touchbar completely dead
  3. wifi ping working from macbook but i cant connect SSH to macbook for some reason, it drops connection straight after banner and i wasnt able to use ssh until i rebooted. The issue was same on ethernet cable and on wifi. I collected dmesg tho, it said it restored from hibernation, didnt see much errors

Is it worth trying to make it work further? It seems issues are related to some frozen ACPI modules. Can you kindly tell me what modules can I unload and reload or what else can i try to make system usable after restore from hibernation.

My grub cmdline:
GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on iommu=pt pcie_ports=compat resume=UUID=61787ea2-d76f-4e2d-94d7-be27c37cf26f resume_offset=35284992 init_on_alloc=0 apple_set_os"

Linux macbookpro 6.8.8-t2 #1 SMP PREEMPT_DYNAMIC Sun Apr 28 07:27:07 UTC 2024 x86_64 GNU/Linux
Debian 12

Thanks

UPD: And i cant repeat it... on top of that my touchbar not going back even across reboots, like its still some tainted boot that i cant cleanse. Thats strange: it gave me hope and now doing same thing again. Well not exact same thing: now it just wakes up instantly instead of going to hibernation.

UPD2: I am able to put it to hibernation again, i just have to type touchpad --restart first so touchpad starts working and then hibernation doesnt gets cancelled with systemctl hibernate. But still after restore of state I am unable to make keyboard and touchpad and touchbar to work. Hibernation could be nice alternative if its possible to make these modules work
BTW dropbear luks unlock works just fine keyboard stops working later (when it actually restores image from swap)

@AdityaGarg8
Copy link
Member

dmesg.log hi everyone, while its not suspend, i was somehow able to make it hibernate. Neither was working for me before. I edited /etc/systemd/sleep.conf and found out that there is some "shutdown type" for hibernation

[Sleep]
AllowSuspend=no
AllowHibernation=yes
#AllowSuspendThenHibernate=yes
AllowHybridSleep=no
#SuspendMode=
#SuspendState=mem standby freeze
#HibernateMode=platform shutdown
HibernateMode=shutdown
HibernateState=disk
#HybridSleepMode=suspend platform shutdown
#HybridSleepState=disk
#HibernateDelaySec=
#SuspendEstimationSec=60min

I also blocked non-working suspend. I had resume kernel arguments preset in grub cmdline before and it actually worked. It was able to save image, then turn off properly without reset, then i booted it back and it actually restored image Just few issues make system unusable:

  1. internal macbook keyboard not working, but external USB does work, thats how i was able to unlock lockscreen
  2. touchbar completely dead
  3. wifi ping working from macbook but i cant connect SSH to macbook for some reason, it drops connection straight after banner and i wasnt able to use ssh until i rebooted. The issue was same on ethernet cable and on wifi. I collected dmesg tho, it said it restored from hibernation, didnt see much errors

Is it worth trying to make it work further? It seems issues are related to some frozen ACPI modules. Can you kindly tell me what modules can I unload and reload or what else can i try to make system usable after restore from hibernation.

My grub cmdline: GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on iommu=pt pcie_ports=compat resume=UUID=61787ea2-d76f-4e2d-94d7-be27c37cf26f resume_offset=35284992 init_on_alloc=0 apple_set_os"

Linux macbookpro 6.8.8-t2 #1 SMP PREEMPT_DYNAMIC Sun Apr 28 07:27:07 UTC 2024 x86_64 GNU/Linux Debian 12

Thanks

UPD: And i cant repeat it... on top of that my touchbar not going back even across reboots, like its still some tainted boot that i cant cleanse. Thats strange: it gave me hope and now doing same thing again. Well not exact same thing: now it just wakes up instantly instead of going to hibernation.

UPD2: I am able to put it to hibernation again, i just have to type touchpad --restart first so touchpad starts working and then hibernation doesnt gets cancelled with systemctl hibernate. But still after restore of state I am unable to make keyboard and touchpad and touchbar to work. Hibernation could be nice alternative if its possible to make these modules work BTW dropbear luks unlock works just fine keyboard stops working later (when it actually restores image from swap)

Interesting finding, but the issue you are facing is most likely due to apple-bce. Do you have any logs from apple-bce after resuming?

@POMATu
Copy link

POMATu commented Apr 29, 2024

Interesting finding, but the issue you are facing is most likely due to apple-bce. Do you have any logs from apple-bce after resuming?

since now i am able to repeat the process i can collect any kind of logs. Where are the apple-bce logs if its not dmesg? Dmesg after restore i did already provide above.

@AdityaGarg8
Copy link
Member

AdityaGarg8 commented Apr 29, 2024

Interesting finding, but the issue you are facing is most likely due to apple-bce. Do you have any logs from apple-bce after resuming?

since now i am able to repeat the process i can collect any kind of logs. Where are the apple-bce logs if its not dmesg? Dmesg after restore i did already provide above.

Probably check journalctl

[ 232.734819] bce-vhci: Possible desync, cmd cancel timed out

This was in your dmesg, indicates its bce at fault. Nothing can be done here.

@POMATu
Copy link

POMATu commented Apr 30, 2024

i booted today with macbook connected to external keyboard and monitor and touchbar was working straight away i didnt have to restart it.
Then i hibernated and restored and collected both logs:
30apr-dmesg.log
journalctl-30apr.log
I have done nothing else on linux today and system is utterly unconfigured and vanilla so logs should be clean from garbage.
And now I uploaded logs via actual working system. If i am using external keyboard and monitor - system is 100% usable, no issues with wifi, just as i said before: touchbar, internal keyboard dont work

Apr 30 14:05:15 macbookpro kernel: bce_vhci: suspend started
Apr 30 14:05:15 macbookpro kernel: bce_vhci: suspend endpoints
Apr 30 14:05:15 macbookpro kernel: bce-vhci: Not implemented: wait for pending output requests
Apr 30 14:05:15 macbookpro kernel: bce-vhci: Not implemented: wait for pending output requests
Apr 30 14:05:15 macbookpro kernel: bce_vhci: suspend ports
Apr 30 14:05:15 macbookpro kernel: bce_vhci: suspend controller
Apr 30 14:05:15 macbookpro kernel: bce_vhci: suspend done
Apr 30 14:05:15 macbookpro kernel: bce_vhci: resume started
Apr 30 14:05:15 macbookpro kernel: bce_vhci: resume controller
Apr 30 14:05:15 macbookpro kernel: bce-vhci: Possible desync, cmd cancel timed out
Apr 30 14:05:15 macbookpro kernel: bce-vhci bce-vhci: HC died; cleaning up
Apr 30 14:05:15 macbookpro kernel: cdc_ncm 7-1:1.0 enxacde48001122: unregister 'cdc_ncm' usb-bce-vhci-1, CDC NCM (NO ZLP)
Apr 30 14:05:15 macbookpro kernel: bce_vhci_drop_endpoint 1:1
Apr 30 14:05:16 macbookpro PackageKit[1522]: search-file transaction /1026_bcdcbcea from uid 1000 finished with success after 275ms
Apr 30 14:05:20 macbookpro PackageKit[1522]: get-details transaction /1037_abceeeec from uid 1000 finished with success after 240ms
Apr 30 14:05:21 macbookpro kernel: bce-vhci: Possible desync, cmd cancel timed out

Are these the logs you wanted to see?

@POMATu
Copy link

POMATu commented May 2, 2024

i just found my macbook inside my bag hot af because i closed it and forgot to poweroff. Luckily it seems nothing bad happened this time but it proves that this issue is really painful and my lid-closing habits can actually ruin the hardware.
Some people in this thread proposed to disable action on lid closure, but it seems i have to enable some sort of powering off or it will happen again. Someone else proposed switching it off on lid closure but then you will loose not-saved data if you did it by accident.
Hence I think this "shutdown type" hibernation is good compromise in terms of both having some action that turns it off (so it doesnt overheats in bag) and saving the data, that you can at least recover with usb mouse or even android phone as HID controller.

While i am still hoping for a possibility to make hibernation work with some crutch that resets those frozen modules after RAM image restore, but for now I will live with currently posted shutdown-type hibernation method because it both does action on lid closure and saves the data currently in RAM.

One important thing to add to my previous post:
I think its mandatory to have touchbar --restart somewhere late after boot, in desktop environment startup file and maybe in /etc/rc.local too just in case it wasnt unlocked yet, because sometimes touchbar doesnt starts for me randomly and if it doesnt starts then my hibernation method cancels instead of doing shutdown and then i might get hot bag issue again. Anyways thats just a backup for the situation when i forgot to turn it off normally.

@rydymth
Copy link

rydymth commented Jun 9, 2024

I also blocked non-working suspend. I had resume kernel arguments preset in grub cmdline before and it actually worked. It was able to save image, then turn off properly without reset, then i booted it back and it actually restored image
Just few issues make system unusable:

internal macbook keyboard not working, but external USB does work, thats how i was able to unlock lockscreen

I was able to follow through this and am getting the same exact problem that you are facing @POMATu ! But my wifi and bluetooth works and i am able to ssh into my system as well.
For me the s2Idle sleep works but drains a lot of battery and for some reason my laptop gets heated at times...
I think its just like @AdityaGarg8 said its an apple_bce error.

@stereo4nick
Copy link

stereo4nick commented Jun 15, 2024

Hi guys. Recently bought used mba 2020 i5 for ubuntu and googled t2 project. This is awesome and thank you for this gem.
As ppl said in above I'm also can't reach suspend/hibernate. Here is my uname -a
Linux mba 6.9.4-1-t2-jammy #1 SMP PREEMPT_DYNAMIC Wed Jun 12 17:36:21 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
and journalctl logs for suspend/hib

hibernate.log
suspend.log

Maybe this will help when you'll have a time.

Some additional things to say.

  1. Tried 24.04 but noticed more power consumtion than 22.04. So preferring 22.04
  2. Unfortunately before figured out I updated my mba to sonoma but rolled back it to monterey for no reason. I grabbed firmware for myself from macos' 11,12,13. Right now 22.04 use 12's firmware but same behavior on 13's firmware, it seems 11's is not supported.
  3. Switched handling closed lid to lock screen, with my 900 cycles bat it won't last long ~20h from 100% to empty. Tried to hibernate but no luck. It looks like system go to sleep: display and backlit turns off but after 10-15 sec it wake up without working keyboard and touchpad. Here is my /etc/systemd/sleep.conf:
[Sleep]
AllowSuspend=no
AllowHibernation=yes
#AllowSuspendThenHibernate=yes
AllowHybridSleep=no
#SuspendMode=
#SuspendState=mem standby freeze
HibernateMode=shutdown
HibernateState=disk
#HybridSleepMode=suspend platform shutdown
#HybridSleepState=disk
#HibernateDelaySec=180min

followed this instruction for setup swapfile https://linuxhint.com/enable-hibernate-ubuntu-22-04-lts/
probably in t2 kernels has some different settings for hibernate because of it wakes up after ~15 sec?
4. OS wakes up after several seconds (more faster than hib) from suspend. Sometimes wifi works but sometimes there is empty wifi list because of broken brcm I guess which can be reloaded with modprobe -r hci_bcm4377 ...
5. Tried to disable all items in /proc/acpi/wakeup because noticed in log
Jun 15 12:36:06 mba kernel: PM: Some devices failed to suspend, or early wake event detected
but no luck

Really hope suspend/hib will addressed eventually otherwise I have to run my dev environment/docker every day 🙂 and I see no other workaround.

@AdityaGarg8
Copy link
Member

Hi guys. Recently bought used mba 2020 i5 for ubuntu and googled t2 project. This is awesome and thank you for this gem. As ppl said in above I'm also can't reach suspend/hibernate. Here is my uname -a Linux mba 6.9.4-1-t2-jammy #1 SMP PREEMPT_DYNAMIC Wed Jun 12 17:36:21 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux and journalctl logs for suspend/hib

hibernate.log suspend.log

Maybe this will help when you'll have a time.

Some additional things to say.

  1. Tried 24.04 but noticed more power consumtion than 22.04. So preferring 22.04
  2. Unfortunately before figured out I updated my mba to sonoma but rolled back it to monterey for no reason. I grabbed firmware for myself from macos' 11,12,13. Right now 22.04 use 12's firmware but same behavior on 13's firmware, it seems 11's is not supported.
  3. Switched handling closed lid to lock screen, with my 900 cycles bat it won't last long ~20h from 100% to empty. Tried to hibernate but no luck. It looks like system go to sleep: display and backlit turns off but after 10-15 sec it wake up without working keyboard and touchpad. Here is my /etc/systemd/sleep.conf:
[Sleep]
AllowSuspend=no
AllowHibernation=yes
#AllowSuspendThenHibernate=yes
AllowHybridSleep=no
#SuspendMode=
#SuspendState=mem standby freeze
HibernateMode=shutdown
HibernateState=disk
#HybridSleepMode=suspend platform shutdown
#HybridSleepState=disk
#HibernateDelaySec=180min

followed this instruction for setup swapfile https://linuxhint.com/enable-hibernate-ubuntu-22-04-lts/ probably in t2 kernels has some different settings for hibernate because of it wakes up after ~15 sec? 4. OS wakes up after several seconds (more faster than hib) from suspend. Sometimes wifi works but sometimes there is empty wifi list because of broken brcm I guess which can be reloaded with modprobe -r hci_bcm4377 ... 5. Tried to disable all items in /proc/acpi/wakeup because noticed in log Jun 15 12:36:06 mba kernel: PM: Some devices failed to suspend, or early wake event detected but no luck

Really hope suspend/hib will addressed eventually otherwise I have to run my dev environment/docker every day 🙂 and I see no other workaround.

There was not point to reverting back to Monterey. Just keep your Mac updated now. Wi-Fi firmware has no role in suspend.

For Wi-Fi issues, your Mac model has broken Bluetooth driver with interferes with Wi-Fi. Prefer using a 5Ghz Wi-Fi or just blacklist Bluetooth driver if you don't need it.

@angelobdev
Copy link

angelobdev commented Jun 16, 2024

So I made a few tests using this apple-bce-drv fork...

Following this guide I retrieved these results:

Resume failed, dmesg after reboot:

[    0.304723] PM:   Magic number: 12:311:243
[    0.304766] acpi device:86: hash matches

Following this guide I retrieved these results:

core: failed

[    0.308562] PM:   Magic number: 12:520:346
[    0.308579] tty tty63: hash matches

processors: failed

[    0.305757] PM:   Magic number: 12:967:295
[    0.305775] tty tty28: hash matches

platform: failed

[    0.316095] PM:   Magic number: 12:314:144
[    0.316136] acpi device:15: hash matches

devices: success
dmesg_devices.txt

freezer: success
dmesg_freezer.txt

Still unknown what's causing the panic.

NOTE:

freezer
- test the freezing of processes

devices
- test the freezing of processes and suspending of devices

platform
- test the freezing of processes, suspending of devices and platform
  global control methods(*)

processors
- test the freezing of processes, suspending of devices, platform
  global control methods(*) and the disabling of nonboot CPUs

core
- test the freezing of processes, suspending of devices, platform global
  control methods(*), the disabling of nonboot CPUs and suspending of
  platform/system devices

(*) the platform global control methods are only available on ACPI systems
    and are only tested if the hibernation mode is set to "platform"

From: https://www.kernel.org/doc/Documentation/power/basic-pm-debugging.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests