Hibernation not working on Linux Mint 19
Linux Mint 19 does not support hibernation out of the box as per a Guide article in the Mint Forums.
The standard hibernation configuration will fail if your swap file is not in /swapfile or if you do not have a swap partition. A RedHat article provides some additional guidance on swap sizing.
If there is not enough room in the swap file or partition for the contents of your RAM plus whatever else you may have swapped out already, hibernation will fail, since the kernel writes a hibernation image of a size up to 2/5 the size of your RAM. As a rule of thumb, simply set up your swap file to at least the size of your RAM, or even double your RAM on systems with very low total RAM (since you are more likely to swap).
Please run this in a terminal window: free -h
then swapon
to confirm the swap file is large enough. If it is not large enough, expand the swap file. If it is, please proceed with:
RESUME_PARAMS="resume=UUID=$(findmnt / -o UUID -n) resume_offset=$(sudo filefrag -v /swapfile|awk 'NR==4{gsub(/\./,"");print $4;}') "
if grep resume /etc/default/grub>/dev/null; then echo -e "\nERROR: Hibernation already configured. Remove the existing configuration from /etc/default/grub and add these parameters instead:\n$RESUME_PARAMS";else sudo sed -i "s/GRUB_CMDLINE_LINUX_DEFAULT=\"/GRUB_CMDLINE_LINUX_DEFAULT=\"$RESUME_PARAMS/" /etc/default/grub;fi
Unless there is an error message, then do sudo update-grub
; if there are error messages, follow their instructions before performing sudo update-grub
.
Lastly, add Hibernation to the GRUB2 menu with
sudo tee /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla <<'EOB'
[Enable hibernate]
Identity=unix-user:*
Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.handle-hibernate-key;org.freedesktop.login1;org.freedesktop.login1.hibernate-multiple-sessions
ResultActive=yes
EOB