You are not logged in.

#1 2016-08-23 22:03:22

CTAG
Member
Registered: 2013-10-14
Posts: 80

[solved] Systemd-inhibit doesn't prevent sleep

I'm interested in using systemd-inhibit to keep my laptop from sleeping when the lid closes for certain situations. When I run the command below, the laptop will still go to sleep when I close the lid. Am I calling the command wrong?

systemd-inhibit --what=handle-lid-switch i3lock -n 
# the -n flag indicates no i3lock forking

Lenovo X200

$ uname -a
Linux bns-kharselim 4.7.1-1-ARCH #1 SMP PREEMPT Wed Aug 17 08:13:35 CEST 2016 x86_64 GNU/Linux

Thanks.

Last edited by CTAG (2016-10-04 18:38:32)

Offline

#2 2016-08-23 22:15:36

Alad
Wiki Admin/IRC Op
From: Bagelstan
Registered: 2014-05-04
Posts: 2,412
Website

Re: [solved] Systemd-inhibit doesn't prevent sleep

We don't know how you're calling systemd-inhibit. As root? Is the DISPLAY variable available? Do you have polkit installed? Does the i3lock command run successfully from the shell you've run systemd-inhibit from?

Last edited by Alad (2016-08-23 22:16:33)


Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby

Offline

#3 2016-08-23 22:21:29

CTAG
Member
Registered: 2013-10-14
Posts: 80

Re: [solved] Systemd-inhibit doesn't prevent sleep

The command doesn't work as either my own user or root.

DISPLAY is set to :0.

i3lock runs successfully, I've also tried substituting other programs like geany.

$ pacman -Qs polkit
local/polkit 0.113-4
    Application development toolkit for controlling system-wide privileges
local/polkit-kde 0.99.0-6
    Daemon providing a polkit authentication UI for KDE
local/polkit-qt4 0.112.0+git20160226-1
    A library that allows developers to access PolicyKit API with a nice Qt-style API
local/polkit-qt5 0.112.0+git20160226-1
    A library that allows developers to access PolicyKit API with a nice Qt-style API

Thanks.

Offline

#4 2016-08-24 23:13:46

orestisf
Member
Registered: 2016-08-24
Posts: 1

Re: [solved] Systemd-inhibit doesn't prevent sleep

I confirm that systemd-inhibit doesn't work for me either.

EDIT: Found a probably related bug report on launchpad: https://bugs.launchpad.net/ubuntu/+sour … ug/1615612

Last edited by orestisf (2016-08-25 10:45:56)

Offline

#5 2016-10-04 16:10:18

joehillen
Member
Registered: 2015-01-08
Posts: 20

Re: [solved] Systemd-inhibit doesn't prevent sleep

Sorry if I'm resurrecting a dead thread, but I just ran into this issue and I found a solution.

Turns out in /etc/systemd/logind.conf, LidSwitchIgnoreInhibited defaults to yes.

Uncomment the line, set it to no, and restart fixes the issue for me.

Last edited by joehillen (2016-10-04 18:54:15)

Offline

#6 2016-10-04 18:38:14

CTAG
Member
Registered: 2013-10-14
Posts: 80

Re: [solved] Systemd-inhibit doesn't prevent sleep

This appears to have solved the problem for me.

Thank you, joehillen.

Offline

Board footer

Powered by FluxBB