53

How can I set Hibernation in Ubuntu 18.04 LTS (laptop)?

When I open the Power option > When the Power Button is pressed, I just see the following options:

  • Suspend
  • Power OFF
  • Nothing

But does not show Hibernate.

Melebius
  • 11,431
  • 9
  • 52
  • 78
Rodolfho
  • 643

3 Answers3

25

If you are OK with suspending instead of hibernating, you can try this:

  1. Before you click "Power Button" - press "Alt"

    OR

  2. Click "Power Button" and hold it.

SuRa
  • 343
Ivan
  • 455
  • 2
    Why was this reply down voted? I "plussed" it because it is the simplest answer and it answers the question. By pressing Alt the Power button changes to a "Pause" button; click it again, the computer goes into hibernation. – Norm C. May 13 '18 at 16:39
  • 38
    This is a good trick to know, but this does not hibernate (suspend to disk) but instead puts the computer to sleep (suspends to RAM) – btalb May 27 '18 at 04:02
  • 2
    This may not answer the question as asked, but compared to the true answers (enabling hibernate in Ubuntu 18.04 is complicated!) it's a partial solution and it's simple. – robm Jun 01 '18 at 23:40
  • 2
    you should add as part of the answer that this solution does not hibernates the system, suspends it to avoid confusions. – Facundo Colombier Jan 22 '19 at 12:58
  • 10
    This answer doesn't even remotely try to answer this question. Q: "I want to hibernate but I can only suspend" / A: "Here is an alternative way to suspend". Why would anyone vote that up?? – Nye Mar 11 '19 at 14:43
  • 1
    This is suspension (in ram) and not hibernation (on hard drive). This is why I downvoted. – Manuel Fedele Jun 19 '19 at 16:24
  • this will suspend the system, not put the machine into hibernation, it two different methods for the computer to "sleep" – Yossarian42 Jul 26 '19 at 20:27
  • 1
    @SuRa I see you originally made this edit: https://askubuntu.com/review/suggested-edits/1030657 This is a massive change to the answer, you should have posted it as a separate answer. – muru Apr 19 '20 at 18:21
  • 1
    @SuRa I've approved your suggested edit to remove the material you'd added earlier with the intention of posting it as as separate answer instead (and my own review was the second approval, so this caused your edit to be applied). But this question is closed as a duplicate. I'm hoping there's a suitable place for you to post your answer--maybe on the question this is closed as a duplicate of? If you encounter problems posting your answer or finding a place to do so (or if you believe the duplicate closure here is incorrect) and you comment to let me know, then I'll try to look into it further. – Eliah Kagan Jul 16 '20 at 16:07
20
sudo systemctl hibernate

This did not work for me. I try pm-hibernate which did not work for me either until I added missing package uswsusp

sudo apt install uswsusp  
Pa Weł
  • 309
  • What did not work? The blogpost suggestion? If you meant this, then I can confirm it didn't work, though I followed the procedure. Any idea, what went wrong? – Semo Jun 14 '18 at 04:55
  • 9
    hibernate command was acting like shutdown for me, no windows restored. Then I installed uswsusp and hibernate worked for me just once. Now I see the option in action for power button press and set it too. But now again hibernate acts like shutdown. – Mr.Hunt Nov 11 '18 at 08:40
  • I had the same problem, the hibernate command was acting like shutdown. I followed this answer and now it works! – lucidbrot Mar 14 '20 at 14:15
  • I fond other solution it this thread which leads to solution – Pa Weł Mar 16 '20 at 17:56
12

Use this, it is more recent. It worked for me with a new 18.04 install on my laptop. http://ubuntuhandbook.org/index.php/2018/05/add-hibernate-option-ubuntu-18-04/

Also, check that you have a swap file before you start. You should have one by default. Run

swapon --show

to check.