You are not logged in.

#1 2022-09-20 15:01:13

effraie
Member
Registered: 2012-08-30
Posts: 66

[SOLVED] betterlockscreen systemd service is dead

i'm currently configuring a laptop to run a systemd service for betterlockscreen, and my service status is dead (therefore my lockscreen doesn't run when my laptop exit sleep).

Betterlockscreen run fine by hand, dunst is installed and up to date, i run bspwm

here is the error i get : 

❯ systemctl status betterlockscreen@mathieu.service                       
○ betterlockscreen@mathieu.service - Lock screen when going to sleep/suspend
     Loaded: loaded (/usr/lib/systemd/system/betterlockscreen@.service; enabled; preset: disabled)
     Active: inactive (dead)

sept. 20 10:22:29 radium betterlockscreen[4459]: xset:  unable to open display ":0"
sept. 20 10:22:29 radium betterlockscreen[4465]: Failed to open connection to "session" message bus: Using X11 for dbus-daemon autolau>
sept. 20 10:22:29 radium betterlockscreen[4463]: Failed to communicate with dunst, is it running? Or maybe the version is outdated. Yo>
sept. 20 10:22:29 radium betterlockscreen[4451]: [b] Betterlockscreen
sept. 20 10:22:29 radium betterlockscreen[4451]: [*] Running prelock...
sept. 20 10:22:29 radium betterlockscreen[4451]: [*] Locking screen...
sept. 20 10:22:29 radium betterlockscreen[4467]: i3lock: Could not connect to X11, maybe you need to set DISPLAY?
sept. 20 10:22:29 radium betterlockscreen[4451]: [*] Running postlock...
sept. 20 10:22:30 radium systemd[1]: betterlockscreen@mathieu.service: Deactivated successfully.
sept. 20 10:22:30 radium systemd[1]: Started Lock screen when going to sleep/suspend.

And here is the service file, as provided by betterlockscreen maintainer :

[Unit]
Description=Lock screen when going to sleep/suspend
Before=sleep.target
Before=suspend.target

[Service]
User=%I
Type=simple
Environment=DISPLAY=:0
ExecStart=/usr/bin/betterlockscreen --lock
TimeoutSec=infinity
ExecStartPost=/usr/bin/sleep 1

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

Any idea what could be the issue, and how to fix it ?

Last edited by effraie (2022-09-20 15:21:58)

Offline

#2 2022-09-20 15:16:30

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,672

Re: [SOLVED] betterlockscreen systemd service is dead

Well is DISPLAY=:0 correct? From your working session what's echo $DISPLAY? If you start bspwm via some display manager chances are that reserves DISPLAY:0 for itself and your actual session is somewhere else.

If you are using startx/xinitrc, make sure your xinitrc template is setup correctly as mentioned in https://wiki.archlinux.org/title/Xinit#xinitrc

Offline

#3 2022-09-20 15:21:34

effraie
Member
Registered: 2012-08-30
Posts: 66

Re: [SOLVED] betterlockscreen systemd service is dead

thanks, that was indeed an issue with the display manager!

Offline

Board footer

Powered by FluxBB