An easy tutorial on 'How to get hibernation on the Librem 14 (and librem mini?)'

After a long search, i did not find the solution in this forum and looked at other websites. Here is my compilation to get hibernation on the Librem 14 (tested on 2 devices), and probably on the Librem mini.

I can resume from hibernate in 16s with pureboot, and 10s with coreboot, with wifi autostart, so long because the resume starts with a normal boot and ends with resuming the session from swap. It is not so good as a resume on a mac or windows or deybian, but it is worth it. It really changed my UX of the Librem 14. In hibernation, I only loose, maybe, 2% in a day ! You really can forget it !

  • Create a swap partition (maybe the most “difficult’”:

    • with a live Pureos usb stick (you should have the last version or compatible to your pureos version), start with the live version.

    • go to creating a login and install gparted from terminal

    • with gparted, resize your main partition to free enough space for your swap

    • create a partition

    • format it to ‘other’>‘swap’ + parameters : starting point ‘none’, sw, swap

    • MAYBE : be careful. I you add here encryption to your swap, it can be boring afterwards : My Librem 14’s have encryption. But I do not need this at the moment, and overall i did not want to type my passphrase or have to use my librem key TWICE to resume from hibernation (as far as I know we could not even use the libremkey pin to decrypt the swap partition…), so I am now so happy using the shortest way without swap encryption.

    • reboot

  • start ‘disks’ to check your swap partition and get its UUID and its path

  • sudo swapon /dev/nvme0n1p3(replace with your own partition path) to activate the swap partition in your system

  • sudo gedit /etc/fstab : add a line : UUID=fdf4-ggfgf4dfdfxxxxxxxx none swap sw 0 (replace with your swap UUID)

  • sudo gedit /etc/default/grub : to inform grub about your swap partition, add this line or modify it :
    ‘GRUB_CMDLINE_LINUX_DEFAULT="quiet nosplash resume=UUID=fdf4-ggfgf4dfdfxxxxxxxx’ (replace with your swap UUID

    • here are some good parameters in that file, to boot fast:
      GRUB_DISTRIBUTOR=lsb_release -i -s 2> /dev/null || echo Debian
      GRUB_CMDLINE_LINUX_DEFAULT=“quiet nosplash resume=UUID=af40fa1f-e5af-4c8d-a361-f4f0a3b2aed8”
  • sudo gedit /etc/initramfs-tools/conf.d/resume : create this file and add :
    RESUME=UUID=fdf4-ggfgf4dfdfxxxxxxxx (replace with your swap UUID

  • sudo gedit /etc/UPower/UPower.conf, replace HybridSleep at the end of the file like that :

    • Here your can change other power settings.
  • sudo update-initramfs -u -k all to update your kernels

  • sudo update-grub to update your boot with grub

  • change in power settings the action of the power button to trigger hibernate (should appear after you swapon)

  • test

  • with dconf (install it if needed),

    • to get autoosleep after 5 minutes, and not only 15 in default settings, just change org.freedesktop.Tracker.Miner.Files initial-sleep = 5
    • if you want auto hibernate instead of auto sleep, just set the ‘sleep-inactive-battery-type’ to ‘hibernate’

Enjoy !