About three weeks ago, a Debian (testing) update made a significant change on my system: it added a 30-minute suspend timeout. If I left the machine unattended for half an hour, it would automatically go to sleep.
What's wrong with that? you ask. Why not just let it sleep if you're going to be away from it that long?
But sometimes there's a reason to leave it running. For instance, I might want to track an ongoing discussion in IRC, and occasionally come back to check in. Or, more important, a long-running job that doesn't require user input, like a system backup, or ripping a CD. or testing a web service. None of those count as "activity" to keep the system awake: only mouse and keyboard motions count.
There are lots of pages that point to the file /etc/systemd/logind.conf, where you can find commented-out lines like
The comment at the top of the file says that these are the defaults
and references the logind.conf man page. Indeed,
says that setting IdleAction=ignore should prevent annything from happening,
and that setting IdleActionSec=120min should lead to a longer delay.
Alas, neither is true. This file is completely ignored as far as I can tell, and I don't know why it's there, or where the 30 minute setting is coming from.
What actually did work was in Debian's Suspend wiki page. I was skeptical since the page hasn't been updated since Debian Jessie (Stretch, the successor to Jessie, has been out for more than a year now) and the change I was seeing just happened in the last month. I was also leery because the only advice it gives is "For systems which should never attempt any type of suspension, these targets can be disabled at the systemd level". I do suspend my system, frequently; I just don't want it to happen unless I tell it to, or with a much longer timeout than 30 minutes.
But it turns out the command it suggests does work:
sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.targetand it doesn't disable suspending entirely: I can still suspend manually, it just disables autosuspend. So that's good enough.
Be warned: the page says next:
systemctl restart systemd-logind.serviceor reboot.
It neglects to mention that restarting systemd-logind.service will kill your X session, so don't run that command if you're in the middle of anything.
It would be nice to know where the 30-second timeout had been coming from, so I could enable it after, say, 90 or 120 minutes. A timeout sounds like a good thing, if it's something the user can configure. But like so many systemd functions, no one who writes documentation seems to know how it actually works, and those who know aren't telling.
[ 13:36 Aug 12, 2018 More linux | permalink to this entry | ]