Image

Knowledge base → Disabling automatic workstation sleep on Debian 12

[Virtual servers]
Date of publication: 05.03.2024

When using the Debian 12 operating system in workstation mode with a desktop (Gnome or KDE) installed, by default the operating system goes into sleep mode when there is no user activity.

Since our goal is to make the workstation always accessible over the network, it is necessary to disable the operating system from going into sleep mode in the absence of user activity.

1. Normal (old way)

systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

2. Recommended (new method)

Create a file:

mkdir -p /etc/systemd/sleep.conf.d/
touch /etc/systemd/sleep.conf.d/nosuspend.conf

The following content:

[Sleep]
AllowSuspend=no
AllowHibernation=no
AllowSuspendThenHibernate=no
AllowHybridSleep=no

Done, now the workstation will work around the clock in server mode.





No Comments Yet