Skip to content

[release/2.1] cri: Fix image volumes with user namespaces#12894

Merged
AkihiroSuda merged 1 commit intocontainerd:release/2.1from
rata:rata/release-2.1-fix-image-volume-userns
Mar 9, 2026
Merged

[release/2.1] cri: Fix image volumes with user namespaces#12894
AkihiroSuda merged 1 commit intocontainerd:release/2.1from
rata:rata/release-2.1-fix-image-volume-userns

Conversation

@rata
Copy link
Copy Markdown
Contributor

@rata rata commented Feb 13, 2026

This is a backport of #12816 for release 2.1.

Release 2.1 also has this bug, when using a pod with an image volume source and userns:

  Warning  Failed     36s (x4 over 82s)  kubelet            Error: failed to create containerd task: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: failed to fulfil mount request: failed to set MOUNT_ATTR_IDMAP on /run/containerd-rata/io.containerd.grpc.v1.cri/image-volumes/df5958c01c5df9cb67c8e9d1143f0282cbdbc01675f6b010d228b39c528ba24b/2c91e484d93f0830a7e05a2b9d92a7b102be7cab562198b984a84fdbc7806d91: invalid argument (maybe the filesystem used doesn't support idmap mounts on this kernel?)

With the backport, it works fine.

cc @estesp @AutuSnow


This backport had conflicts in
internal/cri/server/container_image_mount.go. The code that calls c.getImageVolumeSnapshotOpts() and s.Prepare()` was moved inside an if in release 2.2 and main, so the conflict resolution was quite simple (just move it out of the if).

Also, in 2.1 WithIDMapImageVolumeMount() in main_test.go doesn't take an argument for sub_path (this was added in 2.2). But this test was not using a subpath (just ""), so I just removed that param.

(cherry picked from commit db9546b)

Fix image volumes when using user namespaces in CRI

@github-project-automation github-project-automation Bot moved this to Needs Triage in Pull Request Review Feb 13, 2026
@rata rata changed the title cri: Fix image volumes with user namespaces [release/2.1] cri: Fix image volumes with user namespaces Feb 13, 2026
@dosubot dosubot Bot added area/cri Container Runtime Interface (CRI) kind/bug labels Feb 13, 2026
@rata rata force-pushed the rata/release-2.1-fix-image-volume-userns branch 2 times, most recently from 38d3232 to 8b82be7 Compare February 13, 2026 15:29
@rata rata force-pushed the rata/release-2.1-fix-image-volume-userns branch from 6396799 to 8b82be7 Compare February 13, 2026 16:48
@rata rata force-pushed the rata/release-2.1-fix-image-volume-userns branch from 8b82be7 to 99f37e3 Compare February 16, 2026 09:01
@estesp
Copy link
Copy Markdown
Member

estesp commented Feb 16, 2026

Doesn't seem like your PR would have caused these failures; do we have another PR in this branch that is succeeding without the changes to the ctr command?

[edit] answered my own question; yes, all other PRs in release/2.1 are failing on this test as well :-}

@rata
Copy link
Copy Markdown
Contributor Author

rata commented Feb 16, 2026

@estesp and now main too. I've found the issue and opened #12903. Can you help me with a review? :)

@estesp
Copy link
Copy Markdown
Member

estesp commented Feb 16, 2026

@estesp and now main too. I've found the issue and opened #12903. Can you help me with a review? :)

It's in the merge queue and then we'll do the backport dance.. by the end of the day we should be back to working across all branches 😅

@estesp
Copy link
Copy Markdown
Member

estesp commented Feb 16, 2026

@rata you can re-base and remove the CI patches and we should get clean CI now!

@rata rata force-pushed the rata/release-2.1-fix-image-volume-userns branch from 3892efb to 350845f Compare February 17, 2026 09:56
This backport had conflicts in
`internal/cri/server/container_image_mount.go`. The code that calls
`c.getImageVolumeSnapshotOpts() and `s.Prepare()` was moved inside an if
in release 2.2 and main, so the conflict resolution was quite simple
(just move it out of the if).

Also, in 2.1 WithIDMapImageVolumeMount() in main_test.go doesn't take an
argument for sub_path (this was added in 2.2). But this test was not
using a subpath (just ""), so I just removed that param.

Signed-off-by: qiuxue <[email protected]>
(cherry picked from commit db9546b)
Signed-off-by: Rodrigo Campos <[email protected]>
@rata rata force-pushed the rata/release-2.1-fix-image-volume-userns branch from 350845f to 8d53519 Compare February 17, 2026 10:03
@rata
Copy link
Copy Markdown
Contributor Author

rata commented Feb 17, 2026

The failure in almalinux seems an external issue to containerd:

    default:   [FAILED] failed to pull image: failed to pull and unpack image "registry.k8s.io/e2e-test-images/nonewprivs:1.3": failed to copy: read tcp 192.168.121.225:33422->52.219.117.168:443: read: connection reset by peer

I did amend (without changes) and pushed to kick again the CI, but I can't get rid of this failure. I'll try again later

@rata
Copy link
Copy Markdown
Contributor Author

rata commented Feb 17, 2026

@estesp done, but registry.k8s.io is causing some intermitent failures on CI now :(

@github-project-automation github-project-automation Bot moved this from Needs Triage to Review In Progress in Pull Request Review Mar 9, 2026
@AkihiroSuda AkihiroSuda merged commit 5caddcf into containerd:release/2.1 Mar 9, 2026
89 of 90 checks passed
@github-project-automation github-project-automation Bot moved this from Review In Progress to Done in Pull Request Review Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/cri Container Runtime Interface (CRI) impact/changelog kind/bug size/L

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants