Ubuntu – Hibernate on lid close

hibernatelaptoppower-management

I want my laptop to hibernate when I close the lid. I can only choose between suspend and nothing, and both do nothing actually when I close the lid and open it nothing's changed.

I also tried sudo pm-hibernate and nothing happed. I tried dconf tools and tweak tool, I set it to hibernate but no change. Also tried HandleLidSwitch=hibernate still no success, and I also tried enabling hibernation in polkit.

Best Answer

How big is your swap partition/file? You need 1.5 times the amount of your system RAM to be able to hibernate. Less than this means hibernation will not work.

Eg: If you have 8GB RAM, then you will need 12GB of swap space to be able to hibernate.

Why is this? Well, hibernation physically turns your PC off, which means the contents of RAM which cannot survive a lack of power, must be dumped somewhere before switching off. When you come out of hibernate, the data is re-copied back into RAM before "resuming" the system.

Since PC's now come with gargantuan amounts of RAM as standard, hibernation is not really very practical anymore, particularly when you consider that going in and out of hibernation on a modern PC takes longer than shutting down and booting it from SSD.

With improvements in power management such as offered by Intel's Haswell chipset, you're far better off suspending rather than hibernating because it could happily sit there for a week in suspend mode while using one-tenth of bugger-all power.

Related Question