In Ubuntu Server and other systemd-based Linux distributions, systemd-hibernate.service is a core power management daemon responsible for transitioning the host machine into an ACPI S4 sleep state (Suspend-to-Disk). During hibernation, the kernel halts all user-space processes, writes the entire contents of RAM to the swap partition, and physically powers off the hardware. While useful for laptops to preserve session state without consuming battery, this service introduces a catastrophic availability and data integrity liability in headless server environments, highly available clusters, or immutable infrastructure deployments. If a server is inadvertently triggered to hibernate (via a stray ACPI event or rogue command), it will suffer a massive I/O spike, drop all network connections, and require a full BIOS POST sequence and state resume to become available again, severely breaching uptime SLAs.
This guide explains how to completely disable the systemd-hibernate service in Ubuntu Server, enforcing an absolute block on S4 sleep states and ensuring the server’s uptime and network availability remain strictly uninterrupted.
Stop and Mask the systemd-hibernate Service
Because hibernation is deeply integrated into the systemd-logind power management framework and can be invoked dynamically by various targets (like hibernate.target), a simple configuration tweak is insufficient to guarantee the kernel will never transition to an S4 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-hibernate.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-hibernate.service - Optional but recommended: To guarantee that the parent target cannot be reached either, mask the associated target unit:
sudo systemctl mask hibernate.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-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-hibernate.service
Systemd will return a fatal error stating that the unit is masked (e.g., Failed to start systemd-hibernate.service: Unit systemd-hibernate.service is masked). Furthermore, running systemctl status systemd-hibernate.service will show the service state as masked. You can further test this by running sudo systemctl hibernate; the command will instantly fail, confirming the complete neutralization of the ACPI S4 transition daemon.