#1029473 gnome-session: Automatic Suspend should not be enabled by default

#1029473#5
Date:
2023-01-23 01:19:44 UTC
From:
To:
Rather annoying issue. In my opinion it might even deserve "grave" severity.

It appears in Power settings, Automatic Suspend is On by default (with 20
minutes delay).

Here is the problem.

I am on a desktop PC, always on, and have programs in a background that
must run non stop or for many hours (i.e. data acquisition / monitoring,
long running scripts, simulations, etc). I often use Live-CD (custom
built Debian iso using live-build), so I relay on defaults a lot. But
suspend to RAM is often broken on computers I use, and it often never
recovers, needing me to power cycle the computer, or even disconnect
power, waiting and connect power again. (long pressing power button does
not help). And even if it works, often a state of USB devices is lost,
which I have few (including the root file system).

So last time I used my system, after almost 10 hours of work, I went for
a break and some food, while some processes were running in a background.
Then came back about 30 minutes later, system was not responding
(monitors off, USB devices off, keyboard not doing anything), and power
button was blinking. Pressing it did not help, and needed to remove power
(at power supply), and connect back. Many hours of work lost.

I do not normally use Gnome Shell (I normally use MATE), but I accidently
logged into Gnome Shell, and wanted to give it a try. First time this
occured, I was really surprised, and I was thinking maybe it was a kernel
bug (I often use rc kernels). But it happened again on another kernel
version.

As I use Live-CD quite often, just changing a value is not an option
manually, as these settings will be lost after reboot. Not to mention
they are not intuitive for a novice user of Gnome Shell.

I do not understand why Automatic Suspend would be On by default.
Especially if the default power mode profile is Balanced (not Power
Saver).

A way better idea would be to detect a computer form factor, and power
source. If it is battery (i.e. not AC and not charging), then maybe do
enable a suspend. Otherwise no.

I also do not understand why Screen Blank in Power Saving Options is
"Never". A default should be few minutes.


Regards,
Witold

#1029473#10
Date:
2023-01-23 10:24:17 UTC
From:
To:
Control: retitle -1 gnome-settings-daemon: automatic suspend after 20 minutes is undesired by some users
Control: reassign -1 gnome-settings-daemon
Control: affects -1 + gnome-session
Control: tags -1 + upstream wontfix

This is intentional and has been true for about 5 years (in particular,
this was already the case in Debian 11, and most likely Debian 10 as well).
The automatic suspend became the default in upstream commit
<https://gitlab.gnome.org/GNOME/gnome-settings-daemon/-/commit/2fdb48fa>
which mentions that this behaviour is required by national regulations
for personal computers sold in the EU and USA (with no distinction made
between laptop and desktop systems).

Obviously Debian doesn't sell computers with Debian and GNOME
preinstalled, but it would seem inconsistent with our social/environmental
responsibilities if we disabled a power-saving feature like this by
default, particularly when that would make it illegal for third parties
to sell computers with our OS preinstalled in the countries where a lot
of our contributors are based, and doubly so during an ongoing worldwide
climate crisis and a Europe-wide energy shortage.

I would suggest using the system's built-in facilities to delay suspend
while running these tasks. If you wrap a long-running command like this:

    systemd-inhibit ./my-long-running-script

then that should prevent the system from suspending to RAM during these
long-running tasks. This is available in a default installation or on
live media (because it's part of our default init system).
screen is always blanked and locked before suspending anyway. Of course,
if you adjust the settings to disable suspend-to-RAM, then it will be
necessary to change adjacent settings to match.

There is probably a kernel command-line option that can be used to
disable the ability to suspend-to-RAM, as a workaround for hardware where
the ability to suspend is present but non-functional, but I don't know it.

    smcv

#1029473#25
Date:
2023-01-23 11:03:06 UTC
From:
To:
Hello,

Humbly I would suggest to install the "espresso" extension 
https://extensions.gnome.org/extension/4135/espresso/

#1029473#30
Date:
2023-01-23 20:07:03 UTC
From:
To:
Hi.

Thank you Simon for in depth explanation.

I fully agree a presold desktop and laptops should have this enabled by
default. I was not aware it is a legal requirement in EU and USA, but
that makes sense.

Considering it is rather hard to make any automatic distinctions of
system type, I guess indeed there is no way to change a default to work
for everybody.

I will consider some workaround on my side, or adjusting default in my
live-build build itself (as long as it is used only by me).

Regards,
Witold

#1029473#35
Date:
2023-01-23 20:46:50 UTC
From:
To:
Another workaround is to create a file named something like
/usr/share/glib-2.0/schemas/90_local_override.gschema.override

with contents
# Custom local override for https://bugs.debian.org/1029473
[org.gnome.settings-daemon.plugins.power]
sleep-inactive-ac-timeout = 0

then run
sudo glib-compile-schemas /usr/share/glib-2.0/schemas

Ubuntu basically does this, although I'm not sure whether it's a good
idea for Ubuntu to be doing it.

Thank you,
Jeremy Bicha