There are many changes happening in Debian versions, so software suspend (sleep) works in various ways in the different versions.
For obvious reasons, the software suspend cannot be allowed to happen on servers that are supposed to be available 24/7. After software upgrades, care needs to be taken to disable the suspend function. This is especially important when building new production servers.
I found a file called:
/etc/systemd/sleep.conf
and it had four entries in it. Using nano, I activated lines in it (by removing the # sign commenting them out) and changed the “yes” to “no” leaving these:
[Sleep] AllowSuspend=no AllowHibernation=no AllowSuspendThenHibernate=no AllowHybridSleep=no
Disabling suspend and hibernation
For systems which should never attempt any type of suspension, these targets can be disabled at the systemd level with the following:
systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
Should you want to re-enable hibernate and suspend you can use the following command:
systemctl unmask sleep.target suspend.target hibernate.target hybrid-sleep.target
I have found information on the web indicating an alternative approach for disabling suspend and hibernation is to create this file (note that I used nano to do this):
nano /etc/systemd/sleep.conf.d/nosuspend.conf
and enter this in it:
[Sleep] AllowSuspend=no AllowHibernation=no AllowSuspendThenHibernate=no AllowHybridSleep=no
Here is a command that can allow you to turn suspend on (which you definitely wouldn’t want to do this on a server):
systemctl suspend