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

No, Microsoft Didn't Lay Off So Many People Because of "AI" "Innovation" or "Efficiency" or "Era" or "Revolution" Etc.
Debunking one very common lie
What We Do When We Say "GNU/Linux" to People
It talks about "Linux", "GNU", and what it means to say "GNU/Linux"
Canonical Will Give You Money Only If You Work for Microsoft!
Only if you are servicing (being a slave to) proprietary forges that Microsoft and the NSA control while violating the GPL will Canonical give you money
There Are Also Loads of Microsoft LinkedIn Layoffs Today (Keep Track of the Subsidiaries They Keep Out of Headlines)
Perhaps lost in the smokescreen
There Are Bigger Rounds of Microsoft Layoffs Coming, a Cull of 10% Implemented in Waves (the "3%" Figure is Misleading, Face-Saving)
Last night we said they might do the layoffs in three or at least two waves
Unless a Third of All Microsoft Layoffs Worldwide Are in Redmond (Washington) Alone, Microsoft Has Just Lied to Everyone Via Jordan Novet in CNBC (i.e. the Usual Any Time There's Mass Layoffs and Novet Weighs in With False Numbers)
Maybe when Microsoft said 3% it meant ~6,000 or more in the US alone
 
VS Code Is Not FOSS, And Neither Is the Site "It's FOSS"
VS Code is proprietary spyware of Microsoft, yet this site keeps promoting it like it's FOSS
Links 14/05/2025: Facebook And Instagram Risk Nationwide Bans, Microsoft Subsidiaries Have Mass Layoffs Too
Links for the day
If Microsoft Staff That Strangles Woman Pays You to Write Lies, It Will Not End Well
The past couple of years were our most productive ever
Gemini Links 14/05/2025: "Writing My Story with Inspiration from Notable Lives" and People Start Shovelling Up LLM Slop Onto Geminispace,
Links for the day
Microsoft is Very Highly Stressed About Adoption of GNU/Linux at Windows' Expense (on Former "Vista 10" PCs)
What does this tell us?
Slopwatch: BetaNoise (BetaNews), LinuxSecurity, and Slopfarms Still Promoted by Google News
The primary goal is to demonstrate the problem persists
Links 14/05/2025: Google Agrees to $1.3 Billion Settlement After Spying, China Tariffs Don't Work
Links for the day
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Tuesday, May 13, 2025
IRC logs for Tuesday, May 13, 2025
Gemini Links 13/05/2025: Apocalyptic Future and More
Links for the day
McKinsey (McK) is Killing IBM, It's All About Killing This Goose, "National Sales Team 80% on PIP Now" (Preceding Layoffs Without Severance)
PIPs are not based on performance
Links 13/05/2025: Microsoft Breaks Windows Very Badly Again, Mass Layoffs Reported (But False Figures, It's a Lot Higher)
Links for the day
As Expected, Microsoft Uses Media Operative (Jordan Novet) to Downplay the Scale of Mass Layoffs
here we go
2025 Will be a Big Year For GNU/Linux on Desktops/Laptops
with an economy like this, people who don't live in rich countries won't turn to Apple
Signs of Trouble: Microsoft Job Openings for Jobs That Do Not Exist!
Keeping up appearances?
"Special Place in Hell" for Women Who Help Violent Microsofters From Another Continent Attack Local Women Who Did Nothing Wrong, They Just Got Bullied and Deserve Sympathy or Compensation
Nothing says "Brat" like men who attack women, right?
The Numbers Game: 50,000-60,000 Microsoft Workers Laid Off in 2.5 Years? And Debt Still Tripled Under Nadella.
under Nadella Microsoft's debt trebled
The Slow Death of Windows Will Mean the Inevitable Demise of Microsoft
Once people stop using Windows, it'll be hard for Microsoft to sell anything to them
Last Week's Public Talk by Richard Stallman Well Attended and Covered in Technical News Sites
and we're looking at about 60,000 Microsoft layoffs in 3 years
Gemini Links 13/05/2025: Shopping is an Exasperating Nightmare and Making Phones Minimal
Links for the day
23,000 More Microsoft Layoffs by the End of June If the Estimates Are Correct (In Addition to About 6,000 Layoffs So Far This Year)
There's no questions about many layoffs happening this month. It got leaked already. The only question is when (and also how many).
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Monday, May 12, 2025
IRC logs for Monday, May 12, 2025
Major Microsoft Layoffs This Week (Discussed Online)
later we can expect a lot of spin, even misinformation
What Happened to the Open Source Initiative (OSI) Elections: Missed Deadline
they helped expose a number of other scandals
Links 12/05/2025: Measles Rising and Taliban Outlaws Chess in Afghanistan
Links for the day
Gemini Links 12/05/2025: Advice, Iorist Ethics, and Touchscreens
Links for the day
The Finances of GAFAM Aren't as They Seem
MICROSOFT FINANCIAL PYRAMID revisited
Links 12/05/2025: US Brain Drain and Reminder That "Microsoft's Lobbying Efforts Eclipsed Enron" (Fraud Coverup)
Links for the day
The Enshittification of Royal Mail (Post Office/Postal Services) Continues
Enshittification is a thing, not only in the digital realm
Red Hat's Owner is Called "America's Worst Tech Company" (IBM) and Microsoft's Liabilities Grow
Microsoft has about a quarter of a trillion (yes, trillion with a "T") in liabilities
If the Gossip is True, Today Microsoft Has "Large M1 Meetings" to Discuss Almost 30,000 More Microsoft Layoffs in 2025
the claim is that Microsoft is preparing to lay off 10% of its staff
Microsoft Has a Long and Proven History of Funding Meritless Lawsuits Against Rivals and Critics (It Always Backfires)
It also looks like the solicitor used by two Microsofters to SLAPP us is being urgently replaced
Links 12/05/2025: Gardens and Kitchens
Links for the day
Links 12/05/2025: Media Being Attacked (New Forms of Attack on the Press), Many Data Breaches
Links for the day
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Sunday, May 11, 2025
IRC logs for Sunday, May 11, 2025