Macbook running Ubuntu 18.04 won't go to sleep
I have a Macbook pro running Ubuntu 18.04 with GNOME 3. I use my laptop in 2 setups:
- Closed lid with a monitor
- Open lid with no monitor
I've been noticing that when I pull my laptop out of my bag, it's very hot and the Apple logo is lit. Here is how I usually suspend my laptop.
Setup 1:
- I click the battery/audio/wifi icon
- I press Alt so that the Power icon turns into a Pause icon
- I hit the Pause icon
- I watch the Apple logo on the back of my laptop turn off, then turn on again, then turn off.
- I unplug and put away my laptop.
NOTE: If I do not unplug my laptop from the monitor, the monitor goes black briefly, then I see the login screen!
Setup 2:
- I click the battery/audio/wifi icon
- I press Alt so that the Power icon turns into a Pause icon
- I hit the Pause icon
- I close the lid
- I watch the Apple logo on the back of my laptop turn off, then turn on again, then turn off I put away my laptop
- List item
Why won't my Macbook pro go to sleep? I do not want to shut down every time I go out.
I was searching for a solution, and stumbled on your question, and then this answer: https://wiki.archlinux.org/index.php/Mac#Wake_Up_After_Suspend
Works for me. You'll need to use the power button to unsuspend.
The link from BrainCore's answer above gives these instructions: Occasionally the Macboook Air may wake up immediately after suspend. To fix this:
cat /proc/acpi/wakeup
Check to see that XHC1 and LID0 are enabled. If they are, disabling them will fix the problem. After disabling them, the only way to wake up your computer from suspend is by using the power button.
To disable these settings, create the following service that runs on startup:
sudo vim /etc/systemd/system/suspend-fix.service
Then add the following text and save:
[Unit]
Description=Fix for the suspend issue
[Service]
Type=oneshot
ExecStart=/bin/sh -c "echo XHC1 > /proc/acpi/wakeup && echo LID0 > /proc/acpi/wakeup"
[Install]
WantedBy=multi-user.target
And then run the following:
systemctl enable suspend-fix.service
systemctl start suspend-fix.service
Disabling only XHC1 is not recommended if you have this bug, since it may result in glitchy behavior.