Suspend on lid close doesn't work 16.04
I've checked each and every option and possible solutions but my ASUS laptop doesn't suspend when I close the lid. All settings were set proper via the menues but nothing happens. When I perform a suspend from ubuntu menu it works perfect. Ok, I had to add a "network-manager restart" because of disabled Wifi but in the end suspend and resume in general works.
I have tested the scripts from the other posts and in addition uncommented the "HandleLidSwitch(Docked)" events to suspend but it didn't help. Tried everything below With Ubuntu 16.04 laptop doesn't suspend when lid is closed but nothing worked for me.
I was able to check with external monitor that the lid switch in general works. I checked /proc/acpi/button/lid/LID/state and found "closed" or "opened" correctly.
In log of journalctl I can see that systemd-logind is "watching system buttons for LID"
Here is the relevant text:
Okt 21 15:35:28 Dijana-ASUS systemd-logind[643]: Watching system buttons on /dev/input/event0 (Lid Switch)
A different laptop with same 16.04 LTS shows the same entry in journalctl but there suspend on lid works and the lid close event is recognized by systemd-logind.
Is this a bug or is my laptop simply too stupid? On a different partition I have tested the old 14.04.5 (with latest kernel) and I have the same misbehaviour...
Can anyone help?
Regards, Dijana
Additional information... ASUS F453S with Intel® Celeron(R) CPU N3050 @ 1.60GHz × 2
Ubuntu shows Intel® HD Graphics (Cherryview)
lspci | grep VGA shows 00:02.0 VGA compatible controller: Intel Corporation Device 22b1 (rev 21)
I fixed with using acpid with the following solution
sudo gedit /etc/acpi/events/lidclose
copy, paste & save
event=button[ /]lid
action=/etc/acpi/lidclose.sh
execute
sudo gedit /etc/acpi/lidclose.sh
copy, paste & save
#!/bin/bash
echo "close" > /home/jesse/close.txt
if grep -q closed /proc/acpi/button/lid/*/state
then
/usr/sbin/pm-suspend
fi
execute
sudo chmod ugo+x /etc/acpi/lidclose.sh
restart acpi service or reboot
So in the end I gave up and did it via workaround script. Just created a script like this and put it to root crontab for executing every 5 minutes. Not nice but it works and in the end it's only for those cases that our child closes the lid. Here is the content of the script:
#!/bin/bash
if grep -q closed /proc/acpi/button/lid/*/state
then
/usr/sbin/pm-suspend
fi