Skip to content

Instantly share code, notes, and snippets.

@npeters
Last active June 2, 2016 19:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save npeters/5492e9e71a8e6b8a7133ad98f84c1510 to your computer and use it in GitHub Desktop.
Save npeters/5492e9e71a8e6b8a7133ad98f84c1510 to your computer and use it in GitHub Desktop.
Linux Hibernate
http://ubuntuhandbook.org/index.php/2014/04/enable-hibernate-ubuntu-14-04/
http://askubuntu.com/questions/761394/why-isnt-hibernate-in-ubuntu-16-04-working-and-how-to-fix-it
http://ubuntuforums.org/showthread.php?t=1042946
```
tail -n -9 /proc/swaps | cut -d ' ' -f 1 | xargs sudo blkid
mount | grep " / " ;# Note your /dev/... on /
sudo blkid -g
sudo blkid ;## get / -> /dev/... -> partition UUID -> resume=UUID=
sudo filefrag -v /swapfile | grep "First block:" ;## get First block -> resume_offset
# for grub2:
sudo filefrag -v /swapfile ;## get first "physical" number -> resume_offset
echo "resume=UUID=cdXX--X18 resume_offset=66050" | sudo tee /etc/initramfs-tools/conf.d/resume
sudo -b gedit /boot/grub/menu.lst
# kopt=root=UUID=... ro resume=UUID=cdXX--X18 resume_offset=66050
# for grub2:
sudo -b gedit /etc/default/grub
# et dans grub manger
GRUB_CMDLINE_LINUX_DEFAULT="... resume=UUID=cdXX--X18 resume_offset=66050"
sudo update-grub -y
# Answer "use maintainer version" if it asks
sudo update-initramfs -u
```
sudo -i
cd /var/lib/polkit-1/localauthority/50-local.d/
gedit com.ubuntu.enable-hibernate.pkla
Tips: if the config file does not work for you, try another one by changing /var/lib to /etc in the code.
```
Copy and paste below lines into the file and save it.
[Re-enable hibernate by default in upower]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes
[Re-enable hibernate by default in logind]
Identity=unix-user:*
Action=org.freedesktop.login1.hibernate
ResultActive=yes
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment