You are not logged in.

#1 2018-03-05 15:56:25

rogerthat
Member
Registered: 2016-11-15
Posts: 56

Can't get sflock screen lock to work on sleep/suspend

Following the instructions here (https://wiki.archlinux.org/index.php/Power_management) I made a system-sleep script to try to lock the screen on sleep using sflock.
It doesn't work however.
Here are the components and then log results.

Package sflock installed:

$ ls -l /usr/bin/sflock
-rwsr-xr-x 1 root root 9872 Apr 10  2017 /usr/bin/sflock

A custom wrapper script I made for it. (NOTE: This script works perfectly correctly when run by a non-root user by typing "lock".)

$ cat /usr/local/bin/lock
#!/bin/sh
echo "lock script running"
/usr/bin/sflock -f '-*-fixed-*-*-*--13-*-*-*-*-*-*-*'

$ ls -l /usr/local/bin/lock
-rwxr-xr-x 1 root root 91 Mar  5 15:52 /usr/local/bin/lock

The system-sleep script:
(NOTE: The DISPLAY and sleep lines were not in my original, but I added them while trying to troubleshoot. Still doesn't work.)

$ cat /usr/lib/systemd/system-sleep/sleep-lock.sh
#!/bin/sh
case $1 in
  pre)
    echo "sleep-lock.sh script running: $1/$2"
    DISPLAY=:0
    /usr/local/bin/lock
    /usr/bin/sleep 1
    echo "sleep-lock.sh script done: $1/$2"
    ;;
esac

$ ls -l /usr/lib/systemd/system-sleep/sleep-lock.sh
-rwxr-xr-x 1 root root 191 Mar  5 16:33 /usr/lib/systemd/system-sleep/sleep-lock.sh

And the results after suspending and resuming using the power button:
(NOTE: the screen never locks hmm )

$ journalctl -b -u systemd-suspend
Mar 05 16:53:49 msi systemd[1]: Starting Suspend...
Mar 05 16:53:49 msi systemd-sleep[1229]: sleep-lock.sh script running: pre/suspend
Mar 05 16:53:49 msi systemd-sleep[1229]: lock script running
Mar 05 16:53:50 msi systemd-sleep[1229]: sleep-lock.sh script done: pre/suspend
Mar 05 16:53:50 msi systemd-sleep[1229]: Suspending system...
Mar 05 16:53:55 msi systemd-sleep[1229]: Suspending resumed.
Mar 05 16:53:55 msi systemd[1]: Started Suspend.

Offline

#2 2018-03-05 16:18:34

rogerthat
Member
Registered: 2016-11-15
Posts: 56

Re: Can't get sflock screen lock to work on sleep/suspend

Hmm. Just noticed this in the journal:

$ journalctl -p 3 -xb
Mar 05 17:08:58 msi systemd-coredump[423]: Process 420 (sflock) of user 0 dumped core.
                                           
                                           Stack trace of thread 420:
                                           #0  0x00000000b7363d59 _nss_files_getspnam_r (libnss_files.so.2)
                                           #1  0x00000000b7642b0e getspnam_r@@GLIBC_2.1.2 (libc.so.6)
                                           #2  0x00000000b7641eba getspnam (libc.so.6)
                                           #3  0x00000000080491ea n/a (sflock)
                                           #4  0x00000000b755e6c3 __libc_start_main (libc.so.6)
                                           #5  0x0000000008049948 n/a (sflock)
-- Subject: Process 420 (sflock) dumped core
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Documentation: man:core(5)
-- 
-- Process 420 (sflock) crashed and dumped core.
-- 
-- This usually indicates a programming error in the crashing program and
-- should be reported to its vendor as a bug.

Offline

#3 2018-03-06 19:51:06

rogerthat
Member
Registered: 2016-11-15
Posts: 56

Re: Can't get sflock screen lock to work on sleep/suspend

Not sure why sflock would crash when run by script instead of a user?

Offline

Board footer

Powered by FluxBB