View previous topic :: View next topic |
Author |
Message |
skiwarz Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
Joined: 23 Feb 2014 Posts: 269
|
Posted: Thu Feb 13, 2025 4:00 pm Post subject: elogind does not interrupt suspend |
|
|
I'm running elogind-255.5-r2 + openrc-0.55.1. I wish to have my machine sleep after a period of time, but only if emerge or gcc is not running. In accordance with the loginctl man page, I placed a hook script in /etc/elogind/system-sleep, which checks for any emerge or gcc processes and attempts to cancel the suspend operation if they exist. I've verified that the script is indeed executed on each suspend attempt.
The problem is, my machine suspends 100% of the time.
Pertinent portion of the script: Code: | #!/bin/sh
case $1/$2 in
pre/*)
if [[ $(ps aux | grep -E "gcc|emerge" | grep -v "grep") ]]; then
echo -e "CANCELLED suspend due to my script"
exit 1
fi
;; |
The man page says I need to print an error message to STDOUT which begins with one of: "CANCELLED" "CRITICAL" "ERROR" "FAILED"
I've tried all four of these words, and in all cases the system still suspends. That piece of code IS executed, because if I redirect it to a file or run the script manually, I see it.
I've placed "AllowSuspendInterrupts=yes" in /etc/elogind/logind.conf, /etc/elogind/logind.conf.d/myconfig.conf, /etc/elogind/sleep.conf, and /etc/elogind/sleep.conf.d/mysleep.conf
Any thoughts/suggestions? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
sublogic Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/92700334162390783722aa.png)
Joined: 21 Mar 2022 Posts: 312 Location: Pennsylvania, USA
|
Posted: Fri Feb 14, 2025 1:53 am Post subject: Re: elogind does not interrupt suspend |
|
|
skiwarz wrote: | I've placed "AllowSuspendInterrupts=yes" in /etc/elogind/logind.conf, /etc/elogind/logind.conf.d/myconfig.conf, /etc/elogind/sleep.conf, and /etc/elogind/sleep.conf.d/mysleep.conf | I assume elogind reads logind.conf only on startup. Did you restart the service ? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
skiwarz Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
Joined: 23 Feb 2014 Posts: 269
|
Posted: Fri Feb 14, 2025 6:31 am Post subject: Re: elogind does not interrupt suspend |
|
|
sublogic wrote: | skiwarz wrote: | I've placed "AllowSuspendInterrupts=yes" in /etc/elogind/logind.conf, /etc/elogind/logind.conf.d/myconfig.conf, /etc/elogind/sleep.conf, and /etc/elogind/sleep.conf.d/mysleep.conf | I assume elogind reads logind.conf only on startup. Did you restart the service ? |
Yes. In fact, I've restarted my entire machine numerous times since I began troubleshooting this, with no effect. There is also the "elogind reload" command which presumably reloads the config files without needing to restart elogind. Either way, still nothing. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Yamakuzure Advocate
![Advocate Advocate](/images/ranks/rank-G-1-advocate.gif)
![](images/avatars/46484627558b6ccf846e49.jpg)
Joined: 21 Jun 2006 Posts: 2307 Location: Adendorf, Germany
|
Posted: Sat Feb 15, 2025 10:30 am Post subject: Re: elogind does not interrupt suspend |
|
|
sublogic wrote: | skiwarz wrote: | I've placed "AllowSuspendInterrupts=yes" in /etc/elogind/logind.conf, /etc/elogind/logind.conf.d/myconfig.conf, /etc/elogind/sleep.conf, and /etc/elogind/sleep.conf.d/mysleep.conf | I assume elogind reads logind.conf only on startup. Did you restart the service ? | /etc/elogind/sleep.conf and /etc/elogind/sleep.conf.d/* are read whenever anything sleep-relevant happens, even if it only checks whether a specific mode is allowed.
At least, that is the plan for Version 257+, and it has already been implemented in the Version 256 merge.
Anyway, if cancellation by hook script does not work, there are two possibilities:
a) Another power manager interferes and enforces the suspension, like PowerDevil loves to do, or
b) I have managed to create a new bug.
Secretly, I hope it is the latter because that would be a problem I can do something about. But it is also a bit unnerving, as running hook scripts and making them break off power/sleep-related actions was something a lot of energy, time, and testing ran into.
The best thing would be to open an issue at github.com/elogind/elogind, and I'll have a look, maybe next week. _________________ Edited 220,176 times by Yamakuzure |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|