What's wrong with zram-swap?

Hi, I have tried to enable zram-swap on tp link wr1043nd v3 (64/8), but I run into problems:

  1. with zram-swap package added to firmware selector:
dmesg | grep zram
[   18.919341] zram: Added device: zram0
[   27.148085] zram: Cannot initialise lzo-rle compressing backend
  1. installing as package:
opkg install zram-swap
Installing zram-swap (32) to root...
Downloading https://downloads.openwrt.org/releases/24.10.0/packages/mips_24kc/base/zram-swap_32_all.ipk
Configuring zram-swap.
zram_start: activating '/dev/zram0' for swapping (27 MiB)
zram_reset: enforcing defaults via /sys/block/zram0/reset
zram_comp_algo: set compression algorithm 'lzo' for zram '/dev/zram0'
sh: write error: Invalid argument
sh: write error: Invalid argument
mkswap: image is too small
swapon: /dev/zram0: Invalid argument

Zram-swap on mikrotik hap ac2 (128/16), which I have installed 2 months ago, works fine. Both routers run openwrt 24.10.0,

Any advice what I can try? Thank you.

this

vs this

1 Like

24.10 has swap disabled for lowmem ie 8/64

1 Like

Oh, really? That's unfortunate, lowmem devices need it even more. I'd expect "don't try this at home" error message instead, but if that's so :frowning: Thanks for reply. I still remember running zram swap at 16/4 device when it was fresh and I still run many 32/4 routers with openwrt 18 on different places, where I don't need gigabits. I know factory firmware stops receiving updates the day it comes out, but it is somehow sad electronic-waste-wise.

Compiling your own image an enabling the required option CONFIG_KERNEL_SWAP is still an option. It is not possible to compile swap support as a module, which is why you cannot enable this via the image builder or fw-selector/ASU. So instead you have to build your own image with that option and the corresponding zswap packages enabled.

I expect enabling swap in itself to have some overhead, so that is probably why it is not enabled on low end platforms.

2 Likes

Thank you, that's it! This should be the accepted answer. Since there's online image builder, which is very cosy and way faster, I almost forgot I can compile myself and tick the options in make menuconfig as in the old days :slight_smile: I'll go this way then.

zram does not work for you, because you need to add another package

zram-swap kmod-lib-lz4
This is for lz4

enters into force after rebooting the router

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.