I'm a new Ubuntu 13.10 user. Closing the lid of my laptop does not result in the computer entering suspend mode, meaning each time I close my lid without manually suspending the computer the battery dies.
The proper settings are set in Power Management — suspend the laptop on lid close for both AC and DC, but these do not have an effect on actual behavior.
It looks like this is a common problem for many users as far back as Ubuntu 11 — the only solution I could find is the below. However, as a new linux user I'm not aware of how to actually execute the instructions. If someone could provide additional detail that would be tremendously helpful.
Thanks in advance.
/etc/acpi/events/lidbtn triggers /etc/acpi/lid.sh which triggers
/etc/acpi/local/lid.sh.post at the end of the script.
/etc/acpi/local/* allows you to add your own config (e.g. required for
wmii).
generate /etc/acpi/local/lid.sh.post
make it executable and add:
\#!/bin/bash
grep -q closed /proc/acpi/button/lid/*/state
if [ $? = 0 ]
then
/usr/sbin/pm-suspend
fi
wmii will now go to suspend mode when closing the lid. It'll
automatically wake up when opening the lid.
#!/bin/bash
load=$(cat /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0/capacity)
min_load=20
if [ $load <= min_load ]; then
pm-suspend
fi
Best Answer
(Note that
#
before a command indicates that it should be run by the superuser, so replace the#
withsudo
.)Open
logind.conf
as root:# vim /etc/systemd/logind.conf
and remove the#
beforeHandleLidSwitch=suspend
. You can also change the optionsuspend
tohibernate
orpoweroff
Fix from Launchpad Bug #863834, comment #30:
# mkdir /etc/acpi/local
# vim /etc/acpi/local/lid.sh.post
Copy this short script:
... and paste it into vim by typing: "+p
# chmod 755 /etc/acpi/local/lid.sh.post
(so it works even when power management is handled under the logged-in user instead of root)