Public bug reported:

## Summary

I propose enabling `systemd-oomd` by default in Ubuntu Desktop and
Ubuntu Server to improve system stability and responsiveness during
memory pressure situations.

## Problem

When Ubuntu systems run low on memory, the kernel's OOM killer often
responds too late, after the system has already become unresponsive.

**On Desktop:** Users experience prolonged freezes where the desktop
becomes unusable, sometimes requiring a hard reboot. This is a common
pain point, especially on systems with 8GB RAM or less running memory-
intensive workloads like browsers with many tabs, IDEs, or virtual
machines.

**On Server:** Memory exhaustion can lead to service degradation, failed
health checks, and cascading failures. The kernel OOM killer may
terminate critical services unpredictably, causing outages.
Administrators often discover problems only after the damage is done.

## Solution

`systemd-oomd` is a userspace OOM killer that:

- **Acts proactively** — monitors memory pressure via PSI (Pressure Stall 
Information) and intervenes before the system becomes unresponsive
- **Makes smarter decisions** — uses cgroup information to kill the appropriate 
process rather than random selection
- **Provides better UX** — keeps the desktop responsive during memory pressure
- **Improves server reliability** — allows services to configure their own OOM 
policies via systemd unit options (`ManagedOOMSwap=`, 
`ManagedOOMMemoryPressure=`)
- **Enables graceful degradation** — gives administrators control over which 
services are expendable vs. critical
- **Is mature and battle-tested** — Fedora has shipped it by default since 
Fedora 34 (2021)

## Server-Specific Benefits

- **Granular control**: Services can opt-in or opt-out via systemd unit 
configuration
- **Predictable behavior**: Administrators can define which services should be 
killed first under memory pressure
- **Better observability**: Actions are logged to the journal with clear 
reasoning
- **Container-aware**: Works well with containerized workloads using cgroups v2
- **No external dependencies**: Part of systemd, no additional monitoring stack 
required

Example unit configuration:
```ini
[Service]
ManagedOOMMemoryPressure=kill
ManagedOOMMemoryPressureLimit=80%
```

## Precedent

- **Fedora Workstation**: Enabled by default since version 34
- **Fedora Server**: Enabled by default since version 34
- **systemd upstream**: Actively maintained as part of the core systemd project

## Technical Details

- Package: `systemd-oomd`
- Memory footprint: ~2MB RSS
- Dependencies: Already satisfied on standard Ubuntu installations
- Configuration: Works out of the box with sensible defaults
- Requires: cgroups v2 (default in Ubuntu since 21.10)


## Request

Consider including `systemd-oomd` in the default Ubuntu Desktop and
Ubuntu Server installations, enabled by default.

I'm happy to help with testing or provide additional information.

** Affects: ubuntu-meta (Ubuntu)
     Importance: Undecided
         Status: New

** Description changed:

- **Title:** Proposal: Enable systemd-oomd by Default in Ubuntu Desktop
- and Server
- 
- **Category:** Desktop, Server
- 
- ---
  
  ## Summary
  
  I propose enabling `systemd-oomd` by default in Ubuntu Desktop and
  Ubuntu Server to improve system stability and responsiveness during
  memory pressure situations.
  
  ## Problem
  
  When Ubuntu systems run low on memory, the kernel's OOM killer often
  responds too late, after the system has already become unresponsive.
  
  **On Desktop:** Users experience prolonged freezes where the desktop
  becomes unusable, sometimes requiring a hard reboot. This is a common
  pain point, especially on systems with 8GB RAM or less running memory-
  intensive workloads like browsers with many tabs, IDEs, or virtual
  machines.
  
  **On Server:** Memory exhaustion can lead to service degradation, failed
  health checks, and cascading failures. The kernel OOM killer may
  terminate critical services unpredictably, causing outages.
  Administrators often discover problems only after the damage is done.
  
  ## Solution
  
  `systemd-oomd` is a userspace OOM killer that:
  
  - **Acts proactively** — monitors memory pressure via PSI (Pressure Stall 
Information) and intervenes before the system becomes unresponsive
  - **Makes smarter decisions** — uses cgroup information to kill the 
appropriate process rather than random selection
  - **Provides better UX** — keeps the desktop responsive during memory pressure
  - **Improves server reliability** — allows services to configure their own 
OOM policies via systemd unit options (`ManagedOOMSwap=`, 
`ManagedOOMMemoryPressure=`)
  - **Enables graceful degradation** — gives administrators control over which 
services are expendable vs. critical
  - **Is mature and battle-tested** — Fedora has shipped it by default since 
Fedora 34 (2021)
  
  ## Server-Specific Benefits
  
  - **Granular control**: Services can opt-in or opt-out via systemd unit 
configuration
  - **Predictable behavior**: Administrators can define which services should 
be killed first under memory pressure
  - **Better observability**: Actions are logged to the journal with clear 
reasoning
  - **Container-aware**: Works well with containerized workloads using cgroups 
v2
  - **No external dependencies**: Part of systemd, no additional monitoring 
stack required
  
  Example unit configuration:
  ```ini
  [Service]
  ManagedOOMMemoryPressure=kill
  ManagedOOMMemoryPressureLimit=80%
  ```
  
  ## Precedent
  
  - **Fedora Workstation**: Enabled by default since version 34
  - **Fedora Server**: Enabled by default since version 34
  - **systemd upstream**: Actively maintained as part of the core systemd 
project
  
  ## Technical Details
  
  - Package: `systemd-oomd`
  - Memory footprint: ~2MB RSS
  - Dependencies: Already satisfied on standard Ubuntu installations
  - Configuration: Works out of the box with sensible defaults
  - Requires: cgroups v2 (default in Ubuntu since 21.10)
  
- ## Potential Concerns
- 
- | Concern | Mitigation |
- |---------|------------|
- | Unexpected process termination | systemd-oomd logs actions to the journal; 
users/admins can review what was killed and why |
- | Resource overhead | Minimal (~2MB RAM); negligible compared to the benefit |
- | Conflicts with kernel OOM | They complement each other; systemd-oomd acts 
first, kernel OOM remains as fallback |
- | Server workloads need stability | Services can configure their own 
policies; critical services can opt-out |
- | Existing monitoring solutions | systemd-oomd complements rather than 
replaces external monitoring |
  
  ## Request
  
  Consider including `systemd-oomd` in the default Ubuntu Desktop and
  Ubuntu Server installations, enabled by default.
  
  I'm happy to help with testing or provide additional information.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2139289

Title:
  Proposal: Enable systemd-oomd by Default in Ubuntu Desktop and Server

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ubuntu-meta/+bug/2139289/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to