I am using hibernation on thinkpads, but it takes some steps before it works:
I do not use swap files. Never worked. So a dedicated swap partition is needed for these instructions. The size of the swap partition must be at least as large as your RAM
- After installing copy the uuid entry from fstab. It is represented
as xxx below. The commands presume you are su or sudo...
- Create file
/etc/initramfs-tools/conf.d/resume
and add the line
Resume=UUID=xxxx
- Execute update-initramfs -u
- In
/etc/default/grub
set GRUB_CMDLINE_LINUX="quiet splash
resume=UUID=xxxx"
- Execute update-grub
- Change contents
of
/var/lib/polkit-1/localauthority/10-vendor.d/com.ubuntu.desktop.pkla
:
[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
Note: The "Disable hibernate" sections can be removed -or not
Reboot, then try: systemctl hibernate
If that works, you can change your settings (e.g. Lid close to hibernation).
Since Ubuntu 18 I am getting an grub error after a sucessful hibernation. This is due to a recordfail. To eliminate this problem I've done the following:
create /etc/systemd/system/use-10_grub_common.service
file
[Unit]
Description=Execute the /etc/pm/sleep.d/10_grub_common script after hibernation.
After=hibernate.target
[Service]
Type=oneshot
ExecStart=/etc/pm/sleep.d/10_grub-common thaw
[Install]
WantedBy=hibernate.target
Enable that: systemctl enable use-10_grub_common
Disclaimer: Works with Intel GPU, NOT with Nivdia (on my laptops at least)