How-to enable hibernate on Ubuntu

assuming I did not unintentionally broke this before … or Ubuntu 22.x there’s not a default hibernate available, the fix is easy though

works well with Ubuntu since v2.4 of nitropad firmware but will not work with Qubes

edit: /var/lib/polkit-1/localauthority/10-vendor.d/com.ubuntu.desktop.pkla

modify both

[Disable hibernate by default in upower]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=no

[Disable hibernate by default 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=no

to read

[Disable hibernate by default in upower]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes

[Disable hibernate by default 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

reboot or log-off/log-on may be required
whenever you select ‘logout’ the hibernate and hybrid sleep option are now available

when using hibernate and thawing the machine (push the power button once) this will require use of the boot security key again and also the LUKS password, this is normal, all is working as before, the uptime counter is still continuing

software to consider to have installed

apt install pm-utils laptop-mode upowerd