Ноутбук nx6110
Остановился на таком варианте:
apt-get install eeepc-acpi-scripts
New files installed:
aosd_cat eeepc-acpi-scripts libaosd libaosd-text
с правкой в events
# cat /etc/acpi/events/lid
event=button/lid LID [^o]
#action=/etc/acpi/actions/lid.sh
action=/etc/acpi/actions/suspend.sh
Он позволяет однократно закрыть крышку ноутбука, уведя его спать в память, и затем выйти из спячки.
Повторное закрытие крышки ни к чему не приводит, - ноут продолжает работать.
Для повторного засыпания в память ввернул костыль
/usr/bin/pkexec /usr/sbin/xfce4-pm-helper --suspend
который повесил на хоткеи:
Меню / Настройки / Клавиатура / Комбинации клавиш
Чтобы костыль отрабатывал, нужен рулез для xfce4-pm-helper
# tail -n 13 /usr/share/polkit-1/actions/org.xfce.power.policy | grep 'action\|descr\|mess\|annot'
<action id="org.xfce.power.xfce4-pm-helper">
<description>Suspend or hibernate the system</description>
<message>Authentication is required to place the system in suspend or hibernate mode</message>
<annotate key="org.freedesktop.policykit.exec.path">/usr/sbin/xfce4-pm-helper</annotate>
</action>
# grep -v '\/\/' /etc/polkit-1/rules.d/60-xfce4-pm-helper.rules
polkit.addRule(function(action, subject) {
if (action.id == "org.xfce.power.xfce4-pm-helper" && subject.isInGroup("xgrp") )
{
return polkit.Result.YES;
}
});
Всего в системе рулезов:
# ls -1 /etc/polkit-1/rules.d/
50-default.rules
60-power-off.rules
60-reboot.rules
60-suspend-hibernate.rules
60-sysvinit-nm.rules
60-xfce4-pm-helper.rules
60-xfsm-shutdown-helper.rules
99-udisk2_mount.rules
Не ставить управление питанием нельзя:
При закрытии крышки гаснет экран на vt7 и ноут продолжает работать.
Вывести его из этого состояния можно вышеописанным костылём или прямой командой из vt1-vt6 через pm-suspend, усыпив в память, а затем разбудив его.
Больше ноут при закрытии крышки гасить экран не будет, сколько не закрывай крышку.
Поэтому для принудительного засыпания применяется костыль.
Костыль лучше организовывать такой
/usr/bin/pkexec /usr/sbin/xfce4-pm-helper --suspend
т.е. через хэлпэр xfce4-pm-helper.
В этом случае понадобится рулез только для этого хэлпэра.
А теперь лирика:
Другие варианты костыля (тоже команды засыпания в память)
pkexec /usr/sbin/pm-suspend
pkexec /bin/su -c "/bin/echo -n mem >/sys/power/state"
потенциально опасны,
NAME
pkexec - Execute a command as another user
SYNOPSIS
pkexec [--version] [--disable-internal-agent] [--help]
pkexec [--user username] PROGRAM [ARGUMENTS...]
DESCRIPTION
pkexec allows an authorized user to execute PROGRAM as another user. If PROGRAM
specified, the default shell will be run. If username is not specified, then the program
will be executed as the administrative super user, root
поскольку придётся вворачивать рулез для pkexec
# grep -v '\/\/' 60-pkexec.rules
polkit.addRule(function(action, subject) {
if (action.id == "org.freedesktop.policykit.exec" && subject.isInGroup("xgrp") )
{
return polkit.Result.NO;
}
});
а такое правило разрешит непривилегированному пользователю запускать root-овые программы
$ pkexec /bin/su -c "/bin/echo -n mem >/sys/power/state"
==== AUTHENTICATING FOR org.freedesktop.policykit.exec ===
Authentication is needed to run `/bin/su' as the super user
$ pkexec /usr/sbin/pm-suspend
==== AUTHENTICATING FOR org.freedesktop.policykit.exec ===
Authentication is needed to run `/usr/sbin/pm-suspend' as the super user
Но при использовании pkexec для запуска хэлпэров, понадобится рулез только для конкретного хэлпэра (не для pkexec), который используется как параметр для pkexec
$ pkexec /usr/sbin/xfce4-pm-helper --suspend
==== AUTHENTICATING FOR org.xfce.power.xfce4-pm-helper ===
Authentication is required to place the system in suspend or hibernate mode