20.04 LTS Since upgrade from 19.10 laptop doesn't suspend anymore after lid close
My Lenovo P50 laptop used to suspend nicely when I closed the lid on Ubuntu 19.10. After the upgrade this doesn't work anymore. When I execute the command sudo systemctl suspend
then the laptop still goes into a very rapid full functional suspend. So something seems to go wrong somewhere in handling the lid close event from acpi.
I'm using gnome-tweak-tools and it has the toggle to suspend on lid close enabled as expected.
I also checked the configuration in /etc/systemd/logind.conf and it seems perfect:
HandleLidSwitch=suspend
HandleLidSwitchExternalPower=suspend
HandleLidSwitchDocked=suspend
LidSwitchIgnoreInhibited=yes
I haven't found anything noticable in the /var/log/syslog.
The workaround I found is the following:
Create a file called /etc/acpi/events/laptop-lid-close
with the following content:
event=button/lid LID close
action=/etc/acpi/laptop-lid-close.sh
And create a file /etc/acpi/laptop-lid-close.sh
with the following content and gave it execute rights (chmod +x /etc/acpi/laptop-lid-close.sh
):
#!/bin/sh
systemctl suspend
Would be better if this workaround would not be necessary ofcourse
Acpi seems to fire off 'lid close' events as it should, otherwise the workaround would not work. Also the suspend itself must be working on my laptop as well for the same reason.
Any clues on how to learn why this doesn't work out of the box?
I had similar with a fresh UbuntuDDE install. I found answers in various sources (this one is probably the most relevant Ubuntu 18.04 - Dell XPS13 9370 no longer suspends on lid close). The issue is the laptop not going into "deep" sleep. Run this command
cat /sys/power/mem_sleep
And if you get the result below, then this is the issue.
[s2idle] deep
To change it, edit your grub file (location: /etc/default/grub) to add this text to the GRUB_CMDLINE_LINUX_DEFAULT line
mem_sleep_default=deep
Then update grub
sudo update-grub
and reboot. After reboot, run this again
cat /sys/power/mem_sleep
and confirm now that your result is
s2idle [deep]
Then you should be good to go.