Ok, I know there already are several questions related to this. I tried many solutions to no avail. I'm going to detail here what I did and how are my config files in the hope that a good soul will point out what I missed.
Some initial information:
- I installed Ubuntu 14 from a 14.01 .iso and it became a 14.04 because, I guess, I checked an option to update automatically during the install.
- I have an external monitor attached. This seems to be relevant in some cases.
- As explaned here, there is no option to make the PC hibernate in the power settings of Ubuntu 14. Only suspend and do nothing.
- My swap is slightly larger than my RAM
I had a Mint (14 if I'm not mistaken) where closing the lid would not hibernate until I added some scripting. In Ubuntu 14 there is no
/etc/acpi/lid.sh that I can edit as I did in Mint. I tried to create one with the following contents:
echo 'ok' > ok grep -q closed /proc/acpi/button/lid/*/state if [ $? = 0 ] then su - gabriel -c 'dconf read /org/gnome/settings-daemon/plugins/power/lid-close-ac-action' | grep hibernate if [ $? = 0 ] then pm-hibernate fi fi
ok is not created when I close the lid, this means the script is never called.
I tried to move lid.sh into
As suggested here, I tried to rename it to
lid.sh.post and to move it to
/etc/acpi/local/, and other several combinations of directory and names (with/without
I did as told here and installed
gnome-tweak-tool, so I could set the action on closed lid to hibernate. After I did, the dropdowns in the control panel / power were blank (not suspend nor 'do nothing'), but now they show 'do nothing' again, I don't know what I did to change that. And running
su - gabriel -c 'dconf read /org/gnome/settings-daemon/plugins/power/lid-close-ac-action'
still returns 'nothing', which compromises my (probably useless anyway) script.
I did as told here: edited
/etc/systemd/logind.conf and set
HandleLidSwitch to 'hibernate':
cat /etc/systemd/logind.conf | grep -i lid #HandleLidSwitch=hibernate #LidSwitchIgnoreInhibited=yes
I also tried with
root@gabriel-linux:/var/lib/polkit-1/localauthority/50-local.d# cat com.ubuntu.enable-hibernate.pkla [Re-enable hibernate by default in upower] Identity=unix-user:* Action=org.freedesktop.upower.hibernate ResultActive=yes [Re-enable hibernate by default in logind] Identity=unix-user:* Action=org.freedesktop.login1.hibernate ResultActive=yes