How to create hibernate button on Ubuntu.

Опубликовано: 13 Апрель 2026
на канале: IT4each com
1,638
18

How to create hibernate button on Ubuntu. You need create (edit) only one system file: com.ubuntu.enable-hibernate.pkla.

#!/bin/bash
enable the hibernate option in the main menu
установить кнопку "спящий режим" в главном меню

open and edut hiden system file
открыть и редактировать скрытый системный файл

variant 1

sudo nano /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla

variant 2

gksu gedit /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla

if don't install command (program) gksu
если не установлена команда (программа) gksu - графический
аналог команды sudo (запуск в режиме администратора)

sudo apt install gksu

for both variants you need copy the lines below and paste them into the file
и в том и другом случае надо скопировать эти строки (см. ниже) и вставить в конец файла


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

[Re-enable 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

save file and restart system
сохранить изменения и перезапустить комптер