In modern Ubuntu Server releases, systemd-oomd.service is an aggressive, user-space Out-Of-Memory (OOM) killer daemon. It monitors system memory pressure using the kernel’s PSI (Pressure Stall Information) interface and proactively kills resource-intensive processes before the traditional, slower kernel OOM killer is forced to intervene. While this is highly beneficial on desktop systems (preventing the UI from freezing when a web browser consumes all RAM), it can be catastrophic on dedicated servers. systemd-oomd is notorious for preemptively terminating critical database engines (like PostgreSQL or MySQL) or heavy containerized workloads under transient load spikes, prioritizing overall OS responsiveness over the survival of the server’s primary application.
This guide explains how to completely disable the systemd-oomd.service in Ubuntu Server, ensuring that memory management is left strictly to the kernel’s traditional, last-resort OOM killer.
Stop and Mask the systemd-oomd Service
Because this service is tightly integrated into the systemd ecosystem and can be respawned by dependencies, we must stop, disable, and explicitly mask it to prevent any accidental activation.
- Log into your Ubuntu Server via SSH using an account with
sudoprivileges. - First, stop the service immediately if it is currently running:
sudo systemctl stop systemd-oomd.service - Next, disable it to prevent it from starting automatically on boot:
sudo systemctl disable systemd-oomd.service - Finally, to guarantee that systemd treats the unit as a black hole and never attempts to execute it (even during package upgrades), mask it entirely:
sudo systemctl mask systemd-oomd.service
Verify the Service Lockdown
By masking the service, you have instructed systemd to symlink the unit file to /dev/null, effectively removing the user-space OOM killing logic from the operating system.
To verify the lockdown is successful, run the following command to check the status of the service:
systemctl status systemd-oomd.service
The output will clearly state that the service is masked. Additionally, executing the command oomctl (the CLI tool used to interface with systemd-oomd) will fail and return an error stating that it cannot connect to the daemon. Your server will now rely solely on the native Linux kernel OOM killer, which generally only triggers when the system is genuinely out of swap and physical memory, rather than preemptively reacting to PSI pressure metrics.