Hibernate - Oob missing?

Hi all

I was wondering if Zorin 17.3 supports hibernate (or equiv)? I tried sudo pm-hibernate, seems to shut down, took a long time to write to disk before lights out - expected behaviour. Sadly on power up, none of the hibernated state appeared. Looked like a fresh boot.

I do note that hibernation isn't an option in the power settings, just wondering if it's coming in Zorin 18?

Cheers
Lea

You may need to manually set hibernate up:

Hibernate is not enabled by default on Ubuntu (And therefor some derivatives) due to Suspend meeting most users needs, compatibility requirements of various hardware and complexity.

1 Like

Awesome link thanks.

I think Copilot gave me similar instructions but was wondering if it's Oob and I was missing something. Roll on Z18 - hopefully it'll be included for Windoze newcomers. Hibernate has significant battery saving advantages over suspend and hopefully significantly reduces boot/'apps up and running' time at boot.

Cheers, will give the article a go.

Tried both terminal and GUI mode.

Terminal mode offered nothing as the return for: sudo blkid | grep swap

The GUI mode after adding the appropriate text to the file, no hibernate mode button was presented I could find.

sudo systemctl hibernate - appears to write a large file at power down, however fails to resume from hibernate.

sudo swapon --show
NAME TYPE SIZE USED PRIO
/swapfile file 4G 256K -2

shows I have a 4GB swap file - that would align with RAM, but I can't locate the UUID of it. Ah ha, it doesn't have a UUID, it's a file not a partition.

Looks like I need to modify the file to grub like this:

FROM: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
TO: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=/swapfile"

However I'm concerned if I break grub I wont be able to boot up again. In Win10 I know how to handle a non booting device, Linux is a little new for me. Perhaps use a USB live key and access the grub file to remove the additional /swapfile ?

Thanks though :slight_smile:

Yes, you need a SWAP partition for hibernate. By default, the Zorin installer does not install a swap partition but only a swap file. You should use the user-defined installation to create more partitions.
You may still be able to create a swap partition with gparted from the live USB stick. However, this should be assessed by an expert.

Can I use the swap file which is already created? Or do I need specifically a separate swap partition? You can see I have a file (default).

free -h
total used free shared buff/cache available
Mem: 3.6Gi 2.0Gi 321Mi 456Mi 1.3Gi 987Mi
Swap: 4.0Gi 17Mi 4.0Gi

sudo swapon --show
NAME TYPE SIZE USED PRIO
/swapfile file 4G 17.3M -2

I'm familiar with partition management.
I've used Gparted, but it's when I get in trouble I may need my USB live key!

If I need a new partition I'll probably leave this for now.

Waiting for Zorin 18!

Update

Copilot mentions a swap file can be used in place of a partition:

free -h (note swap file name)
sudo gedit /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=/swapfile" (swapfile is name of file)
sudo update-grub
sudo update-initramfs -u
sudo systemctl hibernate

Then finishes with ' Some hardware configurations may not support hibernation with a swap file. If issues arise, a swap partition might be a more stable option.' :rofl:

Recipe for disaster lol

I'm not really sure. Previously with HDDs it was advised to create a SWAP partition. Nowadays with SSD / NVME this is perhaps no longer necessary and both could work. But the wake up after hibernate is often complicated in linux and makes problems.

1 Like

How to create SWAP partition after installation:

1 Like

Thanks. I need to read this thoroughly, still unsure why it's not Oob?

No mention of grub modification?

Many distributions have hibernate disabled by default. With today's fast hard disks, it does not provide many speed advantages, only leads to increased write operations on the hard disk and thus to faster wear and tear, and there are sometimes problems with everything no longer working properly after waking up.

I get that, you would typically assign cache partitions to fast disk (SSD/nvram) over spindles, but gone of the days of spindles.

I'm looking for the combination of power save over long time period (days) and convenience of all my running apps returning as is on boot, this is what Hibernate offers me over suspend. Suspend will kill my battery.

The power up boot cycle consumes near 100% for over a minute, and that's without running any apps -this leads to a frustrating start experience with significant desktop latency, that's another story.

Cheers

In Zorin lite you can use the function
"automatically save session on logout". You can enable this in the settings of "session and startup". This function should save your last session also after shutdown or reboot.

1 Like

OMG, thanks, that's useful. I guess it will launch previously running apps and hammer my CPU but that's a useful workaround whilst I experiment with Lite, different windowing and Hibernate.

Cheers

Here is a quick method to perform hibernation on Zorin OS Lite:

EDIT: I forgot to mention that you can create a keyboard shortcut, App menu entry or Panel launcher to quickly hibernate the computer. The command is pkexec pm-hibernate

You can create a custom app menu entry using the Main Menu application.
Keyboard shortcut from Settings > Keyboard > Application Shortcuts

Or panel launch with Right click Panel > Add new item > choose Launcher

1 Like