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

Over at Tux Machines...
GNU/Linux news for the past day
Microsoft Layoffs and Closures Now Reported in Africa
Microsoft Uninstalls Nigeria as it closes African Development Centre (ADC) in Lagos
 
Links 09/05/2024: More Microsoft Layoffs on the Way
Links for the day
Amid Microsoft Layoffs in Nigeria GNU/Linux Climbs Above 6% Market Share (Not Including ChromeOS)
Hundreds are being laid off by Microsoft in Nigeria, based on yesterday's reports
[Meme] Blame the Robots or the 'Hey Hi' (AI), It Always Works in Today's Media
Companies do not have financial troubles! They have "efficiencies"...
News Reports Say Many More Microsoft Layoffs on the Way, Rumours Say Red Hat Also Imminently a Target
Microsoft is slipping out of control
Links 09/05/2024: Diplomacy Efforts With China, AstraZeneca Stops Experimenting With COVID-19 Vaccines
Links for the day
IRC Proceedings: Wednesday, May 08, 2024
IRC logs for Wednesday, May 08, 2024
Gemini Links 09/05/2024: Registered Computer Professionals and TLS (The Long Slog)
Links for the day
Links 08/05/2024: Android Malware and "AI" Hype
Links for the day
[Meme] Technical Committee With People Who Are Not Technical
the computing/computer industry being occupied by people who lack suitable background
The Demise of Computer Science Education
Education is essential for the future; without it, whole nations will perish
[Video] Prisons for the Minds and for Tech Workers
Today's video talks about what happens to workforces (across disciplines) in recent years
[Meme] Struggling to Leave Its Nazi Past Behind
digital arson
Microsoft Declines to Talk About How Many People It Has Just Laid Off
Hours ago in IGN: "Microsoft did not say how many staff will lose their jobs, but significant layoffs are inevitable. IGN has asked Bethesda for comment. Microsoft declined to expand further when contacted by IGN."
Microsoft Windows in South America: From 99% to 87%
the latest from statCounter
It's Rather Obvious Why They Try to Silence Richard Stallman, Eben Moglen, and Daniel Pocock
Some of them already sent physically menacing messages to Daniel Pocock
IRC Network of Techrights Turns 3 (or 16 if We Count the Freenode Days)
In a few months IRC turns 36
Sedating Oneself (and Shareholders) With Fuzzy Buzzwords and Pointless Acquisitions
IBM trying to buy time
Clickfraud Spamnil Ran Out of Clickfraud Budget, Apparently
sooner or later charlatans and frauds run out of steam
Techrights Gets Under the Skin of Bad, Corrupt, Immoral People (That's a Good Thing)
Journalism is the lifeblood of democracy and free societies
Companies Do Not Shut Down Offices and Lay Off Staff en Masse (Morale and Reputation Issue) Unless They're in Deep Financial Trouble
Microsoft has been faking its financial performance for years
IRC Proceedings: Tuesday, May 07, 2024
IRC logs for Tuesday, May 07, 2024
Over at Tux Machines...
GNU/Linux news for the past day
[Video] Leaving Microsoft Behind for the Sake of National Security
Threats to "National Security" aren't some users with an Android phone but Microsoft at the root of things
GNU/Linux and ChromeOS Now at 6% in France, According to statCounter
numbers from statCounter
Gemini Links 07/05/2024: Music Spotlight and Network Knobs
Links for the day
Only Weeks After Microsoft Closed Offices and Studios It is Closing Several More (Many Layoffs, Still Deeply Debt-Saddled)
When the sad news writes itself
Bolivarian Republic Of Venezuela: GNU/Linux Reaches 9% (ChromeOS Included)
Venezuela must have lost interest in some American proprietary software when users were locked out of their own data (Adobe) and the costs could no longer be justified
[Video] Microsoft is Like Big Oil, Big Tobacco, and Other Perpetrators of Fear, Uncertainty, Doubt/Fear-mongering
openwashing, Microsoft lobbying, and Microsoft subsidies (e.g. bailouts in the form of 'defence' contracts)
Security & Debian: Urgent: New Feed URLs after another WIPO censorship
Reprinted with permission from Daniel Pocock
World Press Freedom Day: WIPO censors Debian suicide cluster
Reprinted with permission from Daniel Pocock
Gemini Links 07/05/2024: Smashing Windows (Moving to GNU/Linux) and Mastodon Time-wasting
Links for the day
Links 07/05/2024: Pulitzer for Supreme Court Expose, New Threats to Media Reported
Links for the day
Links 07/05/2024: Cheap EVs and Cloudflare Layoffs
Links for the day
Berlin police declined to investigate FSFE Nazi comparisons
Reprinted with permission from Daniel Pocock
[Meme] Communities Governed by Parasitic Elements and Girlfriends (Who Can't Understand Those Communities)
Karen Sandler and Molly de Blanc present at DebConf18
[Meme] You Can't Kill an Idea (or Facts)
Thankfully, in Western societies, there's still due process, rule of law etc. You don't just hire assassins or imprison critics
[Meme] Software in the Public Interest (SPI), Inc, Values Articles of Daniel Pocock at ~$5,000 Each (and Fails to Hide the Facts)
we are laughing, not grieving
IRC Proceedings: Monday, May 06, 2024
IRC logs for Monday, May 06, 2024
Over at Tux Machines...
GNU/Linux news for the past day
[Meme] About 2,564 Internet Sites Now at Risk of Hostile Takeover by Microsoft-Sponsored Software in the Public Interest (SPI)
WIPO censors Debian suicide cluster
Links 07/05/2024: Burning Plastic Waste, Facebook Censoring Politicians
Links for the day
Gemini Links 07/05/2024: Smashing Windows (Microsoft Losing Users to GNU/Linux), Sixty Years of BASIC
Links for the day