5

When I use the command sudo systemctl hibernate, the system seems to go to hibernation, but when restarted, it is a fresh start without any of the previous windows that were left open.

And when I tried sudo pm-hibernate it says sudo: pm-hibernate: command not found.

Here is my drive configuration if that helps:

/dev/sda = SSD with Windows 10 only (Windows C drive and the reserved partition).

/dev/sdb = HDD with NTFS and EXT4 partitions containing regular data only, no OS here currently.

/dev/sdc = SSD (GPT partition) with Ubuntu 18.04 (/ partition), swap area and a shared NTFS game drive.

GRUB is installed on /dev/sda.

EDIT: I created a new parition table on /dev/sdc using msdos instead of GPT. Then I reinstalled Ubuntu and installed GRUB on /dev/sdc. After these changes, sudo hibernate seems to be working.

ANOTHER EDIT: Because sudo hibernate seems to go to hibernation without locking the screen (i.e. anyone could turn on the PC and automatically be logged in), I added this line to /etc/sudoers (cln is my username):

cln ALL=NOPASSWD: /usr/sbin/hibernate

and made this executable script:

#!/bin/bash

xdg-screensaver lock
sudo hibernate

Now I am able to just double-click on this script, select Run, and directly go to hibernation while also locking the screen. Much more comfortable.

CluelessNoob
  • 2,383

2 Answers2

4

This instruction worked for my Ubuntu 18.04 installation.

  1. sudo apt install hibernate It will install hibernate and other dependencies which are needed to hibernate

  2. grep swap /etc/fstab (find UUID)

  3. sudoedit /etc/default/grub At the line GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" add UUID of swap.

    The line looks like this

    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID=<UUID of swap>"

    You can choose

    `quiet splash` will hide the boot screen output
    

    splash will display the boot screen output

  4. sudo update-grub

  5. Restart, and after restart sudo systemctl hibernate. If everything works ok add menu entry's.

  6. sudo gedit /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla now paste this:

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

  1. Restart the computer
  2. Install https://extensions.gnome.org/extension/755/hibernate-status-button/
Ayush Shukla
  • 105
  • 2
0

This thread didn't solve my problem. I had to add pci=nomsi just before resume=.

take a look at this: Ubuntu 16.04 doesn't hibernate