From c939bad5d3ba0381cdaa874794cd073b3652e380 Mon Sep 17 00:00:00 2001 From: Michel Le Cocq Date: Mon, 22 Jun 2020 10:01:56 +0200 Subject: [PATCH] --- ...on-during-ubuntu-20.04-full-ZFS-install.md | 88 ++++++++++++++++++- 1 file changed, 86 insertions(+), 2 deletions(-) diff --git a/add-right-fit-swap-for-laptop-hibernation-during-ubuntu-20.04-full-ZFS-install.md b/add-right-fit-swap-for-laptop-hibernation-during-ubuntu-20.04-full-ZFS-install.md index b31837c..3b1d46e 100644 --- a/add-right-fit-swap-for-laptop-hibernation-during-ubuntu-20.04-full-ZFS-install.md +++ b/add-right-fit-swap-for-laptop-hibernation-during-ubuntu-20.04-full-ZFS-install.md @@ -1,4 +1,3 @@ - ## create swap partition to permit Hibernate create a swap partition right sized for hibernation. @@ -28,4 +27,89 @@ SWAPVOLSIZE=$(( MEMSIZE / 1024 )) Run ubiquity to start the installer and install as normal, selecting “Use entire disk” and the option to use ZFS. -source : [Linsomniac's Articles - Encrypting ZFS on Ubuntu 20.04](https://linsomniac.gitlab.io/post/2020-04-09-ubuntu-2004-encrypted-zfs/) \ No newline at end of file +source : [Linsomniac's Articles - Encrypting ZFS on Ubuntu 20.04](https://linsomniac.gitlab.io/post/2020-04-09-ubuntu-2004-encrypted-zfs/) + +# activate hibernation in system +Disable secure boot in bios to permit Hibernate. + +souce : [](https://doc.ubuntu-fr.org/tutoriel/activer_hibernation) + +~~~ +apt install pm-utils +~~~ + +~~~ +update-initramfs -u -k $(uname -r) +pm-hibernate +~~~ + +~~~ +printf "RESUME=UUID=$(blkid | awk -F\" '/swap/ {print $2}')\n" | head -n 1| sudo tee /etc/initramfs-tools/conf.d/resume +~~~ + +you can check with : *blkid* + +~~~ +update-initramfs -u -k all +~~~ + +change /etc/default/grub : add your resume UUID into GRUB_CMDLINE_LINUX_DEFAULT + +~~~ +GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID=75034ff5-...-9e4564e16d34" +~~~ + +## enable hibernate in system + +/etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla + +~~~ +[Réactive hiberner par défaut dans upower] +Identity=unix-user:* +Action=org.freedesktop.upower.hibernate +ResultActive=yes + +[Réactive hiberner par défaut dans logind] +Identity=unix-user:* +Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.handle-hibernate-key;org.freedesktop.login1;org.freedesktop.login1.hibernate-multiple-sessions;org.freedesktop.login1.hibernate-ignore-inhibit +ResultActive=yes +~~~ + +## configure hibernate to auto switch from sleep to hibernate + +edit : */etc/systemd/sleep.conf* + +And add this value to it (The number represents seconds you want to pass in sleep, after which the computer will switch to hibernation, so you can put it in 60 seconds or something short just to check it's working and after that you can put whatever ammount of time you want): + +~~~ +[Sleep] + +HibernateDelaySec=7200 +~~~ + +[](https://doc.ubuntu-fr.org/tutoriel/activer_hibernation) + +kernel lockdown prevent hibernation : + +[](https://unix.stackexchange.com/questions/591488/why-does-the-kernel-lockdown-prevent-hibernation) +[](https://rephlex.de/blog/2019/12/27/how-to-hibernate-and-resume-from-swap-file-in-ubuntu-20-04-using-full-disk-encryption/) + +Hiberner au bout de x secondes après une mise en veille +[](https://doc.ubuntu-fr.org/veille_et_hibernation) + +## encrypt swap partition + +~~~ +apt-get install ecryptfs-utils +apt install cryptsetup-bin +swapoff -a +cryptsetup luksFormat --cipher aes-xts-plain64 --verify-passphrase --key-size 256 /dev/nvme0n1p2 +~~~ + +[](https://help.ubuntu.com/community/EnableHibernateWithEncryptedSwap#Preparation) +[](http://tlbdk.github.io/ubuntu/2018/10/22/encrypted-swap.html) +[](https://forums.linuxmint.com/viewtopic.php?t=287015) + +~~~ +GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=/dev/mapper/cryptswap1" +~~~ \ No newline at end of file