From 7937a7c0d25397a3abbc446c98031647126a11bf Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Tue, 25 Mar 2025 22:34:46 -0700 Subject: [PATCH] power: Disable sleep and hibernate on the system Closes: #2503 - FreedomBox is a server that is typically always running. If applications such as GNOME desktop environment are installed, they could, by default, cause system to sleep or hibernate after a period of idleness (based on peripheral activity). To ensure that services are always available over the network, prevent all such applications from sending the system to sleep/hibernate. - Other types of sleep such as hybrid sleep and suspend and hibernate are also automatically disabled by systemd if either suspend or hibernate are disabled. Tests: - Without the changes, install GNOME. In gdm login screen or in desktop environment, after 20 minutes (default) the system goes to sleep. - Create the file in the patch with the appropriate directory in a production FreedomBox machine. Run 'systemctl daemon-reload'. After this, running 'systemctl suspend' or 'systemctl hibernate' will return an error that the operation is not supported. In GDM, the suspend button does not appear. In GNOME desktop environment after login, the suspend button does not appear. Even after the 15-20 minute period, the system does not go to sleep. Reviewed-by: James Valleroy --- .../lib/systemd/sleep.conf.d/50-freedombox.conf | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 plinth/modules/power/data/usr/lib/systemd/sleep.conf.d/50-freedombox.conf diff --git a/plinth/modules/power/data/usr/lib/systemd/sleep.conf.d/50-freedombox.conf b/plinth/modules/power/data/usr/lib/systemd/sleep.conf.d/50-freedombox.conf new file mode 100644 index 000000000..4f8dc00cc --- /dev/null +++ b/plinth/modules/power/data/usr/lib/systemd/sleep.conf.d/50-freedombox.conf @@ -0,0 +1,14 @@ +# SPDX-License-Identifier: AGPL-3.0-or-later +# +# FreedomBox is a server that is typically always running. If applications such +# as GNOME desktop environment are installed, they could, by default, cause +# system to sleep or hibernate after a period of idleness (based on peripheral +# activity). To ensure that services are always available over the network, +# prevent all such applications from sending the system to sleep/hibernate. +# +# To override the configuration in this file, a system administration can copy +# this file to /etc/systemd/sleep.conf.d/90-my.conf (or /etc/systemd/sleep.conf) +# and set the values to 'yes'. +[Sleep] +AllowSuspend=no +AllowHibernation=no