In Ubuntu Server and other systemd-based Linux distributions, systemd-hybrid-sleep.service is an advanced power management daemon designed to execute a two-stage transition. When invoked, it suspends the machine to RAM (S3) for instant resume, but also simultaneously writes the system state to the swap partition (S4 / hibernation). If the battery dies or power is lost during S3, the machine safely resumes from S4. While this offers excellent resilience for consumer laptops, it introduces a catastrophic availability and I/O latency liability in headless server environments, highly available clusters, or immutable infrastructure deployments. If a server is inadvertently triggered into a hybrid sleep state, it will suffer a massive storage I/O spike (writing gigabytes to disk) while simultaneously dropping all network connections and terminating active database transactions.
This guide explains how to completely disable the systemd-hybrid-sleep service in Ubuntu Server, enforcing an absolute block on this complex sleep state and ensuring the server’s uptime and network availability remain strictly uninterrupted.
Stop and Mask the systemd-hybrid-sleep Service
Because hybrid sleep is deeply integrated into the systemd-logind power management framework and can be invoked dynamically by various targets (like hybrid-sleep.target) or ACPI events, a simple configuration tweak is insufficient to guarantee the kernel will never transition to this 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-hybrid-sleep.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-hybrid-sleep.service - Optional but recommended: To guarantee that the parent target cannot be reached either, mask the associated target unit:
sudo systemctl mask hybrid-sleep.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/Disk 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-hybrid-sleep.service
Systemd will return a fatal error stating that the unit is masked (e.g., Failed to start systemd-hybrid-sleep.service: Unit systemd-hybrid-sleep.service is masked). Furthermore, running systemctl status systemd-hybrid-sleep.service will show the service state as masked. You can further test this by attempting to run sudo systemctl hybrid-sleep; the command will instantly fail, confirming the complete neutralization of the ACPI transition daemon.