This is commented in the sleep.conf, which according to the file description should indicate it was set as a compile time default.
It is now uncommented… No changes observed.
That is strange if the handler of lid switch should be related to this issue. Is it so that xfce4 power manager is unable to handle the suspend-then-hibernate option? Is the only workaround to use another power manager?
Default (commented, hence compiled in) was 60min. I set it to 2 min for my testing. My testing reveals that if this setting is not set, the suspend-then-hibernate works identically to suspend. (It never hibernates.)
I’ll not put too much effort into how to trigger it automatically until it is working when triggered manually by
# systemctl suspend-then-hibernate
I have no indication that suspend-then-hibernate will trigger hibernate if battery gets low. It seems to set a wake up timer only. Maybe there is a setting somewhere to enable this behavior? (Similar to the behavior that hibernate timer never triggers if HibernateDelaySec=60min is left commented.)
What I’m looking for is either a way to enable suspend-then-hibernate to do battery check, or a way to modify the commands ran when the timeout to hibernate is triggered.
Or a completely different way to trigger action on low battery while suspended.
Where can I find the source code for the suspend-then-hibernate function?
Here is something interesting from release notes of systemd 253 (I’m on 256)
* systemd-sleep 'HibernateDelaySec=' setting is changed back to pre-v252's behaviour, and a new 'SuspendEstimationSec=' setting is added to provide the new initial value for the new automated battery estimation functionality. If 'HibernateDelaySec=' is set to any value, the automated estimate (and thus the automated hibernation on low battery to avoid data loss) functionality will be disabled.
Release page: Release systemd v253 · systemd/systemd · GitHub
Sounds like IF HibernateDelaySec is set in sleep.conf, the battery level monitoring is disabled… So one can’t have both. Thats OK with me, I’m only looking for the battery monitor function. Now, why doesn’t it work? Is there a low battery threshold to set somewhere?
Another interesting thing, from man systemd-sleep.conf
If the system has battery and HibernateDelaySec= is not set, low-battery alarms (ACPI _BTP) are tried first for
detecting battery percentage and wake up the system for hibernation. If not available, or HibernateDelaySec= is
set, the system would regularly wake up to check the time and detect the battery percentage/discharging rate. The
rate is used to schedule the next detection. If that is also not available, SuspendEstimationSec= is used as last
resort.
Added in version 239
As the changelog for 253 states, there were changes to this area in 252 and 253. Documentation seems not to be updated.
I’m wondering if the sleep state could be affecting the wake up events during suspend. How do I change manjaro to use s2idle state when suspended?
How can the 5% battery level be changed to i.e. 20%? (Thinking maybe the calculation of when 5% is reached fails and the wake up timer is triggered to late? Maybe the level of reminding battery is confused with voltage drop in battery when the system wakes up to hibernate, hence bios cuts power at the moment hibernate is about to start when battery is that low?)