Sunday, April 28, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 888  / 1 Year ago, mon, april 24, 2023, 8:52:48

Running Ubuntu 18.04 on an older Dell machine, one of those mini machines that mounts on the back on a monitor. Thing is, it's a headless system, and I removed the GUI since I won't be needing it anyway.


The PC sleeps after a certain time. Haven't really timed it, but after a while idling, it goes to sleep. I'd like to configure that timing a bit so it works better for this particular case.


Question is: who is issuing that sleep command, and where is the timing configured? Most info sources on power management in ubuntu direct me to gnome-power-manager. But on this machine, there's no GUI, so.. no gnome-power-manager. I've checked ps for sleepd or powerdevil, nothing.


dmesg |grep sleep shows:


[ 5453.702143] ACPI: Preparing to enter system sleep state S3
[ 5453.726769] cache: parent cpu1 should not be sleeping
[ 5453.727509] ACPI: Waking up from system sleep state S3
[10865.469908] ACPI: Preparing to enter system sleep state S3
[10865.492327] cache: parent cpu1 should not be sleeping
[10865.493067] ACPI: Waking up from system sleep state S3
[16297.564114] ACPI: Preparing to enter system sleep state S3
[16297.586192] cache: parent cpu1 should not be sleeping
[16297.586924] ACPI: Waking up from system sleep state S3

Anybody know where I can configure this thing?


Also, a few years back (I think it was on Ubuntu 14 or so) I remember I used to have a power management package for the command line, which was really nice. You could set sleep, hibernate, etc. time in a config file, and you could also create conditions for no sleep... worked like a charm. I remember I used to have a condition where the system wouldn't sleep if a program called "stayawake" was running. So when I needed it to stay on, I would just run a blank endless script called "stayawake" and that was that. But, I can't remember what package it was. Can anyone refresh my memory?


More From » suspend

 Answers
4

Found it! Turns out it was the oldest trick in the book: logind. I'd been there a whole bunch of times when tweaking sleep events on laptops, I hadn't thought of going there until today.


I happened to be looking at the PC, and at that precise moment it went to sleep. So I brought it back up, looked through syslog, and saw:


Jul 12 13:01:07 mediapc systemd[1]: Reached target Sleep.
Jul 12 13:01:07 mediapc systemd[1]: Starting Suspend...

A Google search for "systemd reached target sleep" took me to this blogpost from 2018, on Debian. But Debian's a relative of Ubuntu, so I though I'd give it a read.


Then I checked /etc/systemd/logind.conf and found:


IdleAction=suspend
IdleActionSec=90min

Another look through the syslog file, I found that sure enough, the sleep events were ocurring at 90 minute intervals. So I gave it a savage tweak:


IdleAction=poweroff
IdleActionSec=10min

And rebooted. And sure enough, 10 minutes later, the system powered off.


Finally I set the lines in /etc/systemd/login.conf to:


IdleAction=suspend
IdleActionSec=180min

So now my system sleeps after 3 hours of inactivity.


The other power management package I was looking for, I believe, was powernap. That one lets you not only set sleep event times, but also events to keep from sleeping. So, in the future I'll probably end up disabling the event in logind, and letting powernap do all the handling.


[#3069] Tuesday, April 25, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
erettor

Total Points: 303
Total Questions: 121
Total Answers: 103

Location: Colombia
Member since Mon, May 2, 2022
2 Years ago
;