Skip to content

Troubleshoot Linux Swap That Does Not Activate

Admin
November 20, 2026
5 min read
Intermediate
πŸ’» Target OS: Ubuntu 26.04 LTS / RHEL 10

Before you begin

  • Applies to:Ubuntu and Red Hat Enterprise Linux (RHEL) hosts running systemd.
  • Where to start:Open a shell on the affected host and check its current swap and memory state before making changes.
  • What you need:Confirm whether the host should use a swap device, swap file, compressed RAM swap, or no swap. Have the intended configuration available for comparison.
Guide tools
Guide tools
0/0 Steps (0%)

Troubleshooting Steps

01

Check whether swap is unavailable or merely idle

Start here

Look at the active devices and total swap. Zero Used with nonzero Total means swap is available and idle. No listed devices and zero Total indicate no active swap in this view.

What you should see Β· At least one swap source appears and the total swap is greater than zero. Zero use is normal when swap is idle.

If you see something else Β· If the total is zero, go to Step 2 and check activation at boot. If host swap is active but the workload cannot use it, go to Step 4.

Terminal window
swapon --show
free -h
02

Inspect boot-time activation

Review the expected swap units and boot messages. Compare a failed unit with the intended device or file. A system that uses a zram generator can have swap without a matching fstab entry.

Terminal window
systemctl list-units --all --type=swap
sudo journalctl -b -k --grep='swap|zram' --no-pager
03

Compare the configured source with the actual host

For fstab-backed swap, compare entries with actual device UUIDs and the expected file path. If a swap file is rejected, check its backing filesystem and the kernel error. Filesystem support and allocation requirements differ. Preserve the existing file until you know the cause.

Terminal window
findmnt --fstab --types swap
lsblk -o NAME,TYPE,FSTYPE,UUID,MOUNTPOINTS
04

Check workload constraints when host swap is healthy

For a cgroup v2 workload, verify its effective swap limit and parent policy when host swap exists but the workload still cannot use it. A systemd service may expose MemorySwapMax. The unit property alone does not establish whether parent limits also apply.

Terminal window
systemctl show example.service -p ControlGroup -p MemorySwapMax
05

Restore only the intended activation

For a confirmed fstab, unit, or generator error, have its owner restore the approved setting and validate the backing device or file first. Follow the platform-supported activation procedure and avoid enabling every discovered swap source. Keep a copy of the old configuration.

06

Verify visibility and stability

Verify

Confirm the intended device or file is listed and the unit is active where applicable. Compare memory pressure through the original workload. If rollback requires disabling a now-used swap area, assess memory headroom and schedule that change rather than forcing it.

Decide What to Do Next

FindingNext action
Nonzero total but zero usedSwap is active. Review actual workload pressure if investigating memory.
No active swap and a failed unitCheck the backing device or file before activating anything.

References

Comments