# zram modules fail to load on 5.13 [Solved]

## hno2

Hi folks, I set up zram according to the wiki, using systemd and udev. Worked fine until kernel 5.13 where starting fails with systemd not being able to load the zram module. I'm quite lost in debugging that and would be very grateful for any help. If you need any settings/configurations/logs from me please let me know and I will of course provide it. Thanks already to everybody willing to put some time into it (:

----------

## Hu

How does it fail?  Is the zram module actually available on your 5.13 kernel?  What output do you see that makes you think it did not work?

----------

## hno2

```
Timed out waiting for device /dev/zram0

Dependency failed for /dev/zram0
```

And respectively for /dev/zram{1..3} is the output during start. It ends with »you are in emergency mode. […]«

```
CONFIG_ZRAM=m

CONFIG_ZRAM_DEF_COMP_LZ4=y

CONFIG_ZRAM_DEF_COMP="lz4"

CONFIG_ZRAM_WRITEBACK=y

CONFIG_ZRAM_MEMORY_TRACKING=y
```

 are the kernel config options.Last edited by hno2 on Sat Aug 21, 2021 6:24 pm; edited 1 time in total

----------

## mike155

I use kernel  5.14.0-rc6 and zram still works:

```
# zramctl 

NAME       ALGORITHM DISKSIZE  DATA  COMPR TOTAL STREAMS MOUNTPOINT

/dev/zram0 lz4          19.5G  4.2M 112.5K  184K       8 /var/tmp/portage

```

It seems that your issue is not related to kernel 5.13. I guess something is else is wrong. Do you use initramfs?

You could try to compile zram directly into your kernel:

```
CONFIG_ZRAM=m  -->  CONFIG_ZRAM=y
```

----------

## hno2

I think it somehow is connected to the 5.13 kernel, since the 5.12 I was (and right now am) running is working fine. I don't use an initramfs and will try to compile it in directly.

----------

## steve_v

 *hno2 wrote:*   

> I think it somehow is connected to the 5.13 kernel

 

Well it's of no direct help, but as an additional datapoint I'm running 5.13.12 with zram as a module, and everything is working just fine.

----------

## Hu

OP: you stated that you compiled zram as a module.  Is zram actually available for your kernel?  Was the module properly installed?  Can you modprobe it from the emergency shell, and does it work when you do that?

----------

## hno2

Compiling it in did not help.

@Hu: I started a 5.13 kernel where it is compiled as a module. Wait until it fails, log into the emergency console. modprobe zram leads to module not found but the module exists under /lib/module for all kernels.

----------

## Hu

If modprobe zram fails, then it is expected that systemd encounters this error.  You need to fix that failure, or understand why building it into the core kernel does not work.

----------

## hno2

Hi Hu, as written in the opening post I'm aware that the module does not load and was hoping for input how to debug why. Logs to check, possible config options or similar.

When I try to load it in the emergency console it says FATAL: Module zram not found in directory /lib/modules/5.13.12-gentoo. But the modules exists in /lib/modules/$(kernel)/kernel/drivers/block/zram for all kernels installed. Did something change between 5.12 and 5.13 anybody is aware of which could cause that? I compared my kernel configs, the only difference I found which I could imagine to connect to that was that /sbin/modprobe is now explicitely defined as the path to look for modprobe. Which exists in that path.

----------

## Jaglover

Perhaps depmod failed to run automatically, try by hand.

Edit: /lib/modules/$(kernel)/kernel/drivers/block/zram < this is a directory, is /lib/modules/$(kernel)/kernel/drivers/block/zram/zram.ko actually there?

----------

## hno2

The module exists as zram.ko, zram.ko.gz or zram.ko.zst since 5.13. Maybe the changed compression for the modules plays a role, I'll check on that

----------

## Hu

 *hno2 wrote:*   

> Hi Hu, as written in the opening post I'm aware that the module does not load and was hoping for input how to debug why. Logs to check, possible config options or similar.

 You wrote that it failed to load, but when I asked for output showing how it failed, you instead showed systemd timing out waiting for it.  That creates an ambiguity:Was systemd waiting for the wrong thing?Was systemd not waiting long enough for the right thing?Was systemd correct, and the right thing would never happen on its own due to some error in the module?Resolving that ambiguity would get us closer to a solution, which is why I directed you to examine modprobe zram. *hno2 wrote:*   

