• Hibernate After Extended Sleep


    Hello,

    I am trying to enable hibernate after an extended (few hours) of being in sleep / suspend mode.

    Found the following article:
    https://wiki.archlinux.org/index.php/Power_management#Delayed_hibernation_service_file

    Looking at the document, I see it says the following:

    “The Before and Conflicts options ensure it only is run for suspension and not hibernation–otherwise the service will run twice if delayed hibernation is triggered. The WantedBy and StopWhenUnneeded options are so it is started before sleep and stops upon resume. (Note that the suspend.target and hibernate.target targets do not stop when unneeded, but sleep.target does). Enable the service.”

    Do you know which service it wants me to enable? I’m a bit confused on what it is asking…

    Thanks in advance for everyone’s time and help!

  • this is a discription of what the service is doing to do not interconfict with this other services…
    and adding that you need to add:
    With recent sytemd release, you must also edit the suspend.target file by adding a Requires=suspend-to-hibernate.service line to the [Unit] section (source)

    [updates once a week] = [90% less problems]
    [Li{u}n//u//{i}x] since 1988 - overcoming failure means success
    http://kamprad.net/howto-installing-antergos/
    https://forum.antergos.com/topic/1883/how-to-include-system-logs-when-asking-for-help

  • create the service:

    $ sudo nano /etc/systemd/system/suspend-to-hibernate.service
    

    insert the script from wiki and save the file
    edit the suspend.target

    $ sudo nano /usr/lib/systemd/system/suspend.target
    

    adding: Requires=suspend-to-hibernate.service
    to [Unit] section:

    /usr/lib/systemd/system/suspend.target
    |# 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.

    [Unit]
    Description=Suspend
    Documentation=man:systemd.special(7)
    DefaultDependencies=no
    BindsTo=systemd-suspend.service
    After=systemd-suspend.service
    Requires=suspend-to-hibernate.service

    save this file too.

    start created service and see if it is working:

    $ sudo systemctl start suspend-to-hibernate.service
    systemctl status suspend-to-hibernate.service
    

    enable the new created service (automaticly starting on boot)

    $ sudo systemctl enable suspend-to-hibernate.service
    

    [updates once a week] = [90% less problems]
    [Li{u}n//u//{i}x] since 1988 - overcoming failure means success
    http://kamprad.net/howto-installing-antergos/
    https://forum.antergos.com/topic/1883/how-to-include-system-logs-when-asking-for-help

  • @joekamprad said in Hibernate After Extended Sleep:

    systemctl status suspend-to-hibernate.service

    Thanks @joekamprad – When I try to test to see if the output is working, I get the following output:

    [[email protected] ~]$ systemctl status suspend-to-hibernate.service
    ● suspend-to-hibernate.service - Delayed hibernation trigger
       Loaded: loaded (/etc/systemd/system/suspend-to-hibernate.service; disabled; vendor preset: disabled)
       Active: inactive (dead)
         Docs: https://bbs.archlinux.org/viewtopic.php?pid=1420279#p1420279
               https://wiki.archlinux.org/index.php/Power_management
    
    May 03 16:09:17 aahmad-pc systemd[1]: suspend-to-hibernate.service: Unit not needed anymore. Stopping.
    May 03 16:09:17 aahmad-pc systemd[1]: suspend-to-hibernate.service: Failed to enqueue stop job, ignoring: Transaction is destructive.
    May 03 16:09:17 aahmad-pc systemd[1]: Starting Delayed hibernation trigger...
    May 03 16:09:17 aahmad-pc sh[23604]: alarm set for 1493852957
    May 03 16:09:17 aahmad-pc systemd[1]: Started Delayed hibernation trigger.
    May 03 16:09:17 aahmad-pc systemd[1]: suspend-to-hibernate.service: Unit not needed anymore. Stopping.
    May 03 16:09:17 aahmad-pc systemd[1]: Stopping Delayed hibernation trigger...
    May 03 16:09:17 aahmad-pc sh[23608]: normal wakeup
    May 03 16:09:17 aahmad-pc systemd[1]: Stopped Delayed hibernation trigger.
    [[email protected] ~]$
    
  • oh yes cryptics ;)
    but
    should be right caus what the wiki says about Before and Conflicts…

    [updates once a week] = [90% less problems]
    [Li{u}n//u//{i}x] since 1988 - overcoming failure means success
    http://kamprad.net/howto-installing-antergos/
    https://forum.antergos.com/topic/1883/how-to-include-system-logs-when-asking-for-help

  • So is there a way for me to test this? Or is my only option to let the computer suspend for 2 hours, and then see if it goes into hibernate mode correctly shortly after?

    Thanks again for all your help so far!

  • you can cheat and put:
    Environment="SLEEPLENGTH=+2hour"
    to:

    Environment=“SLEEPLENGTH=+5minutes”

    Maybe? i do not know but try and error ;)

    [updates once a week] = [90% less problems]
    [Li{u}n//u//{i}x] since 1988 - overcoming failure means success
    http://kamprad.net/howto-installing-antergos/
    https://forum.antergos.com/topic/1883/how-to-include-system-logs-when-asking-for-help

  • needs to restart the service after editing:

    $ sudo systemctl restart suspend-to-hibernate.service
    

    [updates once a week] = [90% less problems]
    [Li{u}n//u//{i}x] since 1988 - overcoming failure means success
    http://kamprad.net/howto-installing-antergos/
    https://forum.antergos.com/topic/1883/how-to-include-system-logs-when-asking-for-help

  • Just tested, seems to work PERFECTLY during the 5 minute test. Switching it back to 2 hours for the final verification now…

    Thanks again @joekamprad !

    Thanks,
    Asif

  • good to see! i like bad hacks like this “5minutes”
    “back to 2 hours for the final verification now…” > this is 2 o clock in the morning here then… ;)

    [updates once a week] = [90% less problems]
    [Li{u}n//u//{i}x] since 1988 - overcoming failure means success
    http://kamprad.net/howto-installing-antergos/
    https://forum.antergos.com/topic/1883/how-to-include-system-logs-when-asking-for-help

  • Well I waited a bit more than 2 hours, but when I opened up my laptop it was in hibernate mode successfully! I think the settings successfully are updated now!

    Thanks again @joekamprad, one step closer to having my Antergos install be ‘perfect’!

    Thanks,
    Asif

  • Hey @joekamprad,

    Sorry to bring this forum post back from the dead…but I noticed my delayed hibernate has stopped working recently. It appears my laptop only goes into standby ONLY, and never enters into hibernate. I have double checked all the settings we discussed at the start of this post, and everything APPEARS to be set up correctly.

    Was there any new packages or updates that might have broken this feature for me? Also, to add to the troubleshooting process, I also had to reinstall TLP and TLP-rdw recently…if that could have caused this as well.

    Thanks in advance for all of your time and help, it is greatly appreciated!

sleep7 hibernate8 extended2 Posts 12Views 352
Log in to reply