Unable to mount SquashFS filesystem with zstd compression

I want to mount a SquashFS filesystem on a directory to view the content inside:

root@OpenWrt:~# mount -t squashfs "my_filesystem.sqfs" "/mnt"
mount: mounting /dev/loop0 on test failed: Invalid argument

The kernel complains about unsupported compression algorithm:

root@OpenWrt:~# dmesg
[38076.978316] Filesystem uses "zstd" compression. This is not supported

I already install these following packages, yet it doesn't work:

root@OpenWrt:~# opkg list-installed
kmod-fs-squashfs - 5.10.120-1
kmod-lib-zstd - 5.10.120-1

I am not sure if kmod-fs-squashfs is needed, because cat /proc/filesystems shows SquashFS by default, without that package installed.

On the other hand, xz based SquashFS images work just fine. What should I do to make zstd based images work? I am on OpenWrt 22.03-rc4.

As squashfs is often used on heavily storage constrained systems, it offers quite extensive modularity on the source level - compression algorithms can be enabled/ disabled at build time as needed. For OpenWrt's kernel in general, only SQUASHFS_XZ is enabled and all alternative compressors deactivated (zlib, lzo, lz4, lzma), you would have to changes its configuration and rebuild OpenWrt to change that.

tl;dr: SQUASHFS_ZSTD is not supported by OpenWrt at this point, at least not by official images and without manually changing the build configuration.


Thanks for the information.

Most of the time, when OpenWrt custom kernel complains about some missing component, it should be solved easily by installing the kernel module. Do you know why kmod-lib-zstd does not solve the issue? In other word, why is it impossible to add support for zstd based SquashFS via kernel modules?

Because squashfs doesn't care about the presence of that library. The squashfs kernel module can only be configured at buildtime which compressors it's supposed to support, all or only a subset of the potential ones. A general purpose linux distribution tends to enable all of them, for size reasons, OpenWrt is more picky and enabled xz exclusively. As this needs to be decided at build-time, only one squashfs module can be available, with its build-time decided feature set - it is not possible to offer individual (hypothetical) kmod-squashfs-xz, kmod-squashfs-zstd, kmod-squashfs-lzo, kmod-squashfs-lz4 or kmod-squashfs-all packages, there can only be one squashfs module (and for OpenWrt, it's built statically into the kernel, as it's among the first features that must be available to boot, without an initramfs available), and in OpenWrt, that only speaks xz.


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