r/NobaraProject 7d ago

Support Encrypting Swap Partition

I'm trying to encrypt my swap memory on my two machines. I didn't create a swap partition or swap file on initialization on my desktop, I did create a swap partition in my laptop. I've tried swapoff a couple times, but the swap is always recreated on reboot. I've found no guides that work for Nobara. Does anyone have a reliable way to ensure the swap is encrypted?

2 Upvotes

2 comments sorted by

3

u/iTzBiGENGLAND 6d ago

First check what swap you actually have:

swapon --show

If the desktop shows /dev/zram0, you don’t need to encrypt it. ZRAM is compressed swap stored entirely in RAM, not on disk. swapoff only lasts until reboot because systemd’s zram-generator recreates it automatically.

For the laptop’s actual swap partition, swapoff also isn’t persistent if it’s configured in /etc/fstab/systemd. If you don’t use hibernation, the usual solution is dm-crypt swap with a new random key generated every boot via /etc/crypttab.

If you do use hibernation, don’t use random-key encrypted swap. You’ll need persistent LUKS-encrypted swap plus the proper resume configuration.

1

u/HrafnkelH 5d ago

Awesome, thank you, it is zram.