Repository navigation
Description
Description
Containerd's EROFS conversion path can produce internally compressed raw EROFS layers:
ctr images convert --oci --erofs raw --erofs-compressors lz4hc,9 SOURCE TARGET
On containerd 2.3.4, the resulting image pulls and materializes with the EROFS snapshotter, but container creation fails while containerd inspects the root filesystem through fsview. The same source image converted to internally uncompressed EROFS reaches Ready.
github.com/erofs/go-erofs returns its wrapped ErrNotImplemented sentinel for the incompatible compression feature. The EROFS fsview adapter returns that error unchanged, while pkg/oci.withReadonlyFS activates its existing read-only kernel-mount fallback only for containerd's errdefs.ErrNotImplemented.
The two sentinels have the same text but different identities, so the fallback is not activated and the userspace-reader error becomes fatal.
I also reproduced the error-class mismatch in a focused test against containerd main at commit d5a5c42de9bec7dfe5d1da11a048feca6df6d774 with go-erofs v0.3.1. Before the fix, the returned error matches go-erofs's ErrNotImplemented but not containerd's, which explains why the fallback is skipped. A small adapter change makes the error match both sentinels, and the relevant tests pass. I have not yet rerun the full Kubernetes reproduction against the patched build.
Steps to reproduce the issue
Prerequisites are a Linux worker with EROFS kernel support, mkfs.erofs, the containerd EROFS snapshotter, a Kubernetes RuntimeClass selecting that snapshotter, and a disposable registry reachable by the worker. No GPU is needed.
-
On the EROFS-enabled containerd worker, replace
REGISTRY_HOST:PORTand run:set -Eeuo pipefail CTR_NAMESPACE=erofs-fallback-repro SOURCE=registry.k8s.io/pause@sha256:412c4a7219cb8a299a37337f3d87810c5340095322e15594a1637785adad0f17 REGISTRY='REGISTRY_HOST:PORT' SUFFIX=$(date -u +%Y%m%dT%H%M%SZ) REPO="${REGISTRY}/erofs-fallback-repro/pause" COMPRESSED="${REPO}:compressed-lz4hc9-${SUFFIX}" UNCOMPRESSED="${REPO}:uncompressed-${SUFFIX}" ctr -n "${CTR_NAMESPACE}" images pull --platform linux/amd64 "${SOURCE}" ctr -n "${CTR_NAMESPACE}" images convert --oci --erofs raw --erofs-compressors lz4hc,9 --platform linux/amd64 "${SOURCE}" "${COMPRESSED}" ctr -n "${CTR_NAMESPACE}" images convert --oci --erofs raw --platform linux/amd64 "${SOURCE}" "${UNCOMPRESSED}" manifest_digest() { ctr -n "${CTR_NAMESPACE}" images inspect "$1" | grep -m1 -oE 'sha256:[0-9a-f]{64}' } COMPRESSED_DIGEST=$(manifest_digest "${COMPRESSED}") UNCOMPRESSED_DIGEST=$(manifest_digest "${UNCOMPRESSED}") PUSH_FLAGS=() # For a plain-HTTP test registry, uncomment the next line. # PUSH_FLAGS=(--plain-http) ctr -n "${CTR_NAMESPACE}" images push "${PUSH_FLAGS[@]}" --platform linux/amd64 "${COMPRESSED}" ctr -n "${CTR_NAMESPACE}" images push "${PUSH_FLAGS[@]}" --platform linux/amd64 "${UNCOMPRESSED}" printf 'COMPRESSED_IMAGE=%s@%s\n' "${REPO}" "${COMPRESSED_DIGEST}" printf 'UNCOMPRESSED_IMAGE=%s@%s\n' "${REPO}" "${UNCOMPRESSED_DIGEST}"
-
From a host with
kubectlaccess, paste the two emitted references, set the RuntimeClass, and run:set -Eeuo pipefail COMPRESSED_IMAGE='PASTE_COMPRESSED_IMAGE_REFERENCE' UNCOMPRESSED_IMAGE='PASTE_UNCOMPRESSED_IMAGE_REFERENCE' RUNTIME_CLASS='EROFS_RUNTIME_CLASS' SUFFIX=$(date -u +%H%M%S) COMPRESSED_POD="erofs-fallback-compressed-${SUFFIX}" UNCOMPRESSED_POD="erofs-fallback-uncompressed-${SUFFIX}" OVERRIDES=$(printf '{"apiVersion":"v1","spec":{"runtimeClassName":"%s"}}' "${RUNTIME_CLASS}") kubectl run "${COMPRESSED_POD}" --restart=Never --image-pull-policy=Always --image="${COMPRESSED_IMAGE}" --overrides="${OVERRIDES}" reason= for _ in $(seq 1 60); do reason=$(kubectl get pod "${COMPRESSED_POD}" -o jsonpath='{.status.containerStatuses[0].state.waiting.reason}' 2>/dev/null || true) [[ ${reason} == CreateContainerError ]] && break sleep 1 done kubectl get pod "${COMPRESSED_POD}" -o jsonpath='{.status.containerStatuses[0].state.waiting.reason}{"\n"}{.status.containerStatuses[0].state.waiting.message}{"\n"}' kubectl delete pod "${COMPRESSED_POD}" --wait=true kubectl run "${UNCOMPRESSED_POD}" --restart=Never --image-pull-policy=Always --image="${UNCOMPRESSED_IMAGE}" --overrides="${OVERRIDES}" kubectl wait --for=condition=Ready "pod/${UNCOMPRESSED_POD}" --timeout=60s kubectl get pod "${UNCOMPRESSED_POD}" kubectl delete pod "${UNCOMPRESSED_POD}" --wait=true
Describe the results you received and expected
The compressed image pulls successfully, but container creation fails deterministically:
failed to handle lowerdir option: template: :1:3: executing "" at <mount 0>: error calling mount: failed to resolve mount 0: unsupported incompatible feature 0x2: not implemented
The otherwise-identical internally uncompressed EROFS control reaches Ready.
Expected: when go-erofs cannot inspect a known filesystem feature, the EROFS fsview adapter should return an error matching containerd's errdefs.ErrNotImplemented. withReadonlyFS can then attempt its existing read-only kernel-mount fallback.
Successful startup through that fallback is expected when the host kernel supports the exact image, but I have not yet confirmed it with the patched build.
What version of containerd are you using?
containerd 2.3.4 db88095
Any other relevant information
Also tested against containerd main:
containerd main d5a5c42de9bec7dfe5d1da11a048feca6df6d774
go-erofs v0.3.1
- Confirmed runtime kernel: Linux 6.17.0-1022-azure, amd64.
- Confirmed Kubernetes: 1.36.4.
- Confirmed erofs-utils: 1.9.4.
- Compressed control: 372,736 layer bytes,
CreateContainerError. - Uncompressed control: 741,376 layer bytes,
Ready. - The same failure reproduced independently with a 33-layer image.
- Feature
0x2is EROFSCOMPR_CFGS; go-erofs reports it through its wrappedErrNotImplementedsentinel. - A focused pre-fix unit test proves the go-erofs sentinel matches while containerd's sentinel does not.
- With the adapter fix, the regression test and
./internal/fsview/./pkg/ocitests pass. - The fix translates only errors matching go-erofs
ErrNotImplemented; invalid superblocks, path/device failures, and ordinary I/O errors are not translated. - Workaround: omit
--erofs-compressorsand use internally uncompressed raw EROFS. - A separate direct-
ctrplatform-advertisement problem in containerd 2.3.4 is already fixed by snapshots/erofs: advertise the erofs OS feature from the snapshotter plugin #14012 and is not this issue. - I have not yet rerun the Kubernetes reproduction against the patched build; the containerd main evidence is currently source/unit level.
Show configuration if it is related to CRI plugin.
The reproduction used a Kubernetes RuntimeClass handler selecting the EROFS snapshotter. The relevant sanitized containerd configuration is equivalent to:
[plugins.'io.containerd.cri.v1.runtime'.containerd.runtimes.erofs]
runtime_type = "io.containerd.runc.v2"
snapshotter = "erofs"The RuntimeClass handler must match the configured runtime name. The actual deployment-specific handler name may differ; containerd logs confirmed that the EROFS snapshotter was selected for both image pull and container creation.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity