You might want to look into zswap as well.
When your system starts swapping it will also start to crawl. Just set up an oom protector, then when you run out of ram, the system will kill the culprit automatically and your system will never crawl, and you get a notification what's happened and why.
Use systemd-zram-generator. The process is explain in the DebianWiki and the ArchWiki and this random blog, but it boils down to just a few commands you need to run:
$ apt install systemd-zram-generator
$ sudoedit /etc/systemd/zram-generator.conf
[zram0]
zram-size = min(ram, 8192)
compression-algorithm = zstd
$ sudo systemctl daemon-reload && sudo systemctl start systemd-zram-setup@zram0.service
You can tweak the settings above. Fedora recommends using zram-size = min(ram, 8192), which would correspond to 8GB ZRAM in your case. CachyOS uses a less conservative config with zram-size = ram.
To confirm that zram is working, run zramctl. It should print something like
NAME ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram0 zstd 8G 430.8M 137.6M 142.9M [SWAP]
See also Improving system responsiveness under low-memory conditions.
Systemd absorbed zram now.
And no, you don't need a background service for this.
# modprobe zram
# zramctl /dev/zram0 --algorithm zstd --size "$(($(grep -Po 'MemTotal:\s*\K\d+' /proc/meminfo)/2))KiB"
# mkswap -U clear /dev/zram0
# swapon --discard --priority 100 /dev/zram0
Systemd is a great operating system, all it lacks is a kernel.
Just like GNU coreutils.
What happens when you reboot?
The example below describes how to set up swap on zram automatically at boot with a single udev rule and an fstab entry. No additional packages are needed to make this work.
I'd take a single file config. It's cleaner and easier to see what's going on.
You may not need an additional package, but often they're convenient.
a handbrake encoding that was paused and decided to open [a game]
Even in 2026 that does not seem like good practice to me.
Have you tried switching to a different tty and killing the handbrake process?
Also, have you checked that it's really RAM getting filled up that freezes your system?
Try it. I have configured ZRAM on Linux Mint and Debian, works like a charm.
If I may ask: why are you thinking of only committing 1 or 2GB to ZRAM? This way your net RAM capacity increase will only be a few hundred megs. I recommend to allocate 25% to 60% of your RAM to it.
To set it up, I have used an LLM for instructions, so don't listen to me for derails. I recommend prompting/searching for instructions youryelf if others aren't aplble to point you to a guide.
To set it up, I have used an LLM for instructions, so don’t listen to me for derails.
Mentioning LLMs is a great way to derail threads on lemmy.
Yes, and I'm glad it didn't happen this time. Lemmy would be a better place without those derailments (whether you're a net proponent or net opponent of LLMs).
Linux
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Rules
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
- No misinformation
- No NSFW content
- No hate speech, bigotry, etc
Related Communities
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0