Zram module absent in linux-zen-5.8.5-zen1-1-zen?

Hi,

I had set up zram which worked well previously. After the upgrade to zen kernel I realized that the module is not loaded. Trying to load it in a terminal results in:

FATAL: Module zram0 not found in directory /lib/modules/5.8.5-zen1-1-zen

Neither lsmod does list zram. Is it no longer included in Linux kernel? Does anyone knows what has happened?

I think the module is zram :

$ sudo modprobe zram
$ sudo modprobe zram0
modprobe: FATAL: Module zram0 not found in directory /lib/modules/5.8.5-zen1-1-zen
3 Likes

It’s working fine here:

tardy>>uname -a
Linux ts140arch 5.8.5-zen1-1-zen #1 ZEN SMP PREEMPT Thu, 27 Aug 2020 18:52:58 +0000 x86_64 GNU/Linux
tardy>>free -h
              total        used        free      shared  buff/cache   available
Mem:           23Gi       3.7Gi        14Gi       1.9Gi       4.8Gi        17Gi
Swap:         1.2Gi          0B       1.2Gi
tardy>>dmesg | grep zram
[   17.593431] zram: Added device: zram0
[   17.714161] zram0: detected capacity change from 0 to 312532992
[   17.847951] Adding 305204k swap on /dev/zram0.  Priority:32767 extents:1 across:305204k SSDscFS
[   17.850475] zram: Added device: zram1
[   17.851205] zram1: detected capacity change from 0 to 312532992
[   17.988886] Adding 305204k swap on /dev/zram1.  Priority:32767 extents:1 across:305204k SSDscFS
[   17.992446] zram: Added device: zram2
[   17.993123] zram2: detected capacity change from 0 to 312532992
[   18.121134] Adding 305204k swap on /dev/zram2.  Priority:32767 extents:1 across:305204k SSDscFS
[   18.124058] zram: Added device: zram3
[   18.124713] zram3: detected capacity change from 0 to 312532992
[   18.271917] Adding 305204k swap on /dev/zram3.  Priority:32767 extents:1 across:305204k SSDscFS
tardy>>
tardy>>lsmod
Module                  Size  Used by
fuse                  143360  2
overlay               143360  1
zram                   36864  4
5 Likes

Thanks for the reply and sorry for my mistake. This doesn’t error out, but yet it looks it won’t get loaded:

lsmod | grep zram
zram                   36864  0

Why?

If modprobe zram doesn’t return an error, and it’s shown by lsmod, then it’s loaded.

Whether it loads on boot is another story. :joy:

3 Likes
zram                   36864  0

I thought mistakenly that the zero indicated “not-loaded”.

I will reboot now . :crossed_fingers:t4:

2 Likes
              total        used        free      shared  buff/cache   available
Mem:           15Gi       1.4Gi        11Gi       1.1Gi       2.9Gi        12Gi
Swap:         511Mi          0B       511Mi
lsmod | grep zram                
zram                   36864  1

Yaay!! It got loaded! :grinning:

Sorry for the false alarm! :blush:
And thanks so much @jonathon and @anon3337769!

2 Likes

On EndeavourOS and possibly Arch based distros, I have observed that when the kernel is updated /lib/modules/<previous-kernel-directory> is removed. So any attempt to load modules after that fails.
I hit this when I migrated on my work box from Ubuntu to EndeavourOS. FTR this doesn’t happen on Ubuntu, I guess they tidy-up on the next boot cycle.
I guess the lesson is reboot after the kernel is updated, and for me in particular - update the work box at the end of the work day.

1 Like

What was surprising to me was that this happened after a reboot. I saw in htop that the swap was not there. That was the strange thing about it. Upon loading the module manually and rebooting again, it did work.

@pebcak oooh, that is surprising. As I said I have fallen foul of this before, and it appears that the problem went away after rebooting which is weird (at least to me). I don’t think manually loading the module in a prior iteration should have an effect. For that one should add the module to a file under /etc/modules.d for example I created /etc/modules.d/terraform with

virtio-net
virtio-blk
virtio-scsi
virtio-balloon
vhost_net
1 Like

Arch has one kernel package whereas Ubuntu has a package for every kernel version. When the Arch kernel package is upgraded the files are removed from disk so it’s not possible to load modules for the old but running kernel (because they’re not on disk any more). When an Ubuntu kernel package is installed the old and running version still has files on disk.

1 Like

Yeah that makes sense, I forgot that Ubuntu doesn’t remove previously installed kernels and associated packages, one has to explicitly remove or IIRC use apt autoremove

1 Like

Yes, that was a bit of oddity. I do reboot almos always after updates as a matter of course. After updates to kernels I always reboot. So I can’t explain what happened.

zram needs actually to be added like that but in /etc/modules-load.d.