Skip to content

feat: enable CONFIG_SQUASHFS=m for kernel-6.12 and kernel-6.18#442

Open
ginglis13 wants to merge 2 commits into
bottlerocket-os:developfrom
ginglis13:feature/squashfs-module
Open

feat: enable CONFIG_SQUASHFS=m for kernel-6.12 and kernel-6.18#442
ginglis13 wants to merge 2 commits into
bottlerocket-os:developfrom
ginglis13:feature/squashfs-module

Conversation

@ginglis13
Copy link
Copy Markdown
Contributor

@ginglis13 ginglis13 commented May 20, 2026

Issue number:

Closes bottlerocket-os/bottlerocket#4845

Description of changes:

Enable the squashfs kernel module so that userspace applications
can mount squashfs filesystems. This restores the squashfs support
that was present in kernel-6.1 but dropped in newer kernels.

Configs are copied as the kernel-6.1 configs for squashfs:

# Support for squashfs used to provide kernel headers with zstd compression
CONFIG_SQUASHFS=m
CONFIG_SQUASHFS_FILE_CACHE=y
# CONFIG_SQUASHFS_FILE_DIRECT is not set
CONFIG_SQUASHFS_DECOMP_SINGLE=y
# CONFIG_SQUASHFS_DECOMP_MULTI is not set
# CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU is not set
CONFIG_SQUASHFS_XATTR=y
CONFIG_SQUASHFS_ZLIB=y
CONFIG_SQUASHFS_LZ4=y
CONFIG_SQUASHFS_LZO=y
CONFIG_SQUASHFS_XZ=y
CONFIG_SQUASHFS_ZSTD=y
# CONFIG_SQUASHFS_4K_DEVBLK_SIZE is not set
# CONFIG_SQUASHFS_EMBEDDED is not set
CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3
All configs added with a value of y are boolean, hence why they are not m.

Only config-bottlerocket files generated by hand. All other configs generated with make full-config ran on both x86 and aarch64 hosts.

Testing done:

Pod for testing:

Details
apiVersion: v1
kind: Pod
metadata:
  name: test-squashfs
  namespace: default
spec:
  containers:
  - name: test
    image: public.ecr.aws/amazonlinux/amazonlinux:2023
    command:
    - /bin/bash
    - -c
    - |
      set -x

      echo "=== Installing tools ==="
      yum install -y util-linux kmod squashfs-tools procps-ng > /dev/null 2>&1

      echo ""
      echo "=== Kernel version ==="
      uname -r

      echo ""
      echo "=== Check if squashfs module is available ==="
      modprobe squashfs && echo "modprobe squashfs: OK" || echo "modprobe squashfs: FAILED"

      echo ""
      echo "=== Verify module is loaded ==="
      lsmod | grep squashfs

      echo ""
      echo "=== Check /proc/filesystems for squashfs ==="
      cat /proc/filesystems | grep squashfs

      echo ""
      echo "=== Test from issue #4845: mount a dummy squashfs file ==="
      echo "Expected: 'wrong fs type, bad option, bad superblock' (means kernel recognizes squashfs)"
      echo "Failure:  'unknown filesystem type squashfs' (means module not available)"
      for i in 0 1 2 3 4 5 6 7; do mknod -m 660 /dev/loop$i b 7 $i 2>/dev/null || true; done
      truncate -s 4K /tmp/f.sqfs && mkdir -p /tmp/m
      mount -t squashfs -o loop /tmp/f.sqfs /tmp/m 2>&1; echo "exit code: $?"

      echo ""
      echo "=== Test with a real squashfs image ==="
      mkdir -p /tmp/squashfs-root
      echo "hello from squashfs" > /tmp/squashfs-root/hello.txt
      mksquashfs /tmp/squashfs-root /tmp/real.sqfs -noappend -quiet
      mkdir -p /tmp/mnt
      mount -t squashfs -o loop /tmp/real.sqfs /tmp/mnt
      echo "Mount exit code: $?"
      echo "Contents:"
      cat /tmp/mnt/hello.txt
      umount /tmp/mnt

      echo ""
      echo "=== Test compression algorithms ==="
      for algo in gzip lz4 lzo xz zstd; do
        mksquashfs /tmp/squashfs-root /tmp/test-${algo}.sqfs -noappend -quiet -comp ${algo} 2>/dev/null
        if mount -t squashfs -o loop /tmp/test-${algo}.sqfs /tmp/mnt 2>/dev/null; then
          echo "${algo}: OK ($(cat /tmp/mnt/hello.txt))"
          umount /tmp/mnt
        else
          echo "${algo}: FAILED"
        fi
      done

      echo ""
      echo "=== dmesg squashfs entries ==="
      dmesg | grep -i squashfs | tail -10

      echo ""
      echo "=== DONE ==="
      sleep infinity
    securityContext:
      privileged: true
    volumeMounts:
    - name: modules
      mountPath: /lib/modules
      readOnly: true
  volumes:
  - name: modules
    hostPath:
      path: /lib/modules
  restartPolicy: Never
  nodeSelector:
    kubernetes.io/arch: amd64

aws-k8s-1.36-x86_64 (kernel-6.18) and aws-k8s-1.35-x86_64 (kernel-6.12) used for test with the following results:

Kernel 6.12 (k8s-1.35) Kernel 6.18 (k8s-1.36)
modprobe squashfs OK OK
Issue #4845 test correct "bad superblock" correct "bad superblock"
Real mount OK OK
gzip OK OK
lz4 OK OK
lzo OK OK
xz OK OK
zstd OK OK

Terms of contribution:

By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.

@ginglis13 ginglis13 marked this pull request as ready for review May 20, 2026 22:35
@ginglis13 ginglis13 requested review from arnaldo2792 and mgsharm May 20, 2026 22:35
@ginglis13 ginglis13 force-pushed the feature/squashfs-module branch from b933182 to a48626f Compare May 20, 2026 23:31
@ginglis13
Copy link
Copy Markdown
Contributor Author

^ force push moves the module to be in alphabetical order and brings the squashfs config to the top of config-bottlerocket

Comment thread packages/kernel-6.12/config-bottlerocket
Comment thread packages/kernel-6.12/config-bottlerocket
ginglis13 added 2 commits May 21, 2026 17:21
Signed-off-by: Gavin Inglis <giinglis@amazon.com>
Signed-off-by: Gavin Inglis <giinglis@amazon.com>
@ginglis13 ginglis13 force-pushed the feature/squashfs-module branch from a48626f to ff5c48f Compare May 21, 2026 17:33
@ginglis13 ginglis13 requested a review from arnaldo2792 May 21, 2026 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add support for squashfs kernel module

3 participants