Samstag, 15. Februar 2020

Enable Hibernation on Linux Mint 19 (Ubuntu 18.04)



Prerequisites


There is two methods to have Swap: you can create separately a dedicated Swap partition with LVM or you can create a swap file on your root partition. Since i prefer the firs variant i'll you show how can create a swap partition.


As a rule of thumb, simply set up your swap file to at least the size of your RAM, or even double your RAM on systems with very low total RAM.I'll make here double of my RAM, also i have 32 GB RAM.


Create Logical Volume:
$ lvcreate -L 64G -n swap1 vg00

Alternatively you increase your swap partition if it is already there:

$ swapoff -v /dev/vg00/swap1
$ lvresize /dev/vg00/swap1 -L 64G

Format your newly created Swap partition and enable


$ mkswap /dev/vg00/swap1
Setting up swapspace version 1, size = 64 GiB (69793214464 bytes)
no label, UUID=8259ac1e-26fb-48c0-a1f9-2c3816b9c9b4

Add the following entry to /etc/fstab file (if not yet exist):
echo "/dev/mapper/vg00-swap1 swap swap defaults 0 0" >> /etc/fstab
Enable swap:
$ swapon -va
Check your swap size:
$ free -h |grep -i swap
Swap:           64G          0B         64G

Add Swap to Grub Menu


Get UUID of Swap (you can see above too):
$ blkid | grep swap
/dev/mapper/mint--vg-swap_1: UUID="8259ac1e-26fb-48c0-a1f9-2c3816b9c9b4" TYPE="swap"

Add UUID to grub config as resume with vim:
$ vim /etc/default/grub
and add resume option to grub line 'GRUB_CMDLINE_LINUX_DEFAULT'
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID=8259ac1e-26fb-48c0-a1f9-2c3816b9c9b4"

Update your boot menu with update-grub command:
$ update-grub
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/50_linuxmint.cfg'
Sourcing file `/etc/default/grub.d/60_mint-theme.cfg'
Generating grub configuration file ...
Found theme: /boot/grub/themes/linuxmint/theme.txt
Found linux image: /boot/vmlinuz-5.3.0-28-generic
Found initrd image: /boot/initrd.img-5.3.0-28-generic
Found linux image: /boot/vmlinuz-5.3.0-26-generic
Found initrd image: /boot/initrd.img-5.3.0-26-generic
Found linux image: /boot/vmlinuz-4.18.0-25-generic
Found initrd image: /boot/initrd.img-4.18.0-25-generic
Found linux image: /boot/vmlinuz-4.15.0-43-generic
Found initrd image: /boot/initrd.img-4.15.0-43-generic
Found linux image: /boot/vmlinuz-4.15.0-23-generic
Found initrd image: /boot/initrd.img-4.15.0-23-generic
Adding boot menu entry for EFI firmware configuration
done


Lastly add Hibernation to the Menu:
$ tee /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla <<'EOB'
[Enable hibernate]
Identity=unix-user:*
Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.handle-hibernate-key;org.freedesktop.login1;org.freedesktop.login1.hibernate-multiple-sessions
ResultActive=yes
EOB

... and don't forget reboot your Maschine:
$ reboot

Note: as you see i have a Kernel 5.3.x

Keine Kommentare:

Kommentar veröffentlichen