• 0 Posts
  • 2 Comments
Joined 5 months ago
cake
Cake day: January 14th, 2025

help-circle

  • You have to use two swaps if you already use one swap, because one will be used when the system is on, but the second will be used to set the RAM content + the 1st content into SWAP (if any), otherwise, it would fail.

    Then, find the hibernation swap uuid:

    sudo swapon --show
    lsblk -o name,uuid
    

    Then

    # /etc/default/grub
    GRUB_CMDLINE_LINUX_DEFAULT="resume=UUID=xxxx"
    
    #/etc/initramfs-tools/conf.d/resume
    resume=UUID=xxxx
    
    # bash
    sudo update-grub
    sudo update-initramfs -k all -u
    
    # to hibernate on lid switch
    # /etc/systemd/logind.conf
    HandleLidSwitch=hibernate
    

    Then reboot :)

    Note: this method works wonderfully, I use it personally. Just be aware that the hibernation swap content is not encrypted, so you’re vulnerable if your laptop is stolen while hibernated.