Ubuntu 23.04 Official Flavors Released

How To Enable Hibernate in Ubuntu 22.04 LTS

How To Enable Hibernate in Ubuntu 22.04 LTS

In this Ubuntu tutorial, we will show you how to enable the Hibernate power options in Ubuntu 22.04 LTS.

How To Enable Hibernate in Ubuntu 22.04 LTS

Let’s begin the process to enable hibernate in Ubuntu. At first, you need to make sure that the swap size of your Ubuntu and the installed memory size of your computer should be the same otherwise you won’t be able to enable hibernate feature.

Run the following command in the terminal to find the swap size of your Ubuntu with the following command:

swapon --show

You will see the swap size of your Ubuntu. If your swap size is smaller than the physical memory of your laptop or computer, then you need to increase the swap size of Ubuntu.

If swap size of Ubuntu is less, then go through the following steps.

You need to disable or turn off the current swap file so that you can increase the swap file size

sudo swapoff /swapfile

Run the following command to increase the swap file size. Here, we are going to increase the swap file size to 5 GB:

sudo dd if=/dev/zero of=/swapfile bs=1MB count=$((5*1024)) status=progress

It might take time to increase the swap file size.
After increasing the swap file size, you need to set the swap file permission to only the user readable and writable with the following command:

sudo chmod 600 /swapfile

Now, run the following command to format the swap file:

sudo mkswap /swapfile

After formatting the swap file, you need enable the newly created swap file. To do so,run the following command:

sudo swapon /swapfile

Now, run the following command to find the physical offset number of the swap file:

sudo filefrag -v /swapfile | head--lines=10

Now, run the following command to find the UUID of the root filesystem:

sudo blkid /dev/sda2

Now, it’s time to configure the GRUB bootloader so that you can have the feature of the hibernation. Open the GRUB configuration file /etc/default/grub with the “gedit” text editor as follows:

READ More Relevant Stuff:  How To Charge A laptop Without A Charger

sudo gedit >/etc/default/grub

Now, you should be careful here while providing the details. Add the text resume=UUID=<your-root-filesystem-UUID> resume_offset=<swapfile_physical_offset> at the end of the GRUB_CMDLINE_LINUX_DEFAULT Once you’re done, press <Ctrl> + S to save the file.

Now, Run the following command to update the GRUB loader.

sudo update-grub

Comments

No comments yet. Why don’t you start the discussion?

    Leave a Reply

    Your email address will not be published. Required fields are marked *