View previous topic :: View next topic |
Author |
Message |
Andrey Grozin n00b
Joined: 12 Nov 2015 Posts: 7
|
Posted: Mon Oct 21, 2024 4:00 pm Post subject: How to hibernate when I close the lid |
|
|
I've bought a new notebook (asus vivobook) and installed gentoo. I want the system to hibernate when I close the lid. I've installed hibernate-scripts; when I do (as root)
it hibernates fine, when I switch it on again, everything is restored. But I want to be able to do it quickly, without su and typing the root password, just by closing the lid. I've edited /etc/elogind/logind.conf to contain
Code: | HandleLidSwitch=hibernate
HandleLidSwitchExternalPower=hibernate |
But this does not work: when I close the lid, the notebook continues to work. Is it possible to instruct elogind to call /usr/bin/hibernate when I close the lid? |
|
Back to top |
|
|
Ralphred l33t
Joined: 31 Dec 2013 Posts: 614
|
Posted: Mon Oct 21, 2024 5:27 pm Post subject: Re: How to hibernate when I close the lid |
|
|
Andrey Grozin wrote: | Is it possible to instruct elogind to call /usr/bin/hibernate when I close the lid? | Yeah, if you look up the "Hook Directories" section in man loginctl you can put scripts to be run on "system-sleep" in there. It's worth checking if loginctl hibernate works first though, if it does it could indicate elogind isn't seeing the lid close event at all. |
|
Back to top |
|
|
Andrey Grozin n00b
Joined: 12 Nov 2015 Posts: 7
|
Posted: Tue Oct 22, 2024 4:54 am Post subject: Re: How to hibernate when I close the lid |
|
|
Ralphred wrote: | Andrey Grozin wrote: | Is it possible to instruct elogind to call /usr/bin/hibernate when I close the lid? | Yeah, if you look up the "Hook Directories" section in man loginctl you can put scripts to be run on "system-sleep" in there. It's worth checking if loginctl hibernate works first though, if it does it could indicate elogind isn't seeing the lid close event at all. |
When I do
as root, nothing happens: I get the next shell prompt, and the notebook continues to work.
works as expected. |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 22543
|
Posted: Tue Oct 22, 2024 11:11 am Post subject: |
|
|
That suggests that elogind is not able to initiate hibernate. Thus, as Ralphred suggested, lid detection might be fine, and the laptop recognizes the lid close by attempting to hibernate (and not doing so). This differs from the laptop being unaware that the lid closed, and therefore not attempting to hibernate. I suggest debugging why loginctl hibernate does nothing. |
|
Back to top |
|
|
|