Bonum Certa Men Certa

Messing With ZRAM Again Because IBM Software is Barely Possible to Document and Changes if You Do

Reprinted with permission from Ryan Farmer.

It turns out that when I was setting up Debian, I set up my “zram-generator” systemd configuration file wrong.



systemd is Hell because they never commit themselves to the idea that once you learn how to do anything with it, it will stay working, most of its components are full of bugs and security vulnerabilities, and many things replace something that some other part of the operating system was already doing a lot better.



I cringe every time I give it some new responsibility over my system, waiting for how it will go wrong. I would be using systemd-oomd to handle potential out-of-memory situations, but I’ve read so much about how it handles memory pressure bizarrely and worse than the kernel’s oom-killer, even with the Fedora defaults, that I figure I’ll just leave it alone unless it becomes “mandatory” at some point.



I hear (on Reddit) that systemd-oomd does crazy shit, like, “There are 32 GB of RAM in this system. 12 GB are in use. 20 GB are free. Let’s go on a murder spree and shut down some Chrome tabs and LibreOffice with unsaved work!”



ZRam is a compressed block device that you can use for a compressed swap file in memory. The idea isn’t a bad one, but IBM has made figuring out how to set it up unnecessarily painful because of course it is handled by systemd. You’d think setting up ZRam would be too simple for systemd to bring too much of its usual incompetence to, but nooooo.



Today I actually looked at zramctl and it told me the compression type was lzo-rle, not zstd as I wanted (and was the default on openSUSE and I’m sure that’s what it said when I set it up on Debian and started the service).



Whatever.



Looking around the Web, I found that I needed the line compression-algorithm = zstd in my /etc/systemd/zram-generator.conf file.



So I added it and rebooted, and checked sudo zramctl again and I had zstd compression. Yay!



But when I was looking at the manpage for “zram-generator”, it said that the method by which to specify the fraction of the size of RAM to use was obsolete.



zram-fraction = 1.00 does work, but it’s “obsolete”.



So now it tells me that the “current” way to do the same thing is zram-size=ram/x, where ram is the amount of ram and x is the amount to divide by.



So ram/2 would make the device half of RAM, ram/1 would make it all of your RAM, which is what I wanted.



So now my file looks like this:



# This config file enables a /dev/zram0 swap device with the following
# properties:
# * size: 50% of available RAM or 4GiB, whichever is less
# * compression-algorithm: kernel default
#
# This device’s properties can be modified by adding options under the
# `[zram0]` section, or disabled by removing the section header.
# Additional zram devices can be created by appending new `[zramX]`
# sections and setting the appropriate options for each device.
#
# See /usr/share/doc/systemd-zram-generator/zram-generator.conf.example
# and/or zram-generator.conf(5) for a list of available options.
[zram0]
zram-size=ram/1
compression-algorithm = zstd



I’m not exactly sure why IBM Red Hat keeps screwing around changing the way you do this. They make you memorize something only to make pointless changes to the way it’s done, but then the stupid thing doesn’t want to break existing setups, so they just say the old one is “obsolete”.



$ sudo zramctl
NAME ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram0 zstd 15.4G 4K 64B 4K 8 [SWAP]



At least this thing is finally set up right, I think.



They never let you get too sure that you did it right or it wouldn’t be “modern”.



As to the debate about zstd vs lzo-rle, they’re both decent choices.



I can see the logic of defaulting to either one, depending on who you think your users are.



If you have a multi-core x86 PC with lots of CPU performance to burn, zstd makes more sense because of higher compression ratios.



If you have some little ARM system that you bought down at the Micro-Center and don’t want to overload it, but still do want to use ZRam, lzo-rle is a respectable choice.



If anything, ZRam with zstd has gotten faster since the kernel developers have last updated the default and I suspect it deserves another look.

Recent Techrights' Posts

You Should Probably Self-Host Your E-mail and Never Use a Web Browser for Mail
Does anyone still believe Gmail is "free"?
StatCounter Shows the Market Share of Vista 11 is Decreasing in Ukraine This Year
Microsoft abandoning Vista 10 users would be a victory for Vladimir Putin
The "Gold" Rule: Taking Money for Reputation Laundering and Openwashing Under the "Linux" Banner
Seller of expensive toilet paper, Jim Zemlin
LLM Slop Says Slop is "coming for white-collar jobs. Microsoft’s layoffs are just the start"
Look what the Web has become
Reporting Facts About Violence Against Women Deserves Awards, Not Frivolous Lawsuits and Threats
What is Microsoft's stance on women's safety?
Linux.com as Spamfarm of the Linux Foundation, Partner of the Gates Foundation
They no longer publish articles
Slopwatch: The Typical Slopfarms and the 'Brian Fagioli Dilemma'
To the Web and to society (exposed to the Web) LLMs are a net negative
 
Trump Authority (CA) With a Trump NSA is All About Security, But Whose?
A "turnkey tyranny", as the NSA whistleblower Thomas Drake loved to call it
Confirming IBM Shutdowns and Layoffs Today
It's not over yet
Gemini Links 16/04/2025: The 2010s Are Calling and Why "Tools Will Not Liberate Us"
Links for the day
Links 16/04/2025: Cliff Lynch RIP, More Attacks on Science (NASA)
Links for the day
Google Promotes Fake Articles (LLM Slop) Instead of Originals, Relaying Microsoft's Linux FUD Emanating From Microsoft LLMs
Shame on Google for participating in the slopfest
In Some Countries the Largest OEMs Already Dump Microsoft Windows
Windows at 18.9%, Android 60.2%
Microsoft Down From 100% to 10% in Myanmar/Burma
only about 4% of Web requests in Myanmar/Burma come from Vista 11, soon to be the only "supported" version of Windows
When Fedora Said It Was Looking to Integrate "AI" It Meant Promoting Microsoft's Proprietary Spyware and GPL-Violating Slop
When they say "AI" they mean Microsoft
It Used to be IBM, Now It's Microsoft (Why You Need to Fire Microsofters or CIOs Working for Microsoft)
Typically the only effective solution is to identity and remove Microsofters from one's project/organisation (before they can bring more Microsofters in)
IBM Closes Offices and Labs in the United States to Open New Ones in India
It's not layoffs per se; they're substituting/swapping veteran employees for lesser-paid ones
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Tuesday, April 15, 2025
IRC logs for Tuesday, April 15, 2025
Gemini Links 16/04/2025: IndieWeb Carnival, Tinylog RFC, "Focus, the Web and Gemini"
Links for the day
Links 15/04/2025: Touchable Volumetric Display and Resistance to American Spying Firms
Links for the day
Links 15/04/2025: Some People Cannot Read and Re-discovering of 'Web 1.0'
Links for the day
Links 15/04/2025: China Admits Targetting Critical Infrastructure Using CALEA Back Doors, NASCAR Cracked by Windows Usage
Links for the day
Why We Support Carole Cadwalladr (Even If We Don't Agree With Everything She Said)
I first became aware of Cadwalladr's work a long time ago
Microsoft's Serial Strangler Chose to Attack Techrights With SLAPP When Over 400 Victims of Mohamed Al Fayed Complained About Media's Role in Enabling Him
There is a strong element of "free press" here
A Coalition or a Coup of Sexism
In the Free software community it's hard to avoid this issue
statCounter Sees GNU/Linux at New High of 6% in Bosnia and Herzegovina
GNU/Linux is measured at all-time high
To Celebrate Git Turning 20 Linus Torvalds is 'Selling Out' to Microsoft and Proprietary Software Which Attacks Git (E.E.E.)
He makes it seem like he's endorsing his attackers
Gemini Protocol Milestone (3,000 Active Capsules)
and a total of nearly 4,500
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Monday, April 14, 2025
IRC logs for Monday, April 14, 2025
Gemini Links 14/04/2025: Silver Pigs and more Foundation, Disliking Computers
Links for the day
Hundreds of Microsoft Layoffs (Net Headcount Decrease) in the United Kingdom
headcount decreased
Links 14/04/2025: Russian Attack on Sumy Shows No Intention of Peace, Virgin Australia Admits Overcharging People
Links for the day
The Dilemma of Web Browsers Lying About What They Are (in Order to Bypass Discriminatory Gateways Like Clownflare) Worsens Due to LLM Slop
LLM crawlers/scrapers have made sites more restrictive and hostile towards browsers that are potent but not "famous"
What Really Matters to Companies is Net Income or Profit (Bankruptcy is Possible Even With High Revenue)
We ought to stop talking about revenue without focusing on actual profit
Carole Cadwalladr Talks About How Big Business Tried to Silence Her (and Why You Might be Next)
Our story is very different from Cadwalladr's for many reasons
Companies Conspiring to Keep Salaries Down and Undermine Competition
People who do all the practical work are being paid less and made to work for much longer
Links 14/04/2025: Disinformation, Public Disdain for LLMs, and "Lessons on Tyranny"
Links for the day
LLM Slop and SEO SPAM Take Us Further Away From Facts (the Case of IBM Layoffs)
Some of these can impact Red Hat as well
Gemini Links 14/04/2025: Ween and Historic Ada Project Management
Links for the day
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Sunday, April 13, 2025
IRC logs for Sunday, April 13, 2025
Influencers: Red Hat, Inc's IPO, 1999, post-mortem on the directed share offer to open source developer community
Reprinted with permission from Daniel Pocock