In Ubuntu Server and other systemd-based Linux distributions, systemd-suspend.service is a core power management daemon responsible for transitioning the host machine into an ACPI S3 sleep state (Suspend-to-RAM). While highly desirable for consumer laptops and desktop workstations to conserve battery life, this service introduces a catastrophic availability and stability liability in headless server environments, highly available clusters, or immutable infrastructure deployments. If a server is inadvertently triggered to suspend (either via a stray ACPI event, a misconfigured power button, or a rogue user command), it will instantly drop off the network, sever all active SSH connections, drop database transactions, and require physical (or out-of-band management) intervention to wake back up.
This guide explains how to completely disable the systemd-suspend service in Ubuntu Server, enforcing an absolute block on S3 sleep states and ensuring the server’s uptime and network availability remain strictly uninterrupted.
Stop and Mask the systemd-suspend Service
Because systemd-suspend is deeply integrated into the systemd-logind power management framework and can be invoked dynamically by various targets (like suspend.target), a simple configuration tweak in /etc/systemd/logind.conf is fundamentally insufficient to guarantee the kernel will never transition to an S3 state. To enforce an absolute cryptographic block, we must explicitly mask the unit.
- Log into your Ubuntu Server via SSH using an account with
sudoprivileges. - Stop the service to clear any active processes (though it generally only runs momentarily during state transitions):
sudo systemctl stop systemd-suspend.service - For absolute certainty, explicitly mask the service unit. This symlinks the unit file to
/dev/null, creating a hard cryptographic block against it being invoked dynamically by ACPI events, dbus messages, or manual user commands:sudo systemctl mask systemd-suspend.service - Optional but recommended: To guarantee that the parent target cannot be reached either, mask the associated target unit:
sudo systemctl mask suspend.target
Verify the Service Lockdown
By masking the service and its target, you guarantee that systemd will completely reject any attempt to transition the host hardware into a Suspend-to-RAM state, optimizing the OS strictly for always-on server operations.
To verify the lockdown is successful, attempt to start the service manually:
sudo systemctl start systemd-suspend.service
Systemd will return a fatal error stating that the unit is masked (e.g., Failed to start systemd-suspend.service: Unit systemd-suspend.service is masked). Furthermore, running systemctl status systemd-suspend.service will show the service state as masked. You can further test this by running sudo systemctl suspend; the command will instantly fail, confirming the complete neutralization of the ACPI S3 transition daemon.