Monday, April 29, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 2765  / 2 Years ago, thu, september 8, 2022, 11:08:41

Due to a zram bug leading to machine lock-ups, I've had to disable zram.



I thought dpkg --purge zram-config as well as commenting any reference out of /etc/rc.local would do the trick, but the module (and its ominous dmesg warnings Buffer I/O error on device zram0, logical block 257912) keeps getting loaded.



I've grepped /etc/init and /etc/init.d for zram and there were no matches. I've even redefined mkswap to log how it was called (because the "buffer errors" occur when mkswap touches protected memory) -- amazingly I didn't get any calls. So I can't figure out what configures zram (calling mkswap + swapon).



I've taken to breaking the zram.ko to stop its loading. But I would still like to figure out what specific init script loads it. Any ideas?



Note that I'm looking for answers about how to track down which init or startup script configures zram -- I know very well that the bug might already be fixed, that you can disable zram in several ways etc, and such answers would be off-topic.


More From » 12.04

 Answers
2

Try this (adapting the initrd location):


$ mkdir /tmp/x
$ cd /tmp/x
$ zcat /boot/initrd.img-3.8.0-31-generic | cpio -i
$ grep -lR zram .
./scripts/init-top/compcache
./lib/modules/3.8.0-31-generic/kernel/drivers/staging/zram/zram.ko
./lib/modules/3.8.0-31-generic/modules.dep
./lib/modules/3.8.0-31-generic/modules.dep.bin
./lib/modules/3.8.0-31-generic/modules.order
./sbin/compcache-enable
./etc/udev/rules.d/80-compcache.rules

The second last is the culprit, the last one shows the calling parameters. The script /etc/init/zram-config.conf wants to make one zram device per core, the one above is making a single one with 50%.


I can confirm that the last sector is bad in /dev/zram, probably an off-by-1 bug. A system with zram and the default settings will crash when it tries to use that sector. The options I see:



  1. Add swapoff /dev/zram0 to /etc/rc.local (Most basic).



  2. Blacklist zram (But will this unload it first? Because it's loaded in the initial ramdrive).


    Otherwise, if you want to use the zram, you must add -c to the relevant mkswap, and hope for the best, i.e., that everything works apart from the last sector. Reference: this post



  3. Add the -c to sbin/compcache-enable from inside the initrd image and repack (lost with kernel upgrades).



  4. Add -c to /etc/init/zram-config.conf. You also need a swapoff and rmmod before its modprobe, because the zram is already set when it runs, so setting the size will fail.




I chose 3 for now, but dmesg is still polluted with those Buffer I/O errors. I'll be watching for crashes, now at least I know where they come from.


[#29399] Thursday, September 8, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
njuash

Total Points: 402
Total Questions: 125
Total Answers: 98

Location: Jersey
Member since Sun, Dec 4, 2022
1 Year ago
;