Hibernation on my Ubuntu 18.04 did not work out of the box (I mean
sudo systemctl hibernate). So I made several attempts to fix that some time ago and unfortunately can not remember exactly what I did.
successfully hibernates the system and on the next boot the system state successfully restores, except for the login screen does not appear, which is not good. And if I have many applications running than after such a resume the system might be frozen for up to 20 minutes (I see applications' windows, can move mouse pointer, but the system does not respond to clicks) but after that works normally.
sudo systemctl hibernate
does something, shuts down the system, but on the next boot I see several messages delete orphaned node and finally clean boot, as if there were no hibernation.
Please help me clear it up and enable hibernation in the gui interface.
At the same time suspend to memory and resume from memory works fine without a problem, including the login screen on resume.
The primary question I have is: Which of the two mechanisms
systemctl hibernate should I use with 18.04?
The system has swap partition
$ lsblk | grep SWAP └─sda5 8:5 0 16,8G 0 part [SWAP] $ free -m total used free shared buff/cache available Mem: 15894 3386 9945 1311 2561 11848 Swap: 17163 2150 15013
/etc/default/grub it has
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=/dev/sda5" GRUB_CMDLINE_LINUX=""
$ cat /sys/power/state freeze mem disk $ cat /sys/power/disk [platform] shutdown reboot suspend test_resume
Finally I managed to bring hibernation to work. As long as I do not have deep understanding of the subject, I'd rather describe what I did. So
- Completely removed pm-utils and uswsusp, then
sudo update-initramfs -c -k alland
After this hibernation attempt ended up in clean boot instead of resume. So then
- Reinstalled systemd then changed device names to UUIDs so as
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID=2c8ec945-6967-4538-93ef-49eb4df6f2a1"
$ sudo update-initramfs -c -k all $ sudo update-grub $ reboot
sudo systemctl hibernate and resume succeeded but without login screen, so
- In Settings (gui) for power button action I assigned "Hibernate"
Now when I press power button the system hibernates and then restores through login screen.
Many thanks to everyone involved
UPD: Now I have found an even better solution - use swap file
I verified this on fresh Ubuntu 18.10 desktop install and suppose it to work with fresh 18.04 desktop install too as they both use swap file by default i.e. they do not allocate swap partition by default. But the default swap file is 2Gb regardless of the system memory size, so it should be increased.
The complete description is for example here.