Subject: Re: Zstd compression not available on Raspberry Pi

From: "♟ Maggew.com" <[email-masked]>
Date: Thu, 10 Apr 2025 00:14:44 -0400

Check kernel version

Zstd support was added in 4.18

uname -r

Check and make sure Zstd is running

zcat /proc/config.gz | grep ZSTD

You should see something like this:

CONFIG_ZSTD_COMPRESS=y

If not recompile kernel with Zstd support. 

Ensure it’s correctly set in file /etc/conf.d/zram-init

algo0=lzo-rle
algo1=zstd
algo2=zstd
algo3=zstd

Restart service with

/etc/init.d/zram-init restart

---

From: Ian Smith <[email-masked]>
Date: Fri, 11 Apr 2025 10:07:54 +0100

Hi Matt,

Thanks for replying!

I don't think that file exists on the Pi:

$ zcat /proc/config.gz | grep ZSTD
zcat: /proc/config.gz: No such file or directory

(for info)
$ plocate config.gz
/usr/share/man/man5/proc_config.gz.5.gz

But I am now pretty sure it is not compiled in (to crypto), as zstd and
lz4 modules load OK:

$ lsmod|grep z
Module                  Size  Used by
zram                   36864  1
zstd                   12288  0
lz4                    12288  0
lz4_compress           24576  1 lz4

Contrast with a Debian system (PiOS):

$ lsmod|grep z
Module                  Size  Used by
zram                   65536  1
lz4_compress           49152  1 zram

where the lz4_compress module is clearly identified with zram.

I will investigate what is involved in building a kernel in Alpine, if
it is not too hard I will try it.

Cheers,

Ian.

---

From: Ian Smith <[email-masked]>
Date: Fri, 11 Apr 2025 11:04:34 +0100

Hi Matt,

I found the file.

$ cat /boot/config-6.12.13-0-rpi |grep ZSTD
CONFIG_RD_ZSTD=y
# CONFIG_MODULE_COMPRESS_ZSTD is not set
# CONFIG_ZSWAP_COMPRESSOR_DEFAULT_ZSTD is not set
CONFIG_FW_LOADER_COMPRESS_ZSTD=y
# CONFIG_ZRAM_BACKEND_ZSTD is not set
CONFIG_UBIFS_FS_ZSTD=y
CONFIG_SQUASHFS_ZSTD=y
CONFIG_CRYPTO_ZSTD=m
CONFIG_ZSTD_COMMON=y
CONFIG_ZSTD_COMPRESS=y
CONFIG_ZSTD_DECOMPRESS=y
CONFIG_DECOMPRESS_ZSTD=y

$ cat /boot/config-6.12.13-0-rpi |grep LZ4
CONFIG_RD_LZ4=y
# CONFIG_ZSWAP_COMPRESSOR_DEFAULT_LZ4 is not set
# CONFIG_ZSWAP_COMPRESSOR_DEFAULT_LZ4HC is not set
# CONFIG_ZRAM_BACKEND_LZ4 is not set
# CONFIG_ZRAM_BACKEND_LZ4HC is not set
CONFIG_SQUASHFS_LZ4=y$ lsmod|grep crypto

CONFIG_CRYPTO_LZ4=m
# CONFIG_CRYPTO_LZ4HC is not set
CONFIG_LZ4_COMPRESS=m
CONFIG_LZ4HC_COMPRESS=m
CONFIG_LZ4_DECOMPRESS=y
CONFIG_DECOMPRESS_LZ4=y

Looks like it is enabled, and the modules load from /ec/modules, but are
not hooked into the crypto stuff.

I tried this in case I had missed something:

$ lsmod|grep crypto

Cheers,

Ian.

---

From: Ian Smith <[email-masked]>
Date: Fri, 18 Apr 2025 11:33:50 +0100

I now have an "edge" machine, and all methods are available there.