> When I try to load it in the emergency console it says FATAL: Module zram not found in directory /lib/modules/5.13.12-gentoo.

 The module is not properly installed.  We do not know if systemd is right, but we do know that no matter how long systemd waits, the module will not load. *hno2 wrote:*   

> But the modules exists in /lib/modules/$(kernel)/kernel/drivers/block/zram for all kernels installed.

 Please show the installed kernel files, instead of summarizing for us.  Often, attempts to summarize hide critical information.  As a first guess, I like Jaglover's advice.  If that advice does not help, then please post the output of find "/lib/modules/$(uname -r)/kernel/drivers/" -ls.  Please also provide the output of emerge --pretend --verbose sys-apps/kmod.

----------

## hno2

Hi Hu, sorry for summarising. Installed kernels are:5.12.12-gentoo

5.12.13-gentoo

5.12.14-gentoo

5.13.0-gentoo

5.13.0-r1-gentoo

5.13.1-gentoo

5.13.2-gentoo

5.13.6-gentoo

5.13.9-gentoo

5.13.10-gentoo

5.13.11-gentoo

5.13.12-gentoo from which I can start the three 5.12 kernels. I am currently posting from the system running the 5.12.14-gentoo kernel, therefore

```
find "/lib/modules/$(uname -r)/kernel/drivers/" -ls

   663617      4 drwxr-xr-x   7 root     root         4096 Jul  5 09:21 /lib/modules/5.12.14-gentoo/kernel/drivers/

   663618      4 drwxr-xr-x   3 root     root         4096 Jul  5 09:21 /lib/modules/5.12.14-gentoo/kernel/drivers/block

   663619      4 drwxr-xr-x   2 root     root         4096 Jul  5 09:21 /lib/modules/5.12.14-gentoo/kernel/drivers/block/zram

   659010     16 -rw-r--r--   1 root     root        16195 Jul  5 09:21 /lib/modules/5.12.14-gentoo/kernel/drivers/block/zram/zram.ko.gz

   663624      4 drwxr-xr-x   2 root     root         4096 Jul  5 09:21 /lib/modules/5.12.14-gentoo/kernel/drivers/hid

   659025     48 -rw-r--r--   1 root     root        48898 Jul  5 09:21 /lib/modules/5.12.14-gentoo/kernel/drivers/hid/wacom.ko.gz

   659014      4 -rw-r--r--   1 root     root         1992 Jul  5 09:21 /lib/modules/5.12.14-gentoo/kernel/drivers/hid/hid-cherry.ko.gz

   659019      4 -rw-r--r--   1 root     root         1554 Jul  5 09:21 /lib/modules/5.12.14-gentoo/kernel/drivers/hid/hid-holtekff.ko.gz

   659015      4 -rw-r--r--   1 root     root         3289 Jul  5 09:21 /lib/modules/5.12.14-gentoo/kernel/drivers/hid/hid-chicony.ko.gz

   659022     24 -rw-r--r--   1 root     root        22670 Jul  5 09:21 /lib/modules/5.12.14-gentoo/kernel/drivers/hid/hid-logitech-hidpp.ko.gz

   659017      4 -rw-r--r--   1 root     root         1803 Jul  5 09:21 /lib/modules/5.12.14-gentoo/kernel/drivers/hid/hid-holtek-kbd.ko.gz

   659018      4 -rw-r--r--   1 root     root         1655 Jul  5 09:21 /lib/modules/5.12.14-gentoo/kernel/drivers/hid/hid-holtek-mouse.ko.gz

   659024      8 -rw-r--r--   1 root     root         6868 Jul  5 09:21 /lib/modules/5.12.14-gentoo/kernel/drivers/hid/hid-rmi.ko.gz

   659021     16 -rw-r--r--   1 root     root        12769 Jul  5 09:21 /lib/modules/5.12.14-gentoo/kernel/drivers/hid/hid-logitech-dj.ko.gz

   659016      4 -rw-r--r--   1 root     root         3309 Jul  5 09:21 /lib/modules/5.12.14-gentoo/kernel/drivers/hid/hid-dr.ko.gz

   659020      8 -rw-r--r--   1 root     root         6779 Jul  5 09:21 /lib/modules/5.12.14-gentoo/kernel/drivers/hid/hid-lg-g15.ko.gz

   659023     12 -rw-r--r--   1 root     root         8585 Jul  5 09:21 /lib/modules/5.12.14-gentoo/kernel/drivers/hid/hid-logitech.ko.gz

   663628      4 drwxr-xr-x   3 root     root         4096 Jul  5 09:21 /lib/modules/5.12.14-gentoo/kernel/drivers/net

   663629      4 drwxr-xr-x   3 root     root         4096 Jul  5 09:21 /lib/modules/5.12.14-gentoo/kernel/drivers/net/wireless

   663630      4 drwxr-xr-x   3 root     root         4096 Jul  5 09:21 /lib/modules/5.12.14-gentoo/kernel/drivers/net/wireless/ath

   659030     16 -rw-r--r--   1 root     root        13831 Jul  5 09:21 /lib/modules/5.12.14-gentoo/kernel/drivers/net/wireless/ath/ath.ko.gz

   663631      4 drwxr-xr-x   2 root     root         4096 Jul  5 09:21 /lib/modules/5.12.14-gentoo/kernel/drivers/net/wireless/ath/ath9k

   659032      8 -rw-r--r--   1 root     root         5702 Jul  5 09:21 /lib/modules/5.12.14-gentoo/kernel/drivers/net/wireless/ath/ath9k/ath9k_common.ko.gz

   659033     44 -rw-r--r--   1 root     root        44507 Jul  5 09:21 /lib/modules/5.12.14-gentoo/kernel/drivers/net/wireless/ath/ath9k/ath9k_htc.ko.gz

   659034    144 -rw-r--r--   1 root     root       145264 Jul  5 09:21 /lib/modules/5.12.14-gentoo/kernel/drivers/net/wireless/ath/ath9k/ath9k_hw.ko.gz

   663620      4 drwxr-xr-x   3 root     root         4096 Jul  5 09:21 /lib/modules/5.12.14-gentoo/kernel/drivers/gpu

   663621      4 drwxr-xr-x   4 root     root         4096 Jul  5 09:21 /lib/modules/5.12.14-gentoo/kernel/drivers/gpu/drm

   659011      4 -rw-r--r--   1 root     root         1782 Jul  5 09:21 /lib/modules/5.12.14-gentoo/kernel/drivers/gpu/drm/drm_ttm_helper.ko.gz

   663622      4 drwxr-xr-x   2 root     root         4096 Jul  5 09:21 /lib/modules/5.12.14-gentoo/kernel/drivers/gpu/drm/nouveau

   659012    892 -rw-r--r--   1 root     root       911761 Jul  5 09:21 /lib/modules/5.12.14-gentoo/kernel/drivers/gpu/drm/nouveau/nouveau.ko.gz

   663623      4 drwxr-xr-x   2 root     root         4096 Jul  5 09:21 /lib/modules/5.12.14-gentoo/kernel/drivers/gpu/drm/ttm

   659013     36 -rw-r--r--   1 root     root        34319 Jul  5 09:21 /lib/modules/5.12.14-gentoo/kernel/drivers/gpu/drm/ttm/ttm.ko.gz

   663625      4 drwxr-xr-x   4 root     root         4096 Jul  5 09:21 /lib/modules/5.12.14-gentoo/kernel/drivers/input

   663626      4 drwxr-xr-x   2 root     root         4096 Jul  5 09:21 /lib/modules/5.12.14-gentoo/kernel/drivers/input/tablet

   659026      8 -rw-r--r--   1 root     root         4495 Jul  5 09:21 /lib/modules/5.12.14-gentoo/kernel/drivers/input/tablet/wacom_serial4.ko.gz

   663627      4 drwxr-xr-x   2 root     root         4096 Jul  5 09:21 /lib/modules/5.12.14-gentoo/kernel/drivers/input/touchscreen

   659029      8 -rw-r--r--   1 root     root         5338 Jul  5 09:21 /lib/modules/5.12.14-gentoo/kernel/drivers/input/touchscreen/wacom_w8001.ko.gz

   659028      4 -rw-r--r--   1 root     root         3011 Jul  5 09:21 /lib/modules/5.12.14-gentoo/kernel/drivers/input/touchscreen/wacom_i2c.ko.gz
```

