Affected versions: Debian 12

πŸ“– ~1 min read

Table of contents
  1. Symptom & Impact
  2. Environment & Reproduction
  3. Root Cause Analysis
  4. Quick Triage
  5. Step-by-Step Diagnosis
  6. Solution – Primary Fix
  7. Solution – Alternative Approaches
  8. Verification & Acceptance Criteria
  9. Rollback Plan
  10. Prevention & Hardening
  11. Related Errors & Cross-Refs
  12. References & Further Reading

Symptom & Impact

Processes are terminated by OOM killer during peaks because swap is absent or disabled.

Environment & Reproduction

Frequent on small VMs or systems with swap turned off for performance tuning.

free -h
swapon --show
dmesg | grep -i -E 'oom|killed process' | tail -n 20

Root Cause Analysis

Insufficient memory headroom and no effective swap fallback during pressure spikes.

Quick Triage

Validate swap availability and vm swappiness settings.

cat /proc/meminfo | grep -E 'MemAvailable|SwapTotal|SwapFree'
sysctl vm.swappiness
vmstat 1 5

Step-by-Step Diagnosis

Identify pressure patterns and highest resident memory consumers.

ps -eo pid,comm,%mem,%cpu --sort=-%mem | head -n 20
grep -RIn "oom|memory" /var/log 2>/dev/null | tail -n 30
cat /etc/fstab
Illustrative mockup for debian-12 β€” terminal_or_shell
Inspecting memory and swap pressure β€” Illustrative mockup β€” Progressive Robot

Solution – Primary Fix

Create or re-enable swap and tune swappiness for balanced behavior.

Still having issues? Our IT Solutions & Services team can diagnose and resolve this for you. Get in touch for a free consultation.

sudo fallocate -l 4G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
Illustrative mockup for debian-12 β€” log_or_config
Recreating swap and tuning vm settings β€” Illustrative mockup β€” Progressive Robot

Solution – Alternative Approaches

Use zram swap where disk-based swap is constrained.

sudo apt install -y zram-tools
sudo systemctl enable --now zramswap.service
swapon --show

Verification & Acceptance Criteria

Swap is active and OOM events stop under representative load tests.

swapon --show
free -h
dmesg | grep -i oom | tail -n 10

Rollback Plan

Disable temporary swapfile and remove fstab entry if issues arise.

sudo swapoff /swapfile
sudo rm -f /swapfile
sudo sed -i '//swapfile/d' /etc/fstab

Prevention & Hardening

Right-size memory, set alerts, and test peak workload behavior regularly.

sysctl vm.swappiness
free -h
vmstat 1 5

Can coincide with memory leaks and container resource-limit misconfiguration.

Related tutorial: View the step-by-step tutorial for Debian 12.

View all Debian 12 tutorials on the Tutorials Hub β†’

Browse all common problems & solutions on the Tutorials Hub.

References & Further Reading

Debian memory management and swap tuning documentation.

Need Expert Help?

If you cannot resolve this yourself, our team offers hands-on Server Management, Managed IT Services, and flexible Support Plans. Contact us today β€” we respond within one business day.