Hello Garuda users.
I recently had a situation with my laptop where my battery went past critical battery levels and then died at 0%. However, I have turned on my KDE settings to hibernate my system at critical battery levels. This didn't happen.
A search on the net told me that's it's an old kde issue that has been fixed by upstream. But it still doesn't work for me for some reason. My hibernate itself has worked fine in the past. But in this case after my battery went past critical battery levels I wasn't even notified.
No notification
No actions nothing of the sort were visually attempted by my system it just went black screen at 0% battery.
When I installed garuda from calameres installer I choose Swap [With hibernate] when installing and nothing else. After that hibernate has worked out of the box for me though my laptop does not automatically go to hibernate mode after being asleep for a while but when I click the hibernate button it does and resumes with no problem so far.
I ran the command happened the same thing as clicking the hibernate button does and the system resumed with no problem.
File: /etc/systemd/sleep.conf
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 2.1 of the License, or (at your option)
# any later version.
#
# Entries in this file show the compile time defaults. Local configuration
# should be created by either modifying this file, or by creating "drop-ins" in
# the sleep.conf.d/ subdirectory. The latter is generally recommended.
# Defaults can be restored by simply deleting this file and all drop-ins.
#
# See systemd-sleep.conf(5) for details.
[Sleep]
#AllowSuspend=yes
#AllowHibernation=yes
#AllowSuspendThenHibernate=yes
#AllowHybridSleep=yes
#SuspendMode=
#SuspendState=mem standby freeze
#HibernateMode=platform shutdown
#HibernateState=disk
#HybridSleepMode=suspend platform shutdown
#HybridSleepState=disk
#HibernateDelaySec=120min
Yes, I always put my laptop in hibernate mode rather than shutdown when I turn off for the day or am going somewhere and won’t be using my system for a while. infact the only time my system reboots is when it has some kernel update (almost every 3-4 days) or when it runs into some bug
It sounds like suspend is working, just not configured the way you want it.
I think this is what you want:
suspend-then-hibernate
A low power state where initially user.slice unit is freezed. If the hardware supports low-battery alarms (ACPI _BTP), then the system is first suspended (the state is stored in RAM) and then hibernates if the system is woken up by the hardware via ACPI low-battery signal. Unit user.slice is thawed when system returns from hibernation. If the hardware does not support low-battery alarms (ACPI _BTP), then the system is suspended based on battery’s current percentage capacity. If the current battery capacity is higher than 5%, the system suspends for interval calculated using battery discharge rate per hour or HibernateDelaySec= if former is not available. Battery discharge rate per hour is stored in a file which is created after initial suspend-resume cycle. The value is calculated using battery decreasing charge level over a timespan for which system was suspended. For each battery connected to the system, there is a unique entry. After RTC alarm wakeup from suspend, battery discharge rate per hour is again estimated. If the current battery charge level is equal to or less than 5%, the system will be hibernated (the state is then stored on disk) else the system goes back to suspend for the interval calculated using battery discharge rate per hour. In case of manual wakeup, if the battery was discharged while the system was suspended, the battery discharge rate is estimated and stored on the filesystem. In case the system is woken up by the hardware via the ACPI low-battery signal, then it hibernates.
I’ve never bothered setting up hibernation myself, but it looks like a simple matter of configuring a systemd service. Make sure the options you want are declared in the configs, enable the service, and Bob’s your uncle. systemd-suspend-then-hibernate.service(8) — Arch manual pages
well actually not quite, Sleep and hibernate work just fine for me but the suspend service doesn’t play nice with my device it leaves me with a black screen after resuming. However, I will try your solution and then report again.
Hi thanks for your help but I am a little stuck could you please help:
I tried going through the wiki article and edited my sleep.conf file as below:
File: /etc/systemd/sleep.conf
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 2.1 of the License, or (at your option)
# any later version.
#
# Entries in this file show the compile time defaults. Local configuration
# should be created by either modifying this file, or by creating "drop-ins" in
# the sleep.conf.d/ subdirectory. The latter is generally recommended.
# Defaults can be restored by simply deleting this file and all drop-ins.
#
# See systemd-sleep.conf(5) for details.
[Sleep]
AllowSuspend=yes
AllowHibernation=yes
AllowSuspendThenHibernate=yes
#AllowHybridSleep=yes
#SuspendMode=
SuspendState=mem standby freeze
HibernateMode=platform shutdown
HibernateState=disk
#HybridSleepMode=suspend platform shutdown
#HybridSleepState=disk
HibernateDelaySec=1min
And then put my system to sleep which should have made my system go to hibernate mode after HibernateDelaySec but it didn't happen. Did I miss something? Do I have to restart a certain service for these changes to work?
Oh re reading the manual again I think this might have happened because my system battery was over 5%. Though I would still like to ask if I have set up mu sleep.conf properly?
If you are not sure what to put (the documentation for this service doesn’t exactly hold your hand) I believe it can just be SuspendMode=Suspend.
Have you tried running the command from the thread you linked to see what inhibitors are listed for your system? Paste them into the thread so we can take a look.
WHO UID USER PID COMM WHAT WHY MODE
ModemManager 0 root 712 ModemManager sleep ModemManager needs to reset devices delay
NetworkManager 0 root 687 NetworkManager sleep NetworkManager needs to turn off networks delay
UPower 0 root 1695 upowerd sleep Pause device polling delay
PowerDevil 1000 siddharth 1880 org_kde_powerde handle-power-key:handle-suspend-key:handle-hibernate-key:handle-lid-switch KDE handles power events block
Screen Locker 1000 siddharth 1709 ksmserver sleep Ensuring that the screen gets locked before going to sleep delay
5 inhibitors listed.
Here is the output.
Yes I did do that a while after posting this. I also tried various configurations of sleep.conf and logind.conf people have online for KDE to work with suspend-then-hibernate service.
I also turned on while asleep, hibernate after a period of inactivity which supposedly allows KDE to use suspend-then-hibernate.service. This option in the past has made me get black screens after resuming from sleep. However, while the black screen didn’t immediately start bothering me the service itslef didn’t do anything for me either.
I checked the journalctl which showed system initiated suspend-then-hibernate and turned off 7 cores of my CPU before immediately starting them again for some reason. It didn’t really show me any error for the process or that it failed somewhere. The system never actually went into hibernation for me though and the cat /sys/power/disk showed
platform shutdown reboot [suspend] test_resume
I tried rebooting again and the system started black screeing for me after sleep. So, I just turned off the service again and kinda just gave up.
While all this was happening I noticed that the KDE service of hibernating my system at critical battery levels started working again. I have tried using that service twice so far by consuming my battery to 10% and the system has started giving me notifications and then hibernating after 60 seconds. maybe a reboot or something somewhere I changed made it work. So I am assuming the service failing on me was a one time thing. (atleast I hope so).