Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
elogind does not interrupt suspend
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
skiwarz
Apprentice
Apprentice


Joined: 23 Feb 2014
Posts: 269

PostPosted: Thu Feb 13, 2025 4:00 pm    Post subject: elogind does not interrupt suspend Reply with quote

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
View user's profile Send private message
sublogic
Guru
Guru


Joined: 21 Mar 2022
Posts: 312
Location: Pennsylvania, USA

PostPosted: Fri Feb 14, 2025 1:53 am    Post subject: Re: elogind does not interrupt suspend Reply with quote

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
View user's profile Send private message
skiwarz
Apprentice
Apprentice


Joined: 23 Feb 2014
Posts: 269

PostPosted: Fri Feb 14, 2025 6:31 am    Post subject: Re: elogind does not interrupt suspend Reply with quote

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
View user's profile Send private message
Yamakuzure
Advocate
Advocate


Joined: 21 Jun 2006
Posts: 2307
Location: Adendorf, Germany

PostPosted: Sat Feb 15, 2025 10:30 am    Post subject: Re: elogind does not interrupt suspend Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
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