You are not logged in.

#1 2025-01-26 08:32:51

Cipher69969
Member
From: kerala
Registered: 2020-04-21
Posts: 16

[Solved] Slock not working on laptop sleep

Hello Everyone,

I am using slock. It is not working when laptop is waked up from sleep.

less /etc/systemd/system/slock@.service

[Unit]
Description=Lock X session using slock for user %i
Before=sleep.target

[Service]
User=%i
Environment=DISPLAY=:0
ExecStartPre=/usr/bin/xset dpms force suspend
ExecStart=/usr/local/bin/slock

[Install]
WantedBy=sleep.target
systemctl status slock@ananthu.service

× slock@ananthu.service - Lock X session using slock for user ananthu
     Loaded: loaded (/etc/systemd/system/slock@.service; enabled; preset: disabled)
     Active: failed (Result: timeout) since Sun 2025-01-26 09:26:26 CET; 20s ago
 Invocation: f9ae5e99a21c4f9bb796763e9f6662ae
    Process: 238577 ExecStartPre=/usr/bin/xset dpms force suspend (code=killed, signal=TERM)
   Mem peak: 1.6M
        CPU: 8ms

Jan 26 09:24:56 arch systemd[1]: Starting Lock X session using slock for user ananthu...
Jan 26 09:26:26 arch systemd[1]: slock@ananthu.service: start-pre operation timed out. Terminating.
Jan 26 09:26:26 arch systemd[1]: slock@ananthu.service: Control process exited, code=killed, status=15/TERM
Jan 26 09:26:26 arch systemd[1]: slock@ananthu.service: Failed with result 'timeout'.
Jan 26 09:26:26 arch systemd[1]: Failed to start Lock X session using slock for user ananthu.
journalctl -b -p3

Jan 26 09:26:26 arch systemd[1]: Failed to start Lock X session using slock for user ananthu.

How to solve this issue ?

Thanks

Last edited by Cipher69969 (2025-01-26 18:09:05)


reign the beast

Offline

#2 2025-01-26 13:42:24

manyroads
Member
From: MAGA's dystopian paradise
Registered: 2019-12-09
Posts: 19
Website

Re: [Solved] Slock not working on laptop sleep

Did you search the net?  Very quickly I found the followig, perhaps they'll help

https://superuser.com/questions/774787/ … sion-owner
https://www.reddit.com/r/archlinux/comm … ?rdt=53379
https://www.reddit.com/r/archlinux/comm … sue_slock/

Personally I never use systemd for i3lock or slock but I'm old a cranky.

Last edited by manyroads (2025-01-26 13:42:42)


Pax vobiscum,
Mark Rabideau - http://many-roads.com
spectrwm, i3, bspwm, dwm  ~ Reg. Linux User #449130
"For every complex problem there is an answer that is clear, simple, and wrong." H. L. Mencken

Offline

#3 2025-01-26 14:35:27

Cipher69969
Member
From: kerala
Registered: 2020-04-21
Posts: 16

Re: [Solved] Slock not working on laptop sleep

Thanks for looking it, I tried with all the links. Still not working.


reign the beast

Offline

#4 2025-01-26 15:53:30

seth
Member
Registered: 2012-09-03
Posts: 61,581

Re: [Solved] Slock not working on laptop sleep

Jan 26 09:26:26 arch systemd[1]: slock@ananthu.service: start-pre operation timed out. Terminating.

That's "xset dpms foce off", do you actually have xorg-xset installed? What happens if you run that manually?

Offline

#5 2025-01-26 17:46:48

Cipher69969
Member
From: kerala
Registered: 2020-04-21
Posts: 16

Re: [Solved] Slock not working on laptop sleep

seth wrote:

Jan 26 09:26:26 arch systemd[1]: slock@ananthu.service: start-pre operation timed out. Terminating.

That's "xset dpms foce off", do you actually have xorg-xset installed? What happens if you run that manually?

Yes, I have xorg-xset installed.

When running "xset dpms force suspend" it blackens my monitor.

This also works correctly

sudo systemctl start slock@ananthu.service

systemctl status slock@ananthu.service
○ slock@ananthu.service - Lock X session using slock for user ananthu
     Loaded: loaded (/etc/systemd/system/slock@.service; enabled; preset: disabled)
     Active: inactive (dead)

Jan 26 15:21:41 arch systemd[1]: Started Lock X session using slock for user ananthu.
Jan 26 15:21:55 arch systemd[1]: slock@ananthu.service: Deactivated successfully.
Jan 26 15:23:50 arch systemd[1]: Starting Lock X session using slock for user ananthu...
Jan 26 15:25:21 arch systemd[1]: slock@ananthu.service: start-pre operation timed out. Terminating.
Jan 26 15:25:21 arch systemd[1]: slock@ananthu.service: Control process exited, code=killed, status=15/TERM
Jan 26 15:25:21 arch systemd[1]: slock@ananthu.service: Failed with result 'timeout'.
Jan 26 15:25:21 arch systemd[1]: Failed to start Lock X session using slock for user ananthu.
Jan 26 18:43:46 arch systemd[1]: Starting Lock X session using slock for user ananthu...
Jan 26 18:43:46 arch systemd[1]: Started Lock X session using slock for user ananthu.
Jan 26 18:43:52 arch systemd[1]: slock@ananthu.service: Deactivated successfully.

reign the beast

Offline

#6 2025-01-26 17:55:03

seth
Member
Registered: 2012-09-03
Posts: 61,581

Re: [Solved] Slock not working on laptop sleep

And what if you remove the ExecStartPre dpms call from the service?
It's hardly relevant when sleeping the system anyway.

Offline

#7 2025-01-26 18:05:14

Cipher69969
Member
From: kerala
Registered: 2020-04-21
Posts: 16

Re: [Solved] Slock not working on laptop sleep

seth wrote:

And what if you remove the ExecStartPre dpms call from the service?
It's hardly relevant when sleeping the system anyway.

It worked.

systemctl status slock@ananthu.service
○ slock@ananthu.service - Lock X session using slock for user ananthu
     Loaded: loaded (/etc/systemd/system/slock@.service; enabled; preset: disabled)
     Active: inactive (dead)

Jan 26 15:23:50 arch systemd[1]: Starting Lock X session using slock for user ananthu...
Jan 26 15:25:21 arch systemd[1]: slock@ananthu.service: start-pre operation timed out. Terminating.
Jan 26 15:25:21 arch systemd[1]: slock@ananthu.service: Control process exited, code=killed, status=15/TERM
Jan 26 15:25:21 arch systemd[1]: slock@ananthu.service: Failed with result 'timeout'.
Jan 26 15:25:21 arch systemd[1]: Failed to start Lock X session using slock for user ananthu.
Jan 26 18:43:46 arch systemd[1]: Starting Lock X session using slock for user ananthu...
Jan 26 18:43:46 arch systemd[1]: Started Lock X session using slock for user ananthu.
Jan 26 18:43:52 arch systemd[1]: slock@ananthu.service: Deactivated successfully.
Jan 26 19:02:34 arch systemd[1]: Started Lock X session using slock for user ananthu.
Jan 26 19:02:50 arch systemd[1]: slock@ananthu.service: Deactivated successfully.

Thankyou for the help.


reign the beast

Offline

Board footer

Powered by FluxBB