For the 5.13.12-gentoo kernel:

```
find "/lib/modules/5.13.12-gentoo/kernel/drivers/" -ls

   659447      4 drwxr-xr-x   7 root     root         4096 Aug 23 14:25 /lib/modules/5.13.12-gentoo/kernel/drivers/

   659452      4 drwxr-xr-x   3 root     root         4096 Aug 23 14:25 /lib/modules/5.13.12-gentoo/kernel/drivers/block

   659453      4 drwxr-xr-x   2 root     root         4096 Aug 23 14:25 /lib/modules/5.13.12-gentoo/kernel/drivers/block/zram

   659455     16 -rw-r--r--   1 root     root        16212 Aug 23 14:25 /lib/modules/5.13.12-gentoo/kernel/drivers/block/zram/zram.ko.gz

   659461      4 drwxr-xr-x   2 root     root         4096 Aug 23 14:25 /lib/modules/5.13.12-gentoo/kernel/drivers/hid

   659475     48 -rw-r--r--   1 root     root        49106 Aug 23 14:25 /lib/modules/5.13.12-gentoo/kernel/drivers/hid/wacom.ko.gz

   659464      4 -rw-r--r--   1 root     root         2016 Aug 23 14:25 /lib/modules/5.13.12-gentoo/kernel/drivers/hid/hid-cherry.ko.gz

   659469      4 -rw-r--r--   1 root     root         1581 Aug 23 14:25 /lib/modules/5.13.12-gentoo/kernel/drivers/hid/hid-holtekff.ko.gz

   659465      4 -rw-r--r--   1 root     root         3308 Aug 23 14:25 /lib/modules/5.13.12-gentoo/kernel/drivers/hid/hid-chicony.ko.gz

   659472     24 -rw-r--r--   1 root     root        22776 Aug 23 14:25 /lib/modules/5.13.12-gentoo/kernel/drivers/hid/hid-logitech-hidpp.ko.gz

   659467      4 -rw-r--r--   1 root     root         1883 Aug 23 14:25 /lib/modules/5.13.12-gentoo/kernel/drivers/hid/hid-holtek-kbd.ko.gz

   659468      4 -rw-r--r--   1 root     root         1672 Aug 23 14:25 /lib/modules/5.13.12-gentoo/kernel/drivers/hid/hid-holtek-mouse.ko.gz

   659474      8 -rw-r--r--   1 root     root         7009 Aug 23 14:25 /lib/modules/5.13.12-gentoo/kernel/drivers/hid/hid-rmi.ko.gz

   659471     16 -rw-r--r--   1 root     root        13123 Aug 23 14:25 /lib/modules/5.13.12-gentoo/kernel/drivers/hid/hid-logitech-dj.ko.gz

   659466      4 -rw-r--r--   1 root     root         3417 Aug 23 14:25 /lib/modules/5.13.12-gentoo/kernel/drivers/hid/hid-dr.ko.gz

   659470      8 -rw-r--r--   1 root     root         6917 Aug 23 14:25 /lib/modules/5.13.12-gentoo/kernel/drivers/hid/hid-lg-g15.ko.gz

   659473     12 -rw-r--r--   1 root     root         8553 Aug 23 14:25 /lib/modules/5.13.12-gentoo/kernel/drivers/hid/hid-logitech.ko.gz

   659479      4 drwxr-xr-x   3 root     root         4096 Aug 23 14:25 /lib/modules/5.13.12-gentoo/kernel/drivers/net

   659482      4 drwxr-xr-x   3 root     root         4096 Aug 23 14:25 /lib/modules/5.13.12-gentoo/kernel/drivers/net/wireless

   659483      4 drwxr-xr-x   3 root     root         4096 Aug 23 14:25 /lib/modules/5.13.12-gentoo/kernel/drivers/net/wireless/ath

   659487     16 -rw-r--r--   1 root     root        14514 Aug 23 14:25 /lib/modules/5.13.12-gentoo/kernel/drivers/net/wireless/ath/ath.ko.gz

   659486      4 drwxr-xr-x   2 root     root         4096 Aug 23 14:25 /lib/modules/5.13.12-gentoo/kernel/drivers/net/wireless/ath/ath9k

   659498      8 -rw-r--r--   1 root     root         5728 Aug 23 14:25 /lib/modules/5.13.12-gentoo/kernel/drivers/net/wireless/ath/ath9k/ath9k_common.ko.gz

   659499     44 -rw-r--r--   1 root     root        44785 Aug 23 14:25 /lib/modules/5.13.12-gentoo/kernel/drivers/net/wireless/ath/ath9k/ath9k_htc.ko.gz

   659500    156 -rw-r--r--   1 root     root       159488 Aug 23 14:25 /lib/modules/5.13.12-gentoo/kernel/drivers/net/wireless/ath/ath9k/ath9k_hw.ko.gz

   659454      4 drwxr-xr-x   3 root     root         4096 Aug 23 14:25 /lib/modules/5.13.12-gentoo/kernel/drivers/gpu

   659456      4 drwxr-xr-x   4 root     root         4096 Aug 23 14:25 /lib/modules/5.13.12-gentoo/kernel/drivers/gpu/drm

   659458      4 -rw-r--r--   1 root     root         1804 Aug 23 14:25 /lib/modules/5.13.12-gentoo/kernel/drivers/gpu/drm/drm_ttm_helper.ko.gz

   659457      4 drwxr-xr-x   2 root     root         4096 Aug 23 14:25 /lib/modules/5.13.12-gentoo/kernel/drivers/gpu/drm/nouveau

   659460    912 -rw-r--r--   1 root     root       932019 Aug 23 14:25 /lib/modules/5.13.12-gentoo/kernel/drivers/gpu/drm/nouveau/nouveau.ko.gz

   659459      4 drwxr-xr-x   2 root     root         4096 Aug 23 14:25 /lib/modules/5.13.12-gentoo/kernel/drivers/gpu/drm/ttm

   659462     32 -rw-r--r--   1 root     root        31643 Aug 23 14:25 /lib/modules/5.13.12-gentoo/kernel/drivers/gpu/drm/ttm/ttm.ko.gz

   659463      4 drwxr-xr-x   4 root     root         4096 Aug 23 14:25 /lib/modules/5.13.12-gentoo/kernel/drivers/input

   659476      4 drwxr-xr-x   2 root     root         4096 Aug 23 14:25 /lib/modules/5.13.12-gentoo/kernel/drivers/input/tablet

   659478      8 -rw-r--r--   1 root     root         4595 Aug 23 14:25 /lib/modules/5.13.12-gentoo/kernel/drivers/input/tablet/wacom_serial4.ko.gz

   659477      4 drwxr-xr-x   2 root     root         4096 Aug 23 14:25 /lib/modules/5.13.12-gentoo/kernel/drivers/input/touchscreen

   659481      8 -rw-r--r--   1 root     root         5421 Aug 23 14:25 /lib/modules/5.13.12-gentoo/kernel/drivers/input/touchscreen/wacom_w8001.ko.gz

   659480      4 -rw-r--r--   1 root     root         2920 Aug 23 14:25 /lib/modules/5.13.12-gentoo/kernel/drivers/input/touchscreen/wacom_i2c.ko.gz
```

 As mentioned in my post above, with kernel 5.13 I switched the module compression away from gz. I changed that but did not have time to restart and test if that is/was the problem. The same for Jaglovers advice, I did not test it yet.

----------

## hno2

So yes, the compression of the modules with the zstd algorithm was the problem. It seems I forgot to check an option for that, will further investigate. Thanks to everybody so far for pushing me into the right direction!

----------

## Jaglover

Kernel sources have efficient dependency control, you should file a bug if it let you to build a module with disabled compression method. Unless you edited .config  by hand ...

----------

## hno2

No, I was only using the nconfig ui. I will do a test about the reproducibility and file a bug report. Should I file it with gentoo first or directly upstream?

----------

## hno2

https://bugs.gentoo.org/811522 filed

----------

## hno2

Solution found. For me it was a missing ZSTD use flag for kmod.

----------

