Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hibernation support on encrypted install #1966

Open
thomas-zimmerman opened this issue Oct 21, 2021 · 4 comments
Open

Hibernation support on encrypted install #1966

thomas-zimmerman opened this issue Oct 21, 2021 · 4 comments

Comments

@thomas-zimmerman
Copy link

thomas-zimmerman commented Oct 21, 2021

Distribution (run cat /etc/os-release):
Should work on all supported releases of Pop!OS

Issue/Bug Description:
Hibernation is not currently enabled on Pop!OS given partition layout, use of a non persistent encryption key on swap, and the additional drive IO used on solid state drives. This is a requested feature where intermittent use of suspend uses a significant percentage of the overall battery. Depending on memory size of the system and size of NVMe/SSD drive, hibernation could add notable delay on resuming a hibernation session and wear out the OS drive prematurely.

Steps to convert a encrypted install to enable hibernation:

sudo cryptsetup luksOpen /dev/vda3 cryptdata
sudo lvscan
sudo vgchange -ay
  • Reduce the size of the root volume by the size of main memory:
free -h
sudo lvreduce -r -L-16G /dev/mapper/data-root
  • Create the swap volume:
sudo lvcreate -L 16G --alloc contiguous --name swap data
sudo mkswap /dev/data/swap
  • Mount the root filesystem and edit crypttab and fstab to update for the new swap location:
sudo mount /dev/mapper/data-root /mnt
sudo nano /mnt/etc/crypttab
sudo nano /mnt/etc/fstab

image
image

  • Add a resume target for the kernel:
sudo kernelstub -a "resume=UUID=xxxxxxxx-xxxx-xxxx-xxxxxxxx"

image

  • Add this Gnome-Shell extension : Hibernate Status Button
  • For Pop!OS and Ubuntu, we also require a file at /etc/polkit-1/localauthority/10-vendor.d/com.ubuntu.desktop.pkla with content of:
[Enable hibernate in upower]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes

[Enable hibernate in 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

sudo nano /etc/polkit-1/localauthority/10-vendor.d/com.ubuntu.pkla

Expected behavior:
This should allow you to have a hibernate option from the power menu.

Other Notes:
You can test if hibernation works on your system: sudo systemctl hibernate. Hibernation, if used often, will add a decent amount of additional write traffic on solid state drives.

@jacobgkau
Copy link
Member

This looks like a guide (and is well-written.) Would this be something to have a support doc for, or is it here as a feature request to have this configured out-of-the-box?

@thomas-zimmerman
Copy link
Author

Carl asked me to document this as I got this working on an lemp9. I think this would be something that we may want to build in as out-of-box use. We likely will be turning this into a support article to cover for users that want to enable this when hibernation would be a better fit for their use case.

@storyaddict
Copy link

I plan on creating a support article on this today or tomorrow. :)

@storyaddict
Copy link

Can also confirm that we've got this working on the Oryx 6, and my Oryx 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants