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:

  1. Closed lid with a monitor
  2. 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:

  1. I click the battery/audio/wifi icon
  2. I press Alt so that the Power icon turns into a Pause icon
  3. I hit the Pause icon
  4. I watch the Apple logo on the back of my laptop turn off, then turn on again, then turn off.
  5. 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:

  1. I click the battery/audio/wifi icon
  2. I press Alt so that the Power icon turns into a Pause icon
  3. I hit the Pause icon
  4. I close the lid
  5. 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
  6. 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.