- Linux debian автоматический режим suspend
- Suspend on lid close
- From Suspend to Hibernate
- Автоматический режим ожидания Debian 10 (buster)
- Автоматический режим ожидания Крмпьютер скоро перейдет в ждущий режим из-за отсутствия активности
- Set Automatic Suspend Idle Time (Less Than 15 Min) in Ubuntu, Fedora, Debian
- Single command to change Auto-Suspend idle time.
- Change the Idle Time via Dconf Editor.
- Блог инженера
Linux debian автоматический режим suspend
This page explains how to have a laptop first Suspend to RAM then after a some time save state to disk and power off completely. Inhibiting a system from suspending/hibernating is explained at Suspend.
Suspend on lid close
In order to trigger suspend on closing the lid, make sure that there is a line in /etc/systemd/logind.conf that reads HandleLidSwitch=suspend, and that it is not commented out (prefixed with #).
# /etc/systemd/logind.conf [Login] HandleLidSwitch=suspend HandleLidSwitchDocked=suspend # All default lines with comments removed for clarity.
After making the change to logind.conf, run systemctl restart systemd-logind.service. After doing so closing the laptop’s lid should cause the laptop to suspend..
If you are running a simple xsession, and want to make sure your screen locks on suspend, you can install the xscreensaver and xss-lock packages, and add the lines:
xscreensaver & xss-lock -- xscreensaver-command --lock &
From Suspend to Hibernate
When the laptop suspends to ram, it uses very little power, but the current session is not persisted to disk, so if the battery runs out, the system will be forced to do a full boot on resume. There are two ways around this: the classical way is hybrid-sleep: when suspending the machine also writes current state to disk, as with hibernate — so if power runs out no data is lost, and the session can be resumed.
Unfortunately hibernate, even with an solid-state drive, takes longer than entering suspend — and this can be inconvenient at times.
We can use the real-time wake timer to allow the system to wake up from sleep and go straight back to hibernation — if the system has been suspended for a given amount of time. With systemd, we can do this via a service unit; create the file /etc/systemd/system/suspend-sedation.service consisting of the following:
# /etc/systemd/system/suspend-sedation.service [Unit] Description=Hibernate after suspend Documentation=https://bbs.archlinux.org/viewtopic.php?pid=1420279#p1420279 Documentation=https://bbs.archlinux.org/viewtopic.php?pid=1574125#p1574125 Documentation=https://wiki.archlinux.org/index.php/Power_management Documentation=http://forums.debian.net/viewtopic.php?f=5&t=129088 Documentation=https://wiki.debian.org/SystemdSuspendSedation Conflicts=hibernate.target hybrid-sleep.target Before=sleep.target StopWhenUnneeded=true [Service] Type=oneshot RemainAfterExit=yes Environment="ALARM_SEC=300" Environment="WAKEALARM=/sys/class/rtc/rtc0/wakealarm" ExecStart=/usr/sbin/rtcwake --seconds $ALARM_SEC --auto --mode no ExecStop=/bin/sh -c '\ ALARM=$(cat $WAKEALARM); \ NOW=$(date +%%s); \ if [ -z "$ALARM" ] || [ "$NOW" -ge "$ALARM" ]; then \ echo "suspend-sedation: Woke up - no alarm set. Hibernating. "; \ systemctl hibernate; \ else \ echo "suspend-sedation: Woke up before alarm - normal wakeup."; \ /usr/sbin/rtcwake --auto --mode disable; \ fi \ ' [Install] WantedBy=sleep.target
After creating this file, enable it: sudo systemctl enable suspend-sedation. Now you should be able to enter suspend-mode, either by closing the lid, or via systemctl suspend, and have the system suspend immediately, and be ready to wake up quickly for 5 minutes (300 seconds). After that time, the system should briefly wake up on its own, and immediately hibernate.
In order to see the messages logged by this unit, either use journalctl -u suspend-sedation, or look in /var/log/daemon.log for lines containing «suspend-sedation».
This solution is inspired by: https://bbs.archlinux.org/viewtopic.php?pid=1256340, but uses the rtcwake command from the util-linux package (an essential package, it should be installed on all Debian systems by default). The --auto flag adjusts for the situation where the real-time clock might *not* be set to UTC — this is commonly the case on systems that dual-boot Microsoft Windows, for example.
Автоматический режим ожидания Debian 10 (buster)
Подскажите пожалуйста, как отключить автоматический режим ожидания в Debian 10 (buster)?
Ранее только по ssh подключался но с недавних пор стал порой цепляться через NoMachine с запуском дисплея. И вот что стало происходить — стало вылезать всплывающее сообщение
Автоматический режим ожидания Крмпьютер скоро перейдет в ждущий режим из-за отсутствия активности
При этом в настройках гнома все выключено. Но время от времени если активности нет то может разорвать VPN соединение openconnect. Если в консоли будут коннекты к другим ssh серверам — тогда не разорвет, но периодически будет сообщение появляться.
$ sudo gsettings list-recursively org.gnome.settings-daemon.plugins.power
org.gnome.settings-daemon.plugins.power power-button-action ‘suspend’
org.gnome.settings-daemon.plugins.power idle-dim true
org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type ‘suspend’
org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 0
org.gnome.settings-daemon.plugins.power sleep-inactive-battery-type ‘suspend’
org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 0
org.gnome.settings-daemon.plugins.power ambient-enabled true
org.gnome.settings-daemon.plugins.power idle-brightness 30
MakPol ( 17.01.22 14:54:58 MSK )
Последнее исправление: MakPol 17.01.22 14:56:25 MSK (всего исправлений: 2)
С sudo ты смотришь не свои настройки.
Оу, и то верно, но менял я когда запросил права админа из под меня блин
$ gsettings list-recursively org.gnome.settings-daemon.plugins.power org.gnome.settings-daemon.plugins.power power-button-action 'suspend' org.gnome.settings-daemon.plugins.power idle-dim true org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type 'suspend' org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 1200 org.gnome.settings-daemon.plugins.power sleep-inactive-battery-type 'suspend' org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 1200 org.gnome.settings-daemon.plugins.power ambient-enabled true org.gnome.settings-daemon.plugins.power idle-brightness 30
Придется гуглить как поменять для себя 🙁 Если это конечно те настройки
Давно тут не был, с CODE долго правил и не понимал что не так, но почитал по ссылке — большое спасибо!
Пока сделал sleep-inactive-battery-timeout и sleep-inactive-ac-timeout в 0 , посмотрим что будет что-то в gsettings я не очень, наивно полагал, что такие настройки даже в самом кастрированном гноме доступны, ан нет…
$ gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 0 $ gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 0 $ sudo gsettings list-recursively org.gnome.settings-daemon.plugins.power org.gnome.settings-daemon.plugins.power power-button-action 'suspend' org.gnome.settings-daemon.plugins.power idle-dim true org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type 'suspend' org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 0 org.gnome.settings-daemon.plugins.power sleep-inactive-battery-type 'suspend' org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 0 org.gnome.settings-daemon.plugins.power ambient-enabled true org.gnome.settings-daemon.plugins.power idle-brightness 30
По тегу debian 10 , мало народу будет. Добавь просто debian .
neon1ks ★★ ( 19.01.22 08:54:28 MSK )
Последнее исправление: neon1ks 19.01.22 08:54:51 MSK (всего исправлений: 1)
Set Automatic Suspend Idle Time (Less Than 15 Min) in Ubuntu, Fedora, Debian
Want to set a custom idle time for your Linux to automatically go to sleep? Here’s how to do this in Ubuntu, Fedora, Debian, Manjaro and other Linux running Gnome Desktop.
The system settings (gnome-control-center) offers options to toggle on/off automatic suspend and inactive time delay. However, the minimum value is 15 minutes. What if you want to set it to either less than 15 min, or a custom value not in the list?
Single command to change Auto-Suspend idle time.
Firstly, either click top-left ‘Activities’ or press the Super (Windows) key to bring up search box. Then search and open terminal.
Secondly, choose the command to run in terminal:
- Change the automatic suspend timeout, when on AC power supply (5 minutes (300s) for instance):
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 300
The command just change the timeout value. To toggle on or off the ‘Automatic Suspend‘ function, change the value of ‘sleep-inactive-ac-type’ to suspend or nothing.
Set custom automatic suspend timeout, when on battery (2 min (120s) for instance):
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 120
You can also change the value of ‘sleep-inactive-battery’ type to enable or disable auto-suspend.
Change the Idle Time via Dconf Editor.
For those hate Linux commands, the job can be done via a graphical tool called Dconf Editor. Search for and install it from system “Software” app, then do:
Open Dconf Editor and navigate to org/gnome/settings-daemon/plugins/power. There scroll down and change the values of:
Also toggle on / off the functions by changing values of:
Finally start or re-start the “System Settings” and go to Power in left pane. You’ll see the new timeout take effects in ‘Automatic Suspend’ dialog:
NOTE: Though the custom values display in System Settings, they are not permanent! It WILL disappear once you select another time and restart it.
Блог инженера
Ранее я уже писал про экономию заряда батареи ноутбука при использовании suspend to ram (S3). Такой режим называется suspend to hibernate и заключается в автоматическом переходе из S3 (suspend to ram) в S4 (suspend to disk) если пользователь не продолжит работу в течении заданного периода времени.
Прошлое решение базировалось на pm-utils, но с переходом jessie на systemd это перестало работать (#745848). До недавнего времени я пользовался jessie + sysv init и эта проблема меня не касалась, но последнее время все чаще сталкиваюсь с systemd и решил дать ему шанс на домашней системе. Наибольшей проблемой после перехода на systemd стал отвалившийся suspend-to-hibernate.
В wiki archlinux есть вариант для systemd. Пришлось немного доработать их вариант, чтобы он начал работать в debian jessie.
[Unit] Description=Delayed hibernation trigger Documentation=https://wiki.archlinux.org/index.php/Power_management Before=suspend.target Conflicts=hibernate.target hybrid-suspend.target StopWhenUnneeded=true [Service] Type=oneshot RemainAfterExit=yes Environment="WAKEALARM=/sys/class/rtc/rtc0/wakealarm" Environment="SLEEPLENGTH=+2hours" ExecStart=-/bin/sh -c 'echo -n "alarm set for "; date +%%s -d$SLEEPLENGTH | tee $WAKEALARM' ExecStop=-/bin/sh -c '\ alarm=$(cat $WAKEALARM); \ now=$(date +%%s); \ if [ -z "$alarm" ] || [ "$now" -ge "$alarm" ]; then \ echo "hibernate triggered"; \ systemctl hibernate; \ else \ echo "normal wakeup"; \ fi; \ echo 0 > $WAKEALARM; \ ' [Install] WantedBy=sleep.target
Этот сервис нужно сохранить в файле /etc/systemd/system/suspend-to-hibernate.service и добавить в suspend.target зависимость на suspend-to-hibernate.service. В противном случае suspend.target не будет дожидаться выполнения suspend-to-hibernate.service.
sudo cp /lib/systemd/system/suspend.target /etc/systemd/system/suspend.target echo Requires=suspend-to-hibernate.service | sudo tee -a /etc/systemd/system/suspend.target sudo systemctl enable suspend-to-hibernate.service sudo systemctl daemon-reload