Skip to content

Instantly share code, notes, and snippets.

@amrutprabhu
Last active May 1, 2022 19:36
Show Gist options
  • Save amrutprabhu/ee1268ddf2763988355ab497eb96f7a1 to your computer and use it in GitHub Desktop.
Save amrutprabhu/ee1268ddf2763988355ab497eb96f7a1 to your computer and use it in GitHub Desktop.
Hibernate ubuntu 20.04
First of all, you should increase the size of the /swapfile at least to the size of your RAM.
link: https://linuxhint.com/change_swap_size_ubuntu/
Install dependencies:
`sudo apt install pm-utils hibernate uswsusp`
Find your UUID of swap file:
`findmnt -no UUID -T /swapfile`
get offset
`sudo filefrag -v /swapfile |grep " 0:"| awk '{print $4}'`
Edit /etc/default/grub and replace the string
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
with your UUID and offset:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID=371b1a95-d91b-49f8-aa4a-da51cbf780b2 resume_offset=23888916"
Update GRUB:
`sudo update-grub`
Test your hibernation:
`sudo systemctl hibernate`
helpful link :https://ubuntuhandbook.org/index.php/2021/08/enable-hibernate-ubuntu-21-10/
After doing this if it still does not work. you can hibernate using `pm-hibernate`
follow this guide: https://help.ubuntu.com/community/PowerManagement/Hibernate#uswsusp
- install the package from here: https://packages.ubuntu.com/focal/amd64/uswsusp/download
- install pm-utils using `apt install pm-utils`
- check with s2disk if the hibernate works.
- Then configure pm-hibernate to use s2disk to hibernate.
edit /etc/pm/config.d/00sleep_module and change the value of SLEEP_MODULE:
```
SLEEP_MODULE="uswsusp"
```
https://askubuntu.com/a/1405996/1591767
https://blog.ivansmirnov.name/how-to-set-up-hibernate-on-ubuntu-20-04/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment