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).


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.
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
/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

[Meme] The Latest in the Microsoft Windows Blame Game
Microsoft found the culprit and came to everyone's rescue!
For the First Time Since May (Linux Foundation) Published Something. It's All Spam.
Can we trust the Linux Foundation to look after anything at all? Look what it turned this once-thriving site into.
Honduras: Windows Down, Android Peaking Again
Honduras does not have many stakes in Microsoft
Why the Media is Dying (It Sucks, No Mentally Healthy People Will Tolerate This for Long)
linking to actual news articles helps fuel the spam, too
Something is Happening at OFTC
It looks like it shrank by 20,000 users
GNU/Linux Usage in Guadeloupe Rises Closer to International Average, Based on Web Data Collected by statCounter
It should be noted that the estimates of GNU/Linux usage are now in 4.5% territories
Censorship in Eklektix's Linux Weekly News (LWN)
Medieval system of speech, where the monarchs (Linux Foundation) dictate what's permissible to say
10 Years of In-Depth EPO Coverage at Techrights (Many Others Have Abandoned the Topic)
Listen to staff
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Monday, July 22, 2024
IRC logs for Monday, July 22, 2024
Links 22/07/2024: Overworking and Performance Issues From Europe
Links for the day
Microsoft Eliminates 67% of the Building Occupancy - That's Some Truly Massive Layoffs
Half a dozen floors? Microsoft cuts that down to two.
[Meme] Signs of a Dying Patent Office
"Bribe the media to say you excel"
This Month's General Consultative Committee (GCC) Webchat ('Meeting') Covered the European Patent Office's Attacks on Its Own Interpreters
The Central Staff Committee is currently circulating a report with appendices about the GCC meeting [sic] (webchat) that took place less than a fortnight ago
A Byzantine European Patent Office Where Staff Must Beg for Help With Contraception (Worse Than the Rest of Europe)
The Central Staff Committee (EPO staff representation) has just circulated a report
[Teaser] EPO Run by Children
"Daddy, why was I born?"
Let's Encrypt About to Fall Below 100 (Capsules) in Geminispace, It's Basically in a Freefall
The "self-signed" portion keeps growing
Gemini Links 22/07/2024: Spacewalk Dies and Old Computer Challenge in the Rear View
Links for the day
[Meme] Twitter (X) Will Reject the Concept of a Female President
Twitter (X) is controlled by misogynists, who socially control (or socially-engineer) their fake concept of "media"
Second Family Photo of Julian Assange Since His Release (First Since His Birthday)
His wife shows the 4 of them for the first time (2 hours ago)
Protesters in Kenya Need Software That is Free (Libre) and Supports Real Encryption in Order to Avoid Capture and Torture (Sometimes Execution)
There's more to fight over than economic issues
The Ludicrous Idea That GNU/Linux is a "Poor Man's" Operating System
Seeing the trends in countries such an Norway, it ought to be abundantly clear that adoption of GNU/Linux has nothing to do with poverty
Links 22/07/2024: Internet Optimism and Kamala Harris Policies Debated
Links for the day
The Impact of OFTC's Latest Changes on the Perceived Scale of IRC Globally
IRC is still one of the more potent alternatives to the social control media conglomerates
New: Why They Really Went After Assange
Uploaded by Chris Hedges
Links 21/07/2024: Health, Politics, and Kamala Harris in Focus
Links for the day
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Sunday, July 21, 2024
IRC logs for Sunday, July 21, 2024
A Drop in Half (From 208 to 104): Sharp Decline in Number of Gemini Capsules That Use Let's Encrypt CA Since December
Gemini is increasing its independence from Certificate Authorities (CAs)
Gemini Links 21/07/2024: Last of Old Computer Challenge and Forth Language
Links for the day
Links 21/07/2024: Climate, Politics, and More Squashed Patents
Links for the day
Only a Quarter of Web Requests in Micronesia Traced Back to Microsoft Windows (It Used to be Well Over 95%)
Micronesia has over half a million people in it
Your F.U.D. is Already Showing, Microsoft
That talking point is quickly spreading so that CrowdStrike discussions become about "Linux" instead of Windows
Andrew Feinstein on Why Freeing Julian Assange is About the Freedom of the Press in General
Feinstein points out that truth itself is being challenged by people who value power, not truth, and typically seek to do things like sell arms and start proxy wars
In Palau, Windows Has Fallen to 16%
15 years ago Windows was at 98%
Gemini is Blossoming and More Capsules Are Self-Signing, Rejecting the Defunct and Falsely-Marketed Certificate Authority (CA) Model
Gemini is still very fast, not only because objects are lightweight but the protocol itself - i.e. the underlying logic - is as simple as it needs to be and only as complex as it must be
Gemini Links 21/07/2024: New Garden and New Gemini Arrivals
Links for the day
Links 21/07/2024: Extreme Heat and Fortescue Layoffs
Links for the day
GNU/Linux Lifted Up 0.03% Closer to 4.5% "Market Share" (or 50% More Than a Year Ago)
How many businesses and homes are permanently giving up on Windows after recent days' events?
Giving the False Impression That the R blogosphere is Microsoft's Microcosm
Curation that culls "astroturfing" isn't censorship but quality control for relevance
High Adoption Rates for GNU/Linux in Albania, According to statCounter
Albania has been a central point of some GNOME and diversity scandals
It'll Soon Be Half a Decade Since COVID-19's Breakout, We Still Need Verified Facts (Not Corporate Dogma) and Proper Media Reporting
COVID-19 has meant different things to different people
For the First Time, Microsoft's "Market Share" in North Macedonia Falls to Only a Quarter
Microsoft only has Windows
Evan Versus Julian
Published by Julian Assange's wife some hours ago
What The Internet Can Achieve When Put in the Hands of the Good People and Not Censored by the People Who Already Control the Mass Media
albeit Wikileaks put that in social control media owned and controlled by oligarchs
IRC Proceedings: Saturday, July 20, 2024
IRC logs for Saturday, July 20, 2024
Over at Tux Machines...
GNU/Linux news for the past day
[Meme] Hate Speech
This is also what makes TikTok so dangerous
Shark-infected Water on the Web
Don't turn Gemini into another "Web"
OpenHarmony, HarmonyOS Next, Deepin, Kylin, and openKylin: How China's Various Manoeuvres Away From Windows Get Covered in the West
Kylin was openly based on Ubuntu
WikiLeaks Wonders: Major Leaks That Shook the Worlds
Published 14 hours ago