LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-18-2018, 12:04 AM   #1
ziphem
Member
 
Registered: Feb 2004
Location: US / EU
Distribution: Fedora 31
Posts: 225

Rep: Reputation: 29
Systemd-inhibit doesn't work, even with logind.conf set


I know this is not a particularly new problem, but I've tried to understand this and haven't been able to figure it out. I'm on Fedora 28.

I edited /etc/systemd/logind.conf and made LidSwitchIgnoreInhibited=no.

I reboot. When I run

Code:
systemd-inhibit --why="Prevent sleep" --mode=block --what=handle-lid-switch
and I close the lid of my laptop, it sleeps nonetheless.

I'm seeing the below, too:
Code:
    What: handle-lid-switch
     Why: Multiple displays attached
    Mode: block
I'd appreciate any guidance on this. Thanks!
 
Old 10-18-2018, 02:25 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,119

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
What's wrong with setting the switch to ignore (in logind) ?.

Quote:
systemd-inhibit may be used to execute a program with a shutdown, sleep, or idle inhibitor lock taken. The lock will be acquired before the specified command line is executed and released afterwards.
With no command, the fd would reasonably be considered as released immediately.

Working as designed.
 
Old 10-18-2018, 03:00 AM   #3
ziphem
Member
 
Registered: Feb 2004
Location: US / EU
Distribution: Fedora 31
Posts: 225

Original Poster
Rep: Reputation: 29
Hi, thanks for the quick response. I wanted to suspend the sleep when running one certain program, which is why I didn't want to disable in logind.conf. I've tried also with a command, and this also did not inhibit suspend.

Code:
systemd-inhibit --what=handle-lid-switch --why="Prevent Sleep" --mode=block /home/me/GUI.py &
 
Old 10-18-2018, 04:50 AM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,119

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
I've never looked at this, but I can't imagine how that would work - try daemonising your code.
 
Old 11-11-2018, 11:05 AM   #5
ziphem
Member
 
Registered: Feb 2004
Location: US / EU
Distribution: Fedora 31
Posts: 225

Original Poster
Rep: Reputation: 29
Thanks. Even when I run in terminal something like systemd-inhibit --what=handle-lid-switch --who="Me" --why="On lid close" --mode=block sleep 59s, and I close the lid, it sleeps, and it should not - particularly considering that I've checked systemd-inhibit after running the command and I see that added as a listed inhibitor.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
unkown cause for systemd failure state - systemd-logind cannot start org.freedesktop.systemd1 after server reboot mario.p Linux - Server 5 07-30-2018 02:11 AM
systemd-logind slow logins Shadow_7 Debian 21 06-18-2015 05:43 PM
LXer: Systemd-Logind Device Management For Wayland LXer Syndicated Linux News 0 08-26-2013 05:33 AM
LXer: Ubuntu Plans To Move To Systemd's Logind LXer Syndicated Linux News 0 03-07-2013 02:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration