Skip to content

lock when suspend issue (slock)

I tryed to add services files like these:

/etc/systemd/system/slock@.service

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

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

[Install]
WantedBy=sleep.target
WantedBy=suspend.target

to get slock running when i suspend. But i wont work :(

The Output of

systemctl list-units --type=target

UNIT                   LOAD   ACTIVE SUB    DESCRIPTION                
basic.target           loaded active active Basic System               
bluetooth.target       loaded active active Bluetooth                  
cryptsetup.target      loaded active active Local Encrypted Volumes    
getty.target           loaded active active Login Prompts              
graphical.target       loaded active active Graphical Interface        
local-fs-pre.target    loaded active active Local File Systems (Pre)   
local-fs.target        loaded active active Local File Systems         
multi-user.target      loaded active active Multi-User System          
network.target         loaded active active Network                    
nss-user-lookup.target loaded active active User and Group Name Lookups
paths.target           loaded active active Paths                      
remote-fs.target       loaded active active Remote File Systems        
slices.target          loaded active active Slices                     
sockets.target         loaded active active Sockets                    
sound.target           loaded active active Sound Card                 
swap.target            loaded active active Swap                       
sysinit.target         loaded active active System Initialization      
timers.target          loaded active active Timers                     

it seems like there is no suspend target. But when i add "-all"

systemctl list-units --type=target -all
UNIT                      LOAD   ACTIVE   SUB    DESCRIPTION                
basic.target              loaded active   active Basic System               
bluetooth.target          loaded active   active Bluetooth                  
cryptsetup.target         loaded active   active Local Encrypted Volumes    
emergency.target          loaded inactive dead   Emergency Mode             
getty-pre.target          loaded inactive dead   Login Prompts (Pre)        
getty.target              loaded active   active Login Prompts              
graphical.target          loaded active   active Graphical Interface        
initrd-fs.target          loaded inactive dead   Initrd File Systems        
initrd-root-device.target loaded inactive dead   Initrd Root Device         
initrd-root-fs.target     loaded inactive dead   Initrd Root File System    
initrd-switch-root.target loaded inactive dead   Switch Root                
initrd.target             loaded inactive dead   Initrd Default Target      
local-fs-pre.target       loaded active   active Local File Systems (Pre)   
local-fs.target           loaded active   active Local File Systems         
multi-user.target         loaded active   active Multi-User System          
network-pre.target        loaded inactive dead   Network (Pre)              
network.target            loaded active   active Network                    
nss-user-lookup.target    loaded active   active User and Group Name Lookups
paths.target              loaded active   active Paths                      
remote-fs-pre.target      loaded inactive dead   Remote File Systems (Pre)  
remote-fs.target          loaded active   active Remote File Systems        
rescue.target             loaded inactive dead   Rescue Mode                
shutdown.target           loaded inactive dead   Shutdown                   
sleep.target              loaded inactive dead   Sleep                      
slices.target             loaded active   active Slices                     
sockets.target            loaded active   active Sockets                    
sound.target              loaded active   active Sound Card                 
suspend.target            loaded inactive dead   Suspend                    
swap.target               loaded active   active Swap                       
sysinit.target            loaded active   active System Initialization      
time-set.target           loaded inactive dead   System Time Set            
time-sync.target          loaded inactive dead   System Time Synchronized   
timers.target             loaded active   active Timers                     

Why is suspend.target dead ?? Can anybody help me ?

1 points1 comments
Open on Reddit
About this post
Posted
Archived
Score
1 · 100% up
Kind
Text
ID
fazcfk

Author

3
posts
0
comments
2
media
View profile

1 comment

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.