You are not logged in.

#1 2015-02-21 00:19:00

bartbkr
Member
Registered: 2015-02-17
Posts: 10

Lock after return from sleep

My systemd service for locking the screen using i3lock after returning from suspend no longer triggers.

My resume.service:

[Unit]
Description=User resume actions
Before=sleep.target

[Service]
Type=forking
Environment=DISPLAY=:0
ExecStart=/usr/bin/i3lock -c 000000

[Install]
WantedBy=sleep.target

I have added in a User line under [Service] to no avail. When trying to enable the service and I return from suspend, systemctl status resume.service reads:

i3lock[14065]: No protocol specified
i3lock[14065]: i3lock: Could not connect to X11, maybe you need to set DISPLAY?
systemd[1]: resume.service: main process exited, code=exited, status=1/FAILURE
systemd[1]: Unit resume.service entered failed state.
systemd[1]: resume.service failed.

I've also tried other X-based screen lockers and none work. I am using gdm as the display manager and i3 as the window manager. Could this be an issue with the recent update to X11?

Offline

#2 2015-02-21 00:52:36

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 29,068
Website

Re: Lock after return from sleep

Are you sure your DISPLAY is 0?


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2015-02-21 01:28:28

bartbkr
Member
Registered: 2015-02-17
Posts: 10

Re: Lock after return from sleep

I've checked as such:

$ echo $DISPLAY
:0

Offline

#4 2015-02-21 01:41:51

teateawhy
Member
From: GER
Registered: 2012-03-05
Posts: 1,137
Website

Re: Lock after return from sleep

You need to add your user like this:

[Service]
User=bartbkrsusername
Type=forking
Environment=DISPLAY=:0
ExecStart=/usr/bin/i3lock

Offline

#5 2015-02-21 02:01:14

bartbkr
Member
Registered: 2015-02-17
Posts: 10

Re: Lock after return from sleep

I added the user line with my username and still have the same issue.

I'm not sure if this matters but I am enabling it as a system service, not a user service.

Offline

#6 2015-02-21 02:06:04

teateawhy
Member
From: GER
Registered: 2012-03-05
Posts: 1,137
Website

Re: Lock after return from sleep

bartbkr wrote:

I added the user line with my username and still have the same issue.

Have you rebooted, or reloaded the units with this?
# systemctl daemon-reload
Systemd does not pick up changes to services files unless you reboot or reload the daemons.

I'm not sure if this matters but I am enabling it as a system service, not a user service.

Yes, that's correct.

Offline

#7 2015-02-21 02:28:09

bartbkr
Member
Registered: 2015-02-17
Posts: 10

Re: Lock after return from sleep

Yes, I performed a systemd daemon-reload and still no i3lock upon returning from sleep.

The service file is currently in /etc/systemd/system/.

Offline

#8 2015-02-21 15:34:15

bartbkr
Member
Registered: 2015-02-17
Posts: 10

Re: Lock after return from sleep

Looks like this was fixed by the most recent upgrade of Xorg:

upgraded xorg-server-common (1.17.1-1 -> 1.17.1-2)
upgraded xorg-server (1.17.1-1 -> 1.17.1-2)

Thanks for all those who helped!

Offline

Board footer

Powered by FluxBB