The default kernel OOM killer reacts too late for desktop use — by the time it fires, the system is deep in swap thrash and unresponsive. systemd-oomd is better but still too conservative for desktops with lots of browser tabs.
earlyoom monitors memory and swap usage and kills processes before the system becomes unusable.
# Fedora / rpm-ostree
sudo dnf install earlyoom
# or: rpm-ostree install earlyoom
# Debian/Ubuntu
sudo apt install earlyoom
# IMPORTANT: rpm-ostree doesn't auto-enable services after install
sudo systemctl enable --now earlyoomEdit /etc/default/earlyoom:
EARLYOOM_ARGS="-m 4 -s 50 --prefer '(Web Content|Isolated Web)' --avoid '(gnome-shell|gnome-session|Xwayland|pipewire)'"| Flag | Effect |
|---|---|
-m 4 |
Trigger when available RAM drops below 4% (~1.2 GB on 32 GB) |
-s 50 |
Also trigger when swap usage exceeds 50% — catches swap thrash before it freezes the system |
--prefer |
Kill browser content processes first (they're recoverable — just reload the tab) |
--avoid |
Protect desktop session processes (killing these logs you out) |
The key addition over the Fedora default is -s 50 — without it, earlyoom only watches RAM, and the system can become unresponsive from swap thrashing while still having "enough" RAM by earlyoom's measure.
systemctl status earlyoom
journalctl -u earlyoom # see kill history
journalctl -u earlyoom -f # watch livesystemd-oomd uses PSI (Pressure Stall Information) metrics and cgroup-level memory limits, which is architecturally cleaner but reacts slower in practice. On a desktop with browsers eating 20+ GB of swap, earlyoom's simple percentage-based approach triggers sooner and prevents the 30-60 second freezes that make you reach for the power button.