How do you enable hibernate on Ubuntu 18.04?

My system is an ASUS Z10PE-D16, ASSUS Geforce GTX 1080TI TURBO, 128 GB memory Multiple disks.

Installed Ubuntu Desktop 18.4 Found https://help.ubuntu.com/community/PowerManagement/Hibernate
I followed the first method of 3: SWSUSP:

To hibernate we use the built in function of the kernel.
To resume we use dracut.

First install dracut: sudo apt install dracut
Run dracut: dracut
dracut genertates a new initrd file with other name: initramfs... in stead of initrd...
now remove the original inird file(s): sudo rm /boot/initrd
add resume /dev/sdx to /etc/default/grub on parameter GRUB_CMD_DEFAULT:
like: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=/dev/sdxy"
sdxy is the swap-partition. (size of swap at least sizeofmemory + 1G).
now update grub: sudo update-grub
Restart system: reboot

Now test hibernate:

sudo -S bash -c 'echo shutdown > /sys/power/disk'  
sudo -S bash -c 'echo disk > /sys/power/state'

or try also:

sudo -S bash -c 'echo platform > /sys/power/disk'  
sudo -S bash -c 'echo disk > /sys/power/state' 

one or another could not work.
System will now hibernate: that take some time depending on the amount of memory used and speed of swap.
System powers down.

Test Resume:
Poweron system:
Again it will take some time.
Hopefully your session is presented.
On one of my systems I have to press ctrl+alt F9 to show session.

When hibernating with the test-scenario one will observe that there is a security issue: when system resumes the session is active again without asking for the password.
In the "settings power" set Hibernate on "When the Power Button is pressed"
Then on resume password is needed.
You can use the power icon to really power-off the system.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.