logind - IdleAction - action is taken despite keyboard input #1295

Closed
tomzpl opened this Issue Sep 18, 2015 · 13 comments

Comments

Projects
None yet
4 participants

tomzpl commented Sep 18, 2015

I'm currently using systemd with Cinnamon.
When typing (or using xdotool) in gnome-terminal or leafpad with following logind.conf settings:
IdleAction=suspend
IdleActionSec=1min
the computer goes to suspend mode after 1minute.

It was fine with older systemd v208(opensuse 13.1). After update to v225(archlinux) the bug is present.

P.s. just checked and mouse input also DO NOT PREVENT GOING SUSPEND

Owner

poettering commented Sep 18, 2015

your DE has to signal to logind whether it is idle... Does it do that? Does it do that correctly?

If you use GNOME (which implements the idle state propagation correctly), does it work then?

tomzpl commented Sep 18, 2015

It's really strange, when I switched to multi-user.target (cinnamon and gdm not running), system is not going to suspend.

But runinng only GDM and typing in the user list or password field didnt prevent computer from suspend.

The third test I did, was to run GNOME - but it was the same situation as with GDM.

I think the problem lays in GDM, and not with Cinnamon or Gnome. With Archlinux, the GDM process is running always (on tty1), even if Cinnamon/GDM is started (tty2).

Owner

poettering commented Sep 18, 2015

i don't follow... in the original bug report you wrote you were using gnome-terminal when this happens. Now you say it only happens in gdm? What is it now?

tomzpl commented Sep 18, 2015

I was using gnome-terminal and leafpad in Cinnamon DE - separately not in the same time.

After further testing, it seems that the issue occurs with GDM and DE's like TWM or GNOME started from
$ systemctl isolate multi-user.target
$ startx
The GDM was not running during the test.

For a while I was thinking that GDM is reporting to systemd-logind that it's inactive for X time. This could be true, as I can see while running Gnome/Cinnamon the GDM process and I can switch to the TTY1 is running.

The issue occurs:

  • Cinnamon(tty2) + GDM(tty1)
  • Gnome(tty2) + GDM(tty1)
  • Cinnamon only (startx in ttyX)
  • Gnome only (startx in ttyX)
  • TWM only (startx in ttyX)

But not occurs when running without X11 both Display and Window managers.

Owner

poettering commented Sep 21, 2015

idle stuff with "startx" sessions is not likely to work at all... If you use startx in a way where you run X on a different VT than the VT you invoked it from, then all bets are off anyway, since there's no session that other VT belongs to, and everything is fucked.

The only way how startx can work at all, is if the VT you are already are on is temporarily "upgraded" to graphical, and then reverts back to text after X is terminated. But in this case, the session is still registered as text, and the idle detection works completely different than for graphical sessions: we look at the atime and mtime of the tty device in /dev.

startx is only semi supported for many reasons, this is one. We are not actively breaking it, but don't assume that all features we support work with it. idle detection for example does not.

Hence, I am really only interested in the start via gdm case... is this gdm3 i presume?

4javier commented Oct 1, 2015

Hi all.
I'm trying to debug an Arch Linux user issue:
If X is started by startx on the same VT where user logged in preserving session permissions, is X capable of passing to systemd the "using" state of the system? Is Systemd able to understand that whilst X is executed, it must reset its idle timer?

Owner

poettering commented Oct 3, 2015

@4javier no, the idle logic does not work for text sessions that are "upgraded" to X11 sessions. That's what I already wrote above. And as mentioned, I am not convinced this is something we shoudl really make work.

4javier commented Oct 3, 2015

How graphical session managers notify systemd of their execution, making it stop its idle timer? Can't we just create a startx.service that takes advantage of the same mechanism?

tomzpl commented Apr 26, 2016

Hi All,
I know it was a while from the reporting the issue, and I'm sorry not to provide you requested information.

I use GDM3, the issue still persists with the latest packages from Arch distro.

Probably the problem is that systemd is tracking TTY1(GDM3) instead of TTY2(cinnamon).
The possible solution is to track all TTY devices for atime and mtime changes.

Regards,

Owner

poettering commented Apr 26, 2016

@tomzpl no, we don't track tty idleness on graphical sessions. The idea is that on graphical sessions it's the DE's job to inform us about the idle state of that session. Only for text sessions we'll check the tty device directly.

tomzpl commented Apr 26, 2016

Sorry for the misunderstanding, I will report the bug to the Cinnamon developers.

Thank you,

tukoz commented Aug 26, 2016

So that's why --my laptop keeps suspending while I'm writing. Thank you all above.

@poettering please what about @4javier's question? That'd be interesting!

Owner

poettering commented May 12, 2017

Closing, under the assumption this is a cinnamon issue and has been forwarded there.

@poettering poettering closed this May 12, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment