systemd idleaction=suspend not working in multiseat while a screen is showing login prompt

Bug #1730606 reported by amk
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
lightdm (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Ubuntu 16.04.3 LTS, multiseat setup.
systemd: Installed: 229-4ubuntu21
lightdm: Installed: 1.18.3-0ubuntu1.1

logind.conf:IdleAction=suspend
logind.conf:IdleActionSec=300

Using multiseat, it is not possible to have gnome settings controlling idle suspend, as it would ignore the other seat. IdleAction=suspend in /etc/systemd/logind.conf works well, provided both seats are logged in or locked.

After boot, or after logout the seat remains showing login screen and the system never suspends.

loginctl show-session provides IdleHint=yes that allows to determine whether the user is active. For some reason Active property is yes all the time.

But for the login screen the show-session does not provide the hint about seat idling:

$ loginctl show-session c9
Id=c9
User=108
Name=lightdm
Timestamp=Sun 2017-11-05 22:35:37 CET
TimestampMonotonic=13418600852
VTNr=7
Seat=seat0
Display=:1
Remote=no
Service=lightdm-greeter
Scope=session-c9.scope
Leader=12431
Audit=0
Type=x11
Class=greeter
Active=yes
State=active
IdleHint=no
IdleSinceHint=0
IdleSinceHintMonotonic=0

Working on a script to check for IdleHint=Yes and Service=lightdm-greeter and suspend based on this.

I am marking this as a bug in lightdm because I think it is not correctly reporting the idle status to the system.

affects: systemd (Ubuntu) → lightdm (Ubuntu)
summary: systemd idleaction=suspend not working in multiseat while a screen is
- showing login screen
+ showing login prompt
Revision history for this message
amk (9-launchpad-mikus-sk) wrote :

I run the attached workaround script every 15 minutes from cron.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in lightdm (Ubuntu):
status: New → Confirmed
Revision history for this message
amk (9-launchpad-mikus-sk) wrote :

After upgrade to Ubuntu version 20.4 the issue with the idle status reporting by lightdm-greeter remains. This continues to have idle setting of logind.conf ignored:

https://www.freedesktop.org/software/systemd/man/logind.conf.html
> Note that this requires that user sessions correctly report the idle status to the system. The system will execute the action after *all sessions* report that they are idle, no idle inhibitor lock is active, and subsequently, the time configured with IdleActionSec= (see below) has expired.

At the other hand, installing lightdm and unity-greeter causes suspend to happen every 20 minutes while one screen shows greeter, regardless of all other screens. Reported also at https://askubuntu.com/questions/1337649/how-to-disable-suspend-in-20-minutes-from-the-lightdm-login-screen and as https://bugs.launchpad.net/ubuntu/+source/lightdm/+bug/1928305

There is a workaround available there (set both org.gnome.settings-daemon.plugins.power and com.canonical.unity.settings-daemon.plugins.power sleep-inactive-ac-type to 'nothing'), preventing the unexpected suspend by greeter. Issue of this bug remains since the greeter still does not report idle to logind.

The script to check idle status of all session and force suspend overriding login screen needs update, systemd-inhibit --list does not have parseable output, like it was the case in systemd version 229. Needed to be replaced by command
gdbus call --system --dest org.freedesktop.login1 --object-path /org/freedesktop/login1 --method org.freedesktop.login1.Manager.ListInhibitors

There are several other reports of this problem, for example also at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=896083 or https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/22 but I am not sure about be the best upstream place to track this. It looks like gdm/lightdm greeter is not designed to work under logind but attempts to control the system sleep status on its own.

Revision history for this message
Sherwin Amiran (samiran149) wrote :

Amk's workaround is ideal. I modified slightly to include support for sddm and gdm , which makes it pretty universal.

I wish I was more competent at perl. I'd love to be able to get it to automatically set each login manager session to "Idle" on a 15 minute cycle, and remove the systemctl suspend action; instead allowing logind to handle the situation when all session are "Idle".

I already use notification in KDE to set IdleHint when the screen locks (using dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1/session/$XDG_SESSION_ID "org.freedesktop.login1.Session.SetIdleHint" boolean:true )

It feels like with a couple of simple work arounds IdleHint can be used effectively, which is a nice-to-have on single-seat workstations, and critical for suspending on multi-seat workstations.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.