i everyone,
I'm setting up a brand new Raspberry Pi 5 (8GB) with the latest 64-bit Raspberry Pi OS Lite ("Debian Trixie" port, 2025-10-01 release).
My goal is to run several resource-intensive applications on my Pi. To better manage my system's memory and free up all 8GB of RAM for these tasks, I would like to permanently disable the default 2GB zram swap.
The problem is, this swap is extremely persistent. Here is what my system shows:
free -h
total used free shared buff/cache available
Mem: 7.9Gi 236Mi 7.5Gi 13Mi 181Mi 7.6Gi
Swap: 2.0Gi 0B 2.0Gi
swapon --show
NAME TYPE SIZE USED PRIO
/dev/zram0 partition 2G 0B 100
systemctl --type swap
UNIT LOAD ACTIVE SUB DESCRIPTION
dev-zram0.swap loaded active active rpi-swap managed swap device (zram+file)
Here is everything I have already tried that has FAILED:
sudo systemctl disable --now dev-zram0.swap
Result: The swap is still 2GB on reboot.
sudo systemctl mask dev-zram0.swap
Result: This was a disaster. On reboot, a fallback system took over and created a 4GB swap. I have since unmasked this.
sudo nano /boot/firmware/cmdline.txt and adding zram.num_devices=0
Result: This parameter was completely ignored on reboot. The 2GB swap was still there.
sudo nano /etc/systemd/zram-generator.conf and adding [zram0]\nzram-size = 0
Result: This config file was also ignored on reboot.
sudo crontab -e and adding @reboot /usr/sbin/swapoff -a
Result: The swap is still active on boot; this command seems to run too late.
sudo apt-get purge -y zram-tools / zram-config
Result: Neither of these packages is installed, so they aren't the cause.
Checking /etc/default/rpi-swap
Result: This file is empty on my system.
It seems this new "rpi-swap" service on Debian Trixie is hard-coded in a new way.
What is the correct, official,or even an unofficial method on this new OS to permanently set the zram swap size to 0?
Thanks in advance,
phyryos
I'm setting up a brand new Raspberry Pi 5 (8GB) with the latest 64-bit Raspberry Pi OS Lite ("Debian Trixie" port, 2025-10-01 release).
My goal is to run several resource-intensive applications on my Pi. To better manage my system's memory and free up all 8GB of RAM for these tasks, I would like to permanently disable the default 2GB zram swap.
The problem is, this swap is extremely persistent. Here is what my system shows:
free -h
total used free shared buff/cache available
Mem: 7.9Gi 236Mi 7.5Gi 13Mi 181Mi 7.6Gi
Swap: 2.0Gi 0B 2.0Gi
swapon --show
NAME TYPE SIZE USED PRIO
/dev/zram0 partition 2G 0B 100
systemctl --type swap
UNIT LOAD ACTIVE SUB DESCRIPTION
dev-zram0.swap loaded active active rpi-swap managed swap device (zram+file)
Here is everything I have already tried that has FAILED:
sudo systemctl disable --now dev-zram0.swap
Result: The swap is still 2GB on reboot.
sudo systemctl mask dev-zram0.swap
Result: This was a disaster. On reboot, a fallback system took over and created a 4GB swap. I have since unmasked this.
sudo nano /boot/firmware/cmdline.txt and adding zram.num_devices=0
Result: This parameter was completely ignored on reboot. The 2GB swap was still there.
sudo nano /etc/systemd/zram-generator.conf and adding [zram0]\nzram-size = 0
Result: This config file was also ignored on reboot.
sudo crontab -e and adding @reboot /usr/sbin/swapoff -a
Result: The swap is still active on boot; this command seems to run too late.
sudo apt-get purge -y zram-tools / zram-config
Result: Neither of these packages is installed, so they aren't the cause.
Checking /etc/default/rpi-swap
Result: This file is empty on my system.
It seems this new "rpi-swap" service on Debian Trixie is hard-coded in a new way.
What is the correct, official,or even an unofficial method on this new OS to permanently set the zram swap size to 0?
Thanks in advance,
phyryos
Statistics: Posted by phyryos — Sun Nov 16, 2025 5:50 am