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.





sleepy
07.10.2025 17:28
Thanks for your solution it worked.
Why did anyone working with Debian 12 think it was a good idea for a SERVER to go to sleep????
Anyway thanks for your help.
SYNAY support
07.10.2025 17:35
This appears after installing the graphical interface, and since this is the case, it is no longer considered a server, but a workstation. This is how we understood it..