1

I just installed ubuntu then I installed gnome then I instaled TLP(power manegment) now I want to hibernate the computer when lid is close. I followed this instructions:

Is it possible to make 16.04 hibernate on lid close? | Ask Ubuntu

and this instructions:

Ubuntu 16.04: Shutdown / Hibernate Your Laptop When Lid is Closed | UbuntuHandbook

and nothing work.

1 Answers1

2

I'd recommend working this issue in steps.

  1. First,to get hibernate tested and working on your laptop, please read the Ubuntu documentation regarding hibernation. Important: make sure your swap file is larger than your physical RAM, and that it's enabled.

  2. Once you know your laptop can hibernate properly, you can assign laptop actions to trigger hibernation. In your case, you'd like to hibernate on lid close. There's plenty of documentation out in the aether on this topic, but let's go to the source documentation on this: the systemd login configuration file manpage. Of particular interest is the section that describes the HandleLidSwitch option.According to the documentation, that option

    Can be one of "ignore", "poweroff", "reboot", "halt", "kexec", "suspend", "hibernate", "hybrid-sleep", and "lock".

    You want hibernate (in my own case, I use hybrid-sleep). So, now it's a matter of editing the logind.conf file to accommodate this setting (you must be root to do this).

    In /etc/systemd you'll see a file called logind.conf. Open it for edit, and scroll down to a line that looks like this:

    #HandleLidSwitch=suspend

    The prepended # means that this line is currently disabled, so you need to remove it, and then set HandleLidSwitch to the correct option

    HandleLidSwitch=hibernate

    Save the logind.conf file and reboot.

richbl
  • 2,303
  • What is the difference between hibernate and hybrid-sleep? – Enterprise Dec 21 '17 at 17:42
  • 1
    In hybrid-sleep, the first-level action is to suspend, but also persist OS state to disk (like a hibernate action). If the battery fails while suspended, the OS state is not lost (as would be the case in a pure suspend action). – richbl Dec 21 '17 at 17:56
  • I cant hibernate! its so weird cause in original ubuntu (with unity) I could do that. From the moment that I changed to gnome it stoped working. why is that? and THANKS! – tsachi blau Dec 21 '17 at 18:32
  • @tsachiblau, did you get through Step 1? If no, what specifically failed? – richbl Dec 21 '17 at 19:05
  • when i had unity the hibernate worked well when I closed the lid. today I installed gnome and now it dosen't work. I tried step number 1 and it also dosen't work. so I think that maybe hibernate dosent work well on gnome.

    anyway I have only 512MB on my swap so I don't think that I can hibernate according to what has been said above..

    – tsachi blau Dec 21 '17 at 19:07
  • @tsachiblau, yes, you absolutely have to have a swap file or partition that will be the repository for persisting your RAM snapshot. Otherwise hibernate cannot work. BTW, I'm running Ubuntu Gnome (always have), so that's not a factor. – richbl Dec 21 '17 at 19:15