You are not logged in.

#1 2019-11-17 21:54:08

mhamrah
Member
Registered: 2019-11-17
Posts: 3

[SOLVED] How to properly and automatically hibernate after sleep

Hi everyone, I've read through the [power management suspend and hibernate](https://wiki.archlinux.org/index.php/Po … _hibernate), looked at some posts on this forum, and tried finding info on how to use systemd to go from sleep to hibernate automatically on a laptop (Dell XPS 13 9370). Specifically,

1) On lid close, or after 10 minutes of inactivity, put the system into suspend mode (low power state, fast start).
2) After another 20 minutes, hibernate (suspend-to-ram, no power state).

I've set up hibernate to work on its own, and can do a systemctl suspend-then-hibernate. However, I am unable to get the system to suspend-then-hibernate on a lid close event (trying to edit /etc/systemd/sleep.conf onlidclose event is futile, same issue [as this poster](https://bbs.archlinux.org/viewtopic.php … 8#p1815248).

I found this [post on using a oneshot service](https://gist.github.com/atmoz/17ad12742 … 035d511ce7) put the solution is very hacky- I'm surprised there isn't an easier way to go about this.

Thank you for your assistance.

Last edited by mhamrah (2019-11-18 14:12:59)

Offline

#2 2019-11-17 22:06:59

seth
Member
Registered: 2012-09-03
Posts: 51,056

Re: [SOLVED] How to properly and automatically hibernate after sleep

man 5 logind.conf

Offline

#3 2019-11-17 22:11:33

mhamrah
Member
Registered: 2019-11-17
Posts: 3

Re: [SOLVED] How to properly and automatically hibernate after sleep

Thank you Seth. Do you suggest setting anything else beyond IdleAction and IdleActionSec? I'm curious if there are any recommendations wrt HandleLidSwitch in the laptop case and any issues with sleep.conf settings.

Offline

#4 2019-11-17 22:18:51

seth
Member
Registered: 2012-09-03
Posts: 51,056

Re: [SOLVED] How to properly and automatically hibernate after sleep

You want to set HandleLidSwitch to "suspend-then-hibernate" and HibernateDelaySec in sleep.conf (to "20min")
Don't forget to "systemctl restart systemd-logind"

Edit: the IdleAction will rely on a signal from the login session (gnome and i believe kde support this, hardly anything else does)

Last edited by seth (2019-11-17 22:20:01)

Offline

#5 2019-11-17 22:24:52

mhamrah
Member
Registered: 2019-11-17
Posts: 3

Re: [SOLVED] How to properly and automatically hibernate after sleep

Perfect, thank you.

Offline

#6 2019-11-18 07:33:54

seth
Member
Registered: 2012-09-03
Posts: 51,056

Re: [SOLVED] How to properly and automatically hibernate after sleep

Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.

Offline

Board footer

Powered by FluxBB