Auto-suspend when idle

Please post all general support questions for LXDE here.
Locked
mrmekon
Posts: 3
Joined: Sun Nov 12, 2017 3:48 pm

Auto-suspend when idle

Post by mrmekon »

I have a fresh, fully-upgraded install of Lubuntu (Ubuntu 17.04 + LXDE 0.99.2-3).

I'm having trouble getting suspend-when-idle to work sensibly. I have a fairly simple intention:
* Suspend when system is idle for 15 minutes, always.
* Wake on key, LAN, and RTC.

I configured sleep-when-idle in the Power Management GUI, which is apparently xfce4-power-manager under the hood. All of the above works once, when I'm logged in and using the session. But after it wakes from key/LAN/RTC, it won't auto-suspend again. Not until I unlock it, at least.

It's very slow to debug, but it seems like the auto-suspend timer only activates when the session is unlocked. If I login and use it, then it will sleep after 15 minutes. But on wake from suspend it locks the session, and will idle forever. Manually calling pm-suspend always works.

Things I have changed:
* user account set to require NOPASSWD for sudo pm-suspend
* org.freedesktop.login1.policy defaults changed:
- allow_any: yes
- allow_inactive: yes
- allow_active: yes

Any ideas on the right way to configure it to _always_ auto-suspend? Or, if not, perhaps a list of which services/processes are even involved in suspend+wake? It seems like there are a lot of different layers involved...

Side question 1: what is considered "idle", and which service is determining it? Is it only keyboard/mouse, or is there smarter logic?

Side question 2: Any way to set the suspend timer to less than 15 mins, for debugging?
drooly
Posts: 791
Joined: Mon Apr 08, 2013 6:45 am

Re: Auto-suspend when idle

Post by drooly »

installing LXDE on top of ubuntu is not the same as installing Lubuntu.
power management related problems could stem from that.
I suggest you try installing Lubuntu; if the problem persists we need some more info, first of all what hardware is this all about.
mrmekon
Posts: 3
Joined: Sun Nov 12, 2017 3:48 pm

Re: Auto-suspend when idle

Post by mrmekon »

Oops, I thought it actually was Lubuntu, but it is actually from an Ubuntu 17.04 netboot ISO. Either way, LXDE was installed by selecting it from the official installer. I did not install it manually. I definitely won't be reinstalling the OS to suspend it :)

I don't think the hardware really matters, but it's a desktop PC with Intel Core i7-7700, Asus STRIX Z270H motherboard, dual Radeon RX480s, 32GB of RAM. But actual suspend works just fine. I can manually suspend and wake infinite times, with 'pm-suspend' or 'systemctl suspend', and I can wake it with magic packets and RTC timers and key presses.

The problem is maybe something about how X session ownership works? It seems like the auto-suspend setting applies to the logged in user, and when it wakes from sleep that user's session is in some way inactive. I want auto-suspend tied to the global system, not a particular user.

I tried enabling "IdleAction=suspend" in logind.conf and it did absolutely nothing. I'm not sure how all of these bits interact, or which bits are involved at all... X.org and lightdm and lxsession and systemd and upower and acpid and xfce4-power-manager and D-Bus and xscreensaver and whatever else is striving for a piece of that sweet power management pie.
drooly
Posts: 791
Joined: Mon Apr 08, 2013 6:45 am

Re: Auto-suspend when idle

Post by drooly »

is this the original problem:
mrmekon wrote:But after it wakes from key/LAN/RTC, it won't auto-suspend again. Not until I unlock it, at least.
???

have you tried to disable the screenlocker (if it is lightlocker, i think uninstalling will do) to see if it works properly without locking?

all in all, this is a very complex situation involving systemd, policykit, udev, acpi... and you will hurt yourself trying to think it out.
i still maintain that chances are high that all this will "Just Work" when you install Lubuntu proper.
mrmekon
Posts: 3
Joined: Sun Nov 12, 2017 3:48 pm

Re: Auto-suspend when idle

Post by mrmekon »

I didn't try disabling the locker, because I do want it to lock on sleep.

It's a shame that it's so complicated. Oh well. I went for the Unix strategy instead – "do one thing well" – and wrote a service that just handles auto-sleep/wake for me: https://github.com/mrmekon/circadian
Locked