Skip to content

bug(containerd): Pod creation fails consistently: failed to create containerd task: failed to create shim task: OCI runtime create failed: chown /dev/stdout: permission denied: unknown #2385

@liviobue

Description

@liviobue

What happened:
This issue is similar to issue 2366 (can be merged if possible)

When applying the provided manifest with an initContainer specifying a non-root user (runAsUser: 1337) and restrictive securityContext settings (privileged: false, allowPrivilegeEscalation: false), the Pod fails to start the initContainer. The error occurs during container initialization with the message:

unable to start container process: error during container init: unable to setup user: chown /dev/stdout: permission denied: unknown.

Running the initContainer as root (runAsUser: 0) bypasses this problem, and the Pod starts successfully.

What you expected to happen:
The Pod should start the initContainer with the specified non-root user and securityContext settings without encountering permission denied errors, allowing the container initialization to complete successfully.

How to reproduce it:

  1. Apply the following Pod manifest:
apiVersion: v1
kind: Pod
metadata:
  name: init-seccontext-example
  namespace: default
spec:
  initContainers:
  - name: privileged-init
    image: busybox
    command:
    - sh
    - -c
    - |
      echo "Hello"
    securityContext:
      runAsUser: 1337
      privileged: false
      allowPrivilegeEscalation: false
  containers:
  - name: main-container
    image: busybox
    command:
    - sh
    - -c
    - |
      echo "Running main container"; sleep 3600
    securityContext:
      runAsUser: 0
      allowPrivilegeEscalation: true
      privileged: true
      runAsNonRoot: false
  restartPolicy: Never
  securityContext:
    seccompProfile:
      type: RuntimeDefault
  1. Observe the following Pod events indicating failure:
Type     Reason     Age    From               Message
----     ------     ----   ----               -------
Normal   Scheduled  5m14s  default-scheduler  Successfully assigned default/init-seccontext-example to ip-x.x.x.x.eu-central-2.compute.internal
Normal   Pulling    5m13s  kubelet            Pulling image "busybox"
Normal   Pulled     5m12s  kubelet            Successfully pulled image "busybox" in 784ms (784ms including waiting). Image size: 2223685 bytes.
Normal   Created    5m12s  kubelet            Created container: privileged-init
Warning  Failed     5m12s  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: unable to setup user: chown /dev/stdout: permission denied: unknown
  1. Modify the initContainer's runAsUser to 0 (root). (remove also: privileged: false, allowPrivilegeEscalation: false)

  2. Reapply the manifest and observe the Pod starts successfully without the error.

Environment:

  • AWS Region: eu-central-2
  • Instance Type(s): t3.xlarge
  • Cluster Kubernetes version: v1.32.7-eks-ace6451
  • Node Kubernetes version: v1.32.7-eks-3abbec1
  • AMI Version: amazon-eks-node-al2023-x86_64-standard-1.32-v20250813

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions