I accidentally clicked on the option "When power is critically low" under System Settings>Power. The original entry was blank, but the only two options after I clicked were Hibernate and Shutdown. I want to set it back to Suspend.
-
1Which version of Ubuntu are you using? – Anderson Green Jul 30 '12 at 17:01
8 Answers
To change this setting back to suspend, use dconf-editor. Go to org.gnome.settings-daemon.plugins.power and change critical-battery-action to suspend.
Alternatively, in a terminal session use the command:
gsettings set org.gnome.settings-daemon.plugins.power critical-battery-action 'suspend'
The gsettings command is resident by default while dconf-editor requires installing via:
sudo apt-get install dconf-tools
- 515
- 1
- 6
- 14
-
1Is there any bug on Launchpad for this behavior of blank being suspend? – NoBugs Dec 17 '14 at 05:36
-
1No longer works as of [GNOME 3.28.2](https://www.reddit.com/r/gnome/comments/8liuyb/where_did_the_critical_battery_action_go_in_gnome/). Does anyone have an alternative solution? – orschiro May 23 '18 at 13:54
-
gsettings list-recursively | grep percentage ; gsettings list-recursively | grep critical – Ferroao Sep 26 '22 at 18:33
I don't have sufficient rep to edit or comment, so if anyone would care to, this is a comment/edit for AtomHeartFather's answer.
You may also change the values for what percent is considered low/critical battery using dconf-tools. In the same power section, modify the following values to the desired percentages.
percentage-action
percentage-critical
percentage-low
Note: Special consideration goes to the percentage-action setting which will trigger the critical-battery-action setting.
- 253
- 3
- 9
-
to change percentages, according to [this](http://askubuntu.com/a/92818/47206) answer, the `use-time-for-policy` entry has also to be changed (un-checked, or set to 'false'): `gsettings set org.gnome.settings-daemon.plugins.power use-time-for-policy false`. But this does **not** seem to work for sure on all systems/machines. – Sep 14 '16 at 09:30
There is no option to suspend available.
You cannot suspend when power is critically low, to suspend you need power to save the session to RAM allowing you to resume quicker, if you loose power you loose the current suspend state.
Hibernate copys the current state to the hard drive, it is slower but you can turn off the power.
Shutdown is obvious - you will loose any data in the active session and have a new session on restart.
- 6,249
- 1
- 34
- 60
-
8In an ideal world, maybe. I would LOVE it if I could configure my machine to suspend when it falls below e.g. 15% of the battery (easily enough for several hours in suspend) because as it is, I can only configure it to shutdown (which kind of guarantees you lose data) or hibernate (which is completely broken on my machine). So here's to unnecessary constraints... – Tomislav Nakic-Alfirevic Jun 20 '12 at 21:02
-
2I am facing the same problem. It used to suspend when battery is critically low. But as in the question, I accidentally clicked on the option "When power is critically low" under System Settings>Power. The original entry was blank but now I can only select 'Power Off'. Hence, my computer shutdowns when battery is critically low. I would like to make it suspend in that case. Don't know how to get back to the original state where it used to suspend. – Mukesh Chapagain Aug 23 '12 at 04:40
-
1In Ubuntu 12.04, the "hibernate" option is disabled, and the computer restarts instead of suspending when the battery is critically low. – Anderson Green Oct 03 '12 at 18:04
-
1@chapagain I am facing exactly the same problem. Which version of Ubuntu are you using? – Anderson Green Oct 03 '12 at 18:18
-
1
-
@Mark Rooney Is it possible to add the "suspend" option? I tried enabling "hibernate" once, and after that, I began to encounter numerous stability issues. – Anderson Green Oct 03 '12 at 19:30
-
1as the dconf settings mentioned in other answer show, it is not true that "there is no option to suspend". But according to comments under [this](http://askubuntu.com/a/92818/47206) answer, the solution works in some system versions (14.04) or in some laptops but not in others. – Sep 14 '16 at 09:26
-
Although the answer is correct (regarding the configuration of *UPower*), it is still possible if you reconfigure *systemd* (`man systemd-sleep.conf`) to actually suspend for e.g. *UPower's* `HybridSleep` action. – doak Feb 09 '19 at 16:22
I wrote a simple bash script which will do it on any linux... just add this script to startup... every two minutes the script checks for battery status and suspend if battery lower that 11%....
#!/bin/sh
flag=0
while [ 1 ]; do
var=$(upower -i /org/freedesktop/UPower/devices/battery_BAT0| grep -E "percentage"| grep -o '[0-9]*')
if [ $var -lt 11 ] && [ $flag -eq 0 ]; then
systemctl suspend
flag=1
elif [ $var -gt 11 ] && [ $flag -eq 1 ]; then
flag=0
fi
sleep 120
done
- 41
- 4
I had this problem.
I was extremely frustrated whenever my computer would blackout, while i was doing serious work.
I wrote a script to check the A/C Power sate every two minutes and hibernate when the power goes off. Please modify according to your battery's health. My battery could pnly work for two minutes after mains power outage.
#!/bin/bash
if [[ $(cat /sys/class/power_supply/AC0/online) == *0* ]] ; then
echo 'On battery power'
#pmi action suspend
dbus-send --system --print-reply \
--dest="org.freedesktop.UPower" \
/org/freedesktop/UPower \
org.freedesktop.UPower.Suspend
#else
# echo 'On Ac Power'
fi
I put the script in a file called powerMon.sh and set that up as a cron job that runs every two minutes.
- 367
- 3
- 10
On 12.04 I used sleepd to suspend the machine when battery was low or the machine was idle.
Although sleepd is not packaged for Ubuntu 14.04, and has even been orphaned by its developer, it is possible to compile and install it yourself.
Installation on Ubuntu 12.04:
sudo apt-get install sleepd
Edit the file /etc/default/sleepd and set the following:
# -E Do not poll events (since they weren't working for me).
# -c 60 Poll every 60 seconds.
# -u 900 Sleep after 15 minutes idle time when on battery,
# -U 3600 or 60 minutes when on AC power,
# -b 3 or when battery power drops below 3%.
# -H (optional) Use upower instead of ACPI.
PARAMS="-E -c 60 -u 900 -U 3600 -b 3"
Then restart the daemon:
sudo service sleepd restart
It also has options to stay awake if there is network activity, but these stopped working for me.
On my machine, apparently ACPI was not always reporting the temperature correctly, so I needed to add -H to tell sleepd to read temperatures from upower instead of ACPI. I discovered the incorrect readings, after some unexpected syspends, by adding -v and watching the logfile with tail -f /var/log/*log | grep --line-buffered sleepd.
(I had a weird bug on one laptop with 12.04 that the machine would wake up again immediately after suspending, but only if sleepd was suspending due to low battery, not due to idle time. I hope you won't have that experience too! The problem never happened under 14.04.)
- 1,887
- 1
- 21
- 27
On latest version of Ubuntu the batter critical actions aren't available on the UI. However, you can set it up as below.
edit /etc/Upower/Upowerc.conf and set
UsePercentageForPolicy=true
PercentageLow=20
PercentageCritical=8
PercentageAction=5
CriticalPowerAction=Hibernate
Now, restart the upower systemd unit:
systemctl restart upower
- 101
- 2
There's a way to disable suspension / power off completely.
gsettings set org.gnome.settings-daemon.plugins.power critical-battery-action 'false'
(in case it's showing critically low even at 100%)
- 257
- 2
- 4