Ask Your Question

Laptop hibernate on critical battery

asked 2016-02-20 04:52:09 -0500

ztank1013 gravatar image

updated 2016-05-31 02:53:12 -0500

Hi, what's the best way to make my laptop hibernate instead of powering it off when battery is critically low in Fedora 23? I used gsettings previously (f20) but now it seem not to be an available option to set, look:

[claudio@f23x8664 ~]$ gsettings list-keys org.gnome.settings-daemon.plugins.power

Maybe it could be possible editing /etc/UPower/UPower.conf. At the end of the file I read:

# The action to take when "TimeAction" or "PercentageAction" above has been
# reached for the batteries (UPS or laptop batteries) supplying the computer
# Possible values are:
# PowerOff
# Hibernate
# HybridSleep
# If HybridSleep isn't available, Hibernate will be used
# If Hibernate isn't available, PowerOff will be used

But it does not honor neither HybridSleep nor Hibernate.

Any idea how to test it?

Thanks, Claudio

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-03-12 04:27:24 -0500

deajan gravatar image

updated 2016-03-13 14:23:16 -0500


First of all, your swap partition should be at least the size of your memory so your system can be suspended to disk. Then, you need to add a resume=/dev/mapper/swap or resume=UUID=xxxxxx-xxxxx-xxxxxx-xxxxxxxxx boot command line so your system knows where to load data from. The UUID can be obtained with: blkid | grep swap

The command line needs to be added in /etc/default/grub like GRUB_CMDLINE_LINUX="resume=UUID=xxxxxxx-xxxx-xxx-xxxx-xxxxxxxxxxx"

You also need to regenerate your grub.cfg file with grub2-mkconfig > /etc/grub-efi.cfg (replace grub-efi with grub if you don't use UEFI boot)

After this, reboot and try the hibernation with: systemctl hibernate

Last, edit /etc/UPower/UPower.conf

UsePercentageForPolicy=true PercentageLow=15 PercentageCritical=8 PercentageAction=5

(adjust values to your needs)

and reload upower: systemctl reload upower

Oh, if systemctl hibernate works but echo disk > /sys/power/state fails, you can try bypassing platform specific code by using echo shutdown > /sys/power/disk This can be rendered permanent by creating a /etc/systemd/sleep.conf file containing: HibernateMode=shutdown HibernateState=disk

Regards, Ozy.

edit flag offensive delete link more


Where should i add this resume=/dev/mapper/swap and how i can regenerate my grub.cfg file ?

ibrahim132 gravatar imageibrahim132 ( 2016-04-10 08:59:31 -0500 )edit

Instructions for regenerating grub.cfg are here :

acyclik gravatar imageacyclik ( 2017-05-14 22:08:57 -0500 )edit

If your swap isn't big enough, instructions for growing the swap partition are here : If you need to make space by shrinking your home volume (eg. by 8Gb), reboot with "single" in the kernel boot parameters, unmount /home, then run "lvresize -r -L -8G /dev/fedora/home"

acyclik gravatar imageacyclik ( 2017-05-14 22:14:48 -0500 )edit

Proper (and fresh) link to instructions for plying with grub, for future reference.

ozeszty gravatar imageozeszty ( 2017-11-20 16:35:50 -0500 )edit

Question Tools

1 follower


Asked: 2016-02-20 04:52:09 -0500

Seen: 1,522 times

Last updated: May 31 '16