How to enable hibernation option in zorin os 15.3?

Hello,
I recently installed zorin os 15.3 (lite) and want to enable the hibernation option, like it is available in windows. Any way to do that?

Terminal: sudo pm-hibernate should work according to this https://zoringroup.com/forum/5/14193/ and this https://zoringroup.com/forum/5/9478/
I looked through dconf-editor (alt+F2 and type dconf-editor in the box that appears). If you don’t have it, use sudo apt install dconf-tools to get it. In dconf, there is a hibernate button setting enabled (I guess you need hibernate button).
I haven’t tested either of these but you can try. Also, jgordon found this some time back: Computer doesn't restore after hibernate

seems like a bit risky, is it safe to continue?

I have 4 gb of ram in my laptop, so is 2 gb of swap space fine or should I increase it, if yes then how?

You should have twice that, so 8 GB.
Try this: https://linuxize.com/post/how-to-add-swap-space-on-ubuntu-18-04/

In the 6th step what should I do ? I could not understand the 6th step, it says

Edit /etc/fstab and add the new swapfile if it isn’t already there

My /etc/fstab file looks like:

> 
> # /etc/fstab: static file system information.
> #
> # Use 'blkid' to print the universally unique identifier for a
> # device; this may be used with UUID= as a more robust way to name devices
> # that works even if disks are added and removed. See fstab(5).
> #
> # <file system> <mount point>   <type>  <options>       <dump>  <pass>
> # / was on /dev/sda1 during installation
> UUID=e08da903-0bab-4431-ac2a-727cbb8dcfb7 /               ext4    errors=remount-ro 0       1
> /swapfile                                 none            swap    sw              0       0

this is without changing anything, so what change should I make here as mentioned in 6th step?

Just go to the 7th step.

Can you please try the sudo pm-hibernate as I have reinstalled zorin os 2 times and don’t want to do that again :grinning:

Doesn’t work for me - sudo: pm-hibernate: command not found
Sorry, but I don’t want to go through the enabling steps for an option that I don’t need.

Here is the output of sudo dd if = /dev/zero of= /swapfile bs=1G count=8:

> 8+0 records in
> 8+0 records out
> 8589934592 bytes (8.6 GB, 8.0 GiB) copied, 308.617 s, 27.8 MB/s

Is it normal because my pc was completely frozen when I ran that command, most likely because of high read and write to disk?

I completed the swap upgrade now the output of grep SwapTotal /proc/meminfo is

SwapTotal: 8388604 kB

so now since it is 8 gb, how to delete the old swap file and can I now run the sudo pm-hibernate command?

You should be able to run the command. There was no old swap file to delete, you just created one.

Here in the below link, the answer by Hanood guides on how to create a partition for swap as he mentiones to tweak swap according to memory (ie :8gb) and 1-2 gb for magins so totally 9/10 gb space that I have to shrink from the main root partition for the swap, where zorin is installed? and so will I have to delete my old swap file, if yes then how?

https://askubuntu.com/questions/1240123/how-to-enable-hibernate-option-in-ubuntu-20-04](https://askubuntu.com/questions/1240123/how-to-enable-hibernate-option-in-ubuntu-20-04

So no need for a swap partition like the one mentioned in the ubuntu forums?

Swap space can be as a partition or a file. Since you have a file now, you should be set. If instead you’d rather set up a swap partition, I don’t know of any other way to do it besides reinstalling Zorin.

Thanks currently I am a bit busy, will try to hibernate and report soon :grinning:

When I try to hibernate I get the error:
sudo: pm-hibernate: command not found

I checked my /var/log/pm-suspend.log and it was fully empty, any fix?

In terminal, can you enter the following:

sudo apt install hibernate

Next, find your swap UUID

grep swap /etc/fstab

Next, edit the grub file to add that information

sudo nano /etc/default/grub

Arrow key down to
GRUB_CMDLINE_LINUX_DEFAULT
Change to:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash pci-nomsi resume=(Here you put the UUID of Swap that you got earlier)

There should be no parentheses in your finished edit.

Next, hit ctrl+x to exit, hit ‘y’ to save, then hit the enter key to save as the current file.

sudo update-grub

Reboot and test.

It hibernates, but when I start the pc again it gets stuck at the zorin logo

I think it is because of the fact that I am using a swap file? because
grep swap /etc/fstab

this command outputs 0