ZRAM problem on Ubiquiti UniFi AC Lite

Hi,
I installed most recent snapshot on Ubiquiti UniFi AC Lite and Ubiquiti UniFi AC Pro.
While having similar config on both, I can't make ZRAM working on AC Lite, on AC Pro it works.
Am I missing something please ?

Thank you.

Wed Sep 16 23:34:25 2020 kern.info kernel: [   11.210869] zram: Added device: zram0
Wed Sep 16 23:34:26 2020 daemon.debug zram_start: activating '/dev/zram0' for swapping (60 MegaBytes)
Wed Sep 16 23:34:26 2020 daemon.notice procd: /etc/rc.d/S15zram: zram_start: activating '/dev/zram0' for swapping (60 MegaBytes)
Wed Sep 16 23:34:26 2020 daemon.debug zram_reset: enforcing defaults via /sys/block/zram0/reset
Wed Sep 16 23:34:26 2020 daemon.notice procd: /etc/rc.d/S15zram: zram_reset: enforcing defaults via /sys/block/zram0/reset
Wed Sep 16 23:34:26 2020 kern.err kernel: [   19.766624] Can't allocate a compression stream
Wed Sep 16 23:34:26 2020 kern.err kernel: [   19.771358] zram: Cannot initialise lzo-rle compressing backend
Wed Sep 16 23:34:26 2020 daemon.notice procd: /etc/rc.d/S15zram: sh: write error: Out of memory
Wed Sep 16 23:34:26 2020 daemon.notice procd: /etc/rc.d/S15zram: mkswap: error: swap area needs to be at least 40 KiB
Wed Sep 16 23:34:26 2020 daemon.notice procd: /etc/rc.d/S15zram: swapon: /dev/zram0: Invalid argument
dmesg|grep -i zr
[   11.210869] zram: Added device: zram0
[   19.771358] zram: Cannot initialise lzo-rle compressing backend
[  626.642658] zram: Cannot initialise lzo-rle compressing backend
[  851.170658] zram: Cannot initialise lzo-rle compressing backend
df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 3.0M      3.0M         0 100% /rom
tmpfs                    60.1M    468.0K     59.6M   1% /tmp
/dev/mtdblock5            2.6M      2.0M    624.0K  77% /overlay
overlayfs:/overlay        2.6M      2.0M    624.0K  77% /
tmpfs                   512.0K         0    512.0K   0% /dev

It's a known problem, there's a pending patch to mitigate it (defaulting to lzo, but this probably should be reported upstream). Meanwhile you can manually set the compression algorithm to lzo, which doesn't have this problem.

EDIT: Link to patch.

Thank you for your reply. I actually tried to change compression algorithm already before, but it gives the same error...is this the setting to be changed ?

obrazek

uci get system.main.zram_comp_algo
head -v -n -0 /sys/block/zram*/comp_algorithm
1 Like

uci get system.main.zram_comp_algo

uci: Entry not found

head -v -n -0 /sys/block/zram/comp_algorithm*

==> /sys/block/zram0/comp_algorithm <==
lzo [lzo-rle] lz4

So instead of lzo it's lzo-rle ? Thank you - indeed AC Pro shows LZO only.

1 Like
uci set system.@system[0].zram_comp_algo="lzo"
uci commit system
/etc/init.d/zram restart
1 Like

uci set system.main.zram_comp_algo="lzo"

uci: Invalid argument

;-(

In any case, you can edit the config manually:

grep -e "=.*comp_algo" /etc/init.d/zram
1 Like

Thank you, somehow I don't get it...

option zram_comp_algo 'lzo' is set in /etc/config/system.
Yet, uci do not recognize it ?

I understood I can manually modify startup script yet I would like to understand what is going on here and have also working solution during upgrades - and why on two same version snaphots, same platform, it provides different results ?

Would you mind to share your thoughts please ?

echo lzo > /sys/block/zram0/comp_algorithm

...I will put this to the init yet still don't get it :wink:

Probably an issue with LuCI. I don't use LuCI, so I wasn't aware of it.

1 Like
uci show system

?

Among others entries it shows... ;-(

system.@system[0].zram_comp_algo='lzo'

So maybe correctly it should be ?

uci set system.zram_comp_algo="lzo"

But still, even it was specified even before "by LuCi", it's not reflected as

head -v -n -0 /sys/block/zram*/comp_algorithm

Showed

==> /sys/block/zram0/comp_algorithm <==
lzo [lzo-rle] lz4

Until :

echo lzo > /sys/block/zram0/comp_algorithm

So now it shows :

==> /sys/block/zram0/comp_algorithm <==
[lzo] lzo-rle lz4

1 Like

Your config looks fine, so it may be some sort of race condition.
Try to edit the init script and check if it helps or not.
Also post the output:

/etc/init.d/zram restart

Actually restart didn't work - the output I already shared above. It's the same like in the syslog during startup.

What really changed the behavior was entering the value directly...

echo lzo > /sys/block/zram0/comp_algorithm

Btw, it seems to be now even persistent during reboots, so I don't need to put this to the Init.d.

Btw now also this works ...not throwing error anymore. That's odd.

uci set system.@system[0].zram_comp_algo="lzo"

1 Like