0

On my Compaq Presario CQ62 laptop Ubuntu 14.04 would suspend on lid close. But a clean install of 16.04 ignored the lid action. According to with-ubuntu-16-04-laptop-doesnt-suspend-when-lid-is-closed (which I can't post on) there's a kernel bug fixed in version 4.4.8 whereas 16.04 has just shipped with 4.4.0. Everything else works so I decided to try to fix it with the existing kernel. Following instructions on laptop-does-not-suspend-when-lid-is-closed was helpful but outdated and caused wifi to fail to reconnect on resume. What's the best way to cause a lid close event to enter suspend mode?

0

To get ACPI to perform suspend create /etc/acpi/events/lidbtn and /etc/acpi/lidbtn.sh as below.

sudo sh

cat <<. >/etc/acpi/lidbtn.sh
#!/bin/sh
# Initiate suspend mode when the lid has been closed.

# Only act on a lid close event
if grep -q open /proc/acpi/button/lid/LID0/state
then
    dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 "org.freedesktop.login1.Manager.Suspend" boolean:true
fi
.

cat <<. >/etc/acpi/events/lidbtn
# Laptop lid event triggered.  Call /etc/acpi/lidbtn.sh

event=button[ /]lid
action=/etc/acpi/lidbtn.sh
.

exit

I also tried /usr/sbin/pm-suspend and sudo /lib/systemd/systemd-sleep suspend as alternatives to the dbus-send line, but these resulted in wifi not authenticating reliably after resume. I found /etc/default/acpi-support to be helpful background reading, stating that acpi-support is deprecated and dbus-pm, dbus-hal, or pm-utils are the current methods.

Other reference links: power-closelid, running-script-before-suspending-while-using-dbus, UPower

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.