Skip to content

Instantly share code, notes, and snippets.

@curiousercreative
Created April 18, 2021 18:06
Show Gist options
  • Save curiousercreative/ab5d5147eef3690eb42c0be2f60bbd3b to your computer and use it in GitHub Desktop.
Save curiousercreative/ab5d5147eef3690eb42c0be2f60bbd3b to your computer and use it in GitHub Desktop.
Pop!_OS 20.10 galp5 Suspend then hibernate
#!/bin/bash
### FROM BOOT DISK
# remove cryptswap entry
vi /etc/crypttab
# remove swap from fstab
vi /etc/fstab
# reboot into firmware, select one time boot and choose USB live installer
systemctl reboot --firmware
### BOOT FROM USB LIVE INSTALLER POP!_OS
# using gParted or GNOME Disks, remove your previous swap partition
# using gParted or GNOME Disks, create a new swap partition at the end of your disk that is your total RAM + 2GB
# I have 32GB of RAM, I created a 35GB swap partition
# reboot back to boot disk
systemctl reboot
### FROM BOOT DISK
# add swap partition to fstab >> '/dev/nvme0n1p4 swap swap defaults 0 0'
vi /etc/fstab
# enable swap
swapon --all --verbose
# add boot option for kernel to know where hibernation needs to be resumed from.
blkid | grep swap
kernelstub -a 'resume=UUID=f44f6cb9-8bab-4ab8-99fb-c409ad6e9668'
# enable a suspend then hibernate, defaults to two hours of suspend2ram followed by a hibernation
ln -s /usr/lib/systemd/system/systemd-suspend-then-hibernate.service /etc/systemd/system/systemd-suspend.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment