Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Suspend upon lid closure w/ elogind
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
shako
n00b
n00b


Joined: 29 Jul 2022
Posts: 4

PostPosted: Thu Oct 27, 2022 12:14 pm    Post subject: Suspend upon lid closure w/ elogind Reply with quote

Hi everyone,

I use Artix Linux w/ OpenRC and elogind, hence decided to post on this forum. Hope this won't bother the moderators.
I followed the instructions provided in the wiki to automatically lock the screen (via slock) upon lid closure/suspend/hibernation. It used to work until not much time ago, and now it isn't for some reason. Here is my script:

Code:

#!/bin/sh

# /etc/elogind/system-sleep/suslock.sh

username=USER
userhome=/home/$username
export XAUTHORITY="/run/user/1000/Xauthority"
export DISPLAY=":0.0"

case $1/$2 in
        pre/*)
            su $username -c "/usr/local/bin/slock" &
            sleep 1s;
            ;;
esac


Among the things I recently did which might interfere, there is moving my .Xauthority from ~ to /run/user/1000 (however, I exported the new location in the script as you can see). Also note that moving Xauthority back to my ~ won't fix this. I also tried placing the script in /lib64/elogind/system-sleep as described in the wiki, but had no success. Permissions on the script are 777. Here is dmesg upon lid closure (maybe it can help):

Code:

[  519.386394] elogind[1666]: Lid closed.
[  519.392967] elogind[1666]: Suspending...
[  519.405086] wlan0: deauthenticating from cc:d0:83:91:0d:f1 by local choice (Reason: 3=DEAUTH_LEAVING)
[  519.515398] iwlwifi 0000:03:00.0: Radio type=0x1-0x2-0x0
[  519.803619] iwlwifi 0000:03:00.0: Radio type=0x1-0x2-0x0
[  520.414324] iwlwifi 0000:03:00.0: Radio type=0x1-0x2-0x0
[  520.702692] iwlwifi 0000:03:00.0: Radio type=0x1-0x2-0x0
[  521.789593] elogind[1666]: Suspending system...
[  521.789620] PM: suspend entry (deep)
[  521.819067] Filesystems sync: 0.029 seconds
[  521.836814] Freezing user space processes ... (elapsed 0.001 seconds) done.
[  521.838583] OOM killer disabled.
[  521.838584] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
[  521.840016] printk: Suspending console(s) (use no_console_suspend to debug)
[  522.109975] sd 2:0:0:0: [sdb] Synchronizing SCSI cache
[  522.110957] sd 0:0:0:0: [sda] Synchronizing SCSI cache
[  522.111680] sd 2:0:0:0: [sdb] Stopping disk
[  522.112679] sd 0:0:0:0: [sda] Stopping disk
[  522.283302] e1000e: EEE TX LPI TIMER: 00000011
[  522.534161] ACPI: EC: interrupt blocked
[  522.549224] ACPI: PM: Preparing to enter system sleep state S3
[  522.558757] ACPI: EC: event blocked
[  522.558760] ACPI: EC: EC stopped
[  522.558761] ACPI: PM: Saving platform NVS memory
[  522.561562] Disabling non-boot CPUs ...
[  522.563209] smpboot: CPU 1 is now offline
[  522.566354] smpboot: CPU 2 is now offline
[  522.568621] smpboot: CPU 3 is now offline
[  522.573297] ACPI: PM: Low-level resume complete
[  522.573340] ACPI: EC: EC started
[  522.573342] ACPI: PM: Restoring platform NVS memory
[  522.575765] Enabling non-boot CPUs ...
[  522.575919] x86: Booting SMP configuration:
[  522.575922] smpboot: Booting Node 0 Processor 1 APIC 0x1
[  522.576708] Disabled fast string operations
[  522.580210] CPU1 is up
[  522.580543] smpboot: Booting Node 0 Processor 2 APIC 0x2
[  522.583054] Disabled fast string operations
[  522.586264] CPU2 is up
[  522.586372] smpboot: Booting Node 0 Processor 3 APIC 0x3
[  522.587118] Disabled fast string operations
[  522.590448] CPU3 is up
[  522.599346] ACPI: PM: Waking up from system sleep state S3
[  522.619622] ACPI: EC: interrupt unblocked
[/url]
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 3939
Location: Bavaria

PostPosted: Thu Oct 27, 2022 12:29 pm    Post subject: Reply with quote

Moved from Other Things Gentoo to Unsupported Software.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21431

PostPosted: Thu Oct 27, 2022 6:35 pm    Post subject: Re: Suspend upon lid closure w/ elogind Reply with quote

shako wrote:
It used to work until not much time ago, and now it isn't for some reason.
What output is logged when the non-functional version runs (or should have run)?
shako wrote:
Code:
case $1/$2 in
        pre/*)
This could be simplified by inspecting only $1.

You don't have a default branch, so if $1 is not pre, your script will exit silently. For troubleshooting, this is undesirable.
shako wrote:
Among the things I recently did which might interfere, there is moving my .Xauthority from ~ to /run/user/1000 (however, I exported the new location in the script as you can see). Also note that moving Xauthority back to my ~ won't fix this.
For completeness, please show us ls -la /run/user/1000/.
shako wrote:
Permissions on the script are 777.
That is almost never needed. In some cases, it is actively counterproductive, since some tools may see the excessively open permissions and refuse to proceed.
Back to top
View user's profile Send private message
shako
n00b
n00b


Joined: 29 Jul 2022
Posts: 4

PostPosted: Fri Oct 28, 2022 10:11 am    Post subject: Re: Suspend upon lid closure w/ elogind Reply with quote

Thank you for your answer @Hu.

Hu wrote:
This could be simplified by inspecting only $1.


I modified my script with only $1 and only $2, and (as I suspected) that didn't do it.

Hu wrote:
For completeness, please show us ls -la /run/user/1000/.


Code:

total 4
drwx------ 7 fedepau fedepau 200 Oct 28 12:00 .
drwxr-xr-x 3 root    root     60 Oct 28 10:31 ..
drwx------ 2 fedepau fedepau  60 Oct 28 11:03 at-spi
drwx------ 3 fedepau fedepau  60 Oct 28 10:31 dbus-1
drwx------ 2 fedepau fedepau  60 Oct 28 11:03 dconf
drwx------ 3 fedepau fedepau  60 Oct 28 11:03 gnupg
srwxr-xr-x 1 fedepau fedepau   0 Oct 28 10:31 pipewire-0
-rw-r----- 1 fedepau fedepau   0 Oct 28 10:31 pipewire-0.lock
drwx------ 2 fedepau fedepau  80 Oct 28 10:31 pulse
-rw------- 1 fedepau fedepau  51 Oct 28 10:31 Xauthority


Hu wrote:
That is almost never needed. In some cases, it is actively counterproductive, since some tools may see the excessively open permissions and refuse to proceed.


I tried 755, unfortunately that also doesn't work. Also, I am sorry didn't get which logs you would like to see (that you mentioned at the beginning of your reply): I will provide them as soon as possible once prompted.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software 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