Recently, I started using Sway-wm over minimal install. With sway-idle, the machine turns off the monitor after a specified idle time (but my CPU fans keep buzzing … the machine is on). I’d like to see the machine go into deep sleep (hibernate).
Just to be sure hibernation works, I tried: systemctl hibernate
output: Failed to hibernate system via logind: Not enough swap space for hibernation
Interesting. I looked at the partition scheme on the box to better understand the situation. I have two hard-drives, each with a SWAP partition (2GB and 12GB) respectively. At least the latter should suffice, but Fedora is using /dev/zram0 as the swap instead. Since zram is actual RAM, I don’t expect hibernation to work. I need hibernation.
Hibernation on /dev/zram0 is indeed fundamentally impossible. Best is to add the 12Gb partition as swap space in /etc/fstab, preferably by UUID, and add the kernel parameter resume=UUID=swapfileuid in GRUB_CMDLINE_LINUX in /etc/sysconfig/grub.
swapfileuid is the UUID of the 12G swap partition as shown in /sbin/blkid.
grub2-mkconfig should add this option to grub.cfg or kernel config files.
Please have a rescue disk at hand because errors might bring you in a hang of rescue mode.
Just creating the swap partition, specifying that in fstab and setting the resume in grub is enough to have hibernation? I seem to remember that a few other steps are required.
Yes, agree. First of all, hibernation is not possible if secure boot is enabled. And the resume module should be included in the initramfs, so it should be added to the dracut.conf.d and the initramfs rebuild. “systemctl hibernate” should work, may be some other config has to be done to let it show up in the desktop environment.
The Reddit thread is quite interesting. In any case, people need hibernation at some point. I can only think of one alternative and that is to script/automate the starting of certain routine apps in such that your screens load back to those applications after booting. That could be an unpleasant overhead compared to a simple “systemctl hibernate”. Some people still use old PCs.
That said, I was able to get hibernation working with the above article. I will use that while reviewing the security implications gradually.