6

I'm using Ubuntu 16.04 and am having trouble hibernating. I have a 16 GB swap file (size of my ram) that is enabled and working, but what sudo pm-hibernate does is turn my screen off for a moment then back on, freeze the whole thing for another moment or two and then put me on a new line in terminal like nothing ever happened. Hibernating from the menu in Unity shuts off the screen for like 5 seconds and then puts me at the log-in screen. My session is still active though. Any help would be appreciated as I pretty much can't live without hibernation. This feature worked flawlessly under Windows 10.

PC is a HP Pavilion 17-F211NG with a Core i7 5500U and 16 GB of RAM.

Max
  • 81

2 Answers2

4

Since you're running Ubuntu 16.04, you should consider running the native systemd suspend/hibernate services in lieu of the pm-utils tools.

In my own case, here's what I've done to configure my machine for hibernate/resume using systemd:

  1. In etc/default/grub, configure GRUB_CMDLINE_LINUX_DEFAULT to include the resume parameter, passing the UUID of the swap partition in question (i.e., resume=UUID=453f0121-505d-42d3-8dad-87f913e67ddc). My current GRUB_CMDLINE_LINUX_DEFAULT is

    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash pci=nomsi resume=UUID=453f0121-505d-42d3-8dad-87f913e67ddc"

  2. Run sudo update-grub

  3. Edit/confirm resume=UUID=453f0121-505d-42d3-8dad-87f913e67ddc entry in resume file located in /etc/initramfs
  4. Run sudo update-initramfs -u
  5. Edit /etc/systemd/logind.conf to set HandleLidSwitch=hibernate (optional: permits hibernate to start on lid close)
  6. Run sudo service systemd-logind restart
  7. Reboot for good measure

I've bold-faced the two parameters that--for my machine--are important: pci=nomsi and resume=UUID=[your swap partition]. While the latter parameter is pretty well understood and is often refenced when talking about enabling hibernate on a Debian system, it took a bit of discovery to find the need for the former.

Best of luck!

richbl
  • 2,373
0

In case it helps, here is the procedure I followed on Ubuntu 14.04. I have not tried it on 16.04 yet but it worked like a charm on my hardware with 14.04:

  1. Save your work and use the command line to test if hibernate works on your computer: open the Terminal by pressing Ctrl+Alt+T or by searching for terminal in the Dash. Type sudo pm-hibernate into the terminal and press Enter. Enter your password when prompted, and press Enter again. After your computer turns off, switch it back on. Are the applications that were running before hibernate still running? If hibernate doesn't work, check if your swap partition is at least as large as your available RAM.

  2. If the hibernate test works, you can continue to use the sudo pm-hibernate command when you want to hibernate.

You can also enable the hibernate option in the user menus. To do that, use your favorite text editor to create /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla. Add the following to the file and save:

    [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;org.freedesktop.login1.hibernate-multiple-sessions
    ResultActive=yes

(Source: https://help.ubuntu.com/14.04/ubuntu-help/power-hibernate.html)

TheOdd
  • 3,012
boba
  • 183