Restart-policy containers loop on "unable to apply apparmor profile" after reboot until the creating user logs in (OCI hook inherits the client's XDG_RUNTIME_DIR)
Los mantenedores suelen responder en 3 días
@Shubhranshu153 ya está trabajando en esto.
Desde el 2/12/2026.
- #5380 de @sapnasingh4852-source — cerrado sin fusionar
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 72/100
Línea de trabajo
Start by tracing withNerdctlOCIHook and the createRuntime hook's loadAppArmor() path, then inspect how the hook environment supplies XDG_RUNTIME_DIR to containerd's LoadDefaultProfile. Reproduce with the issue's restart-policy steps and an unset runtime directory. Done when rootful containers restart after reboot without the creating user logging in, with a regression test covering the missing runtime directory.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Description
After a reboot, rootful containers with a restart policy loop on:
runc create failed: ... unable to apply apparmor profile: apparmor failed to apply profile: write /proc/self/attr/apparmor/exec: no such file or directory
They recover on their own as soon as the user who created them logs in.
Cause: withNerdctlOCIHook stores the client's whole os.Environ() as the hooks' env. The createRuntime hook's loadAppArmor() calls containerd's LoadDefaultProfile, which writes its temp file to os.CreateTemp(os.Getenv("XDG_RUNTIME_DIR"), ...). If the containers were created over SSH, that path is something like /run/user/0, which doesn't exist after boot until that user logs in. The load fails (logged only in oci-hook.createRuntime.log), and runc then fails with the error above:
failed to load AppArmor profile "nerdctl-default" error="open /run/user/4242/nerdctl-default3219038152: no such file or directory"
Steps to reproduce the issue
As root, with no other nerdctl containers restarting meanwhile:
nerdctl apparmor load
XDG_RUNTIME_DIR=/run/user/4242 nerdctl run -d --name aa-repro --restart=always alpine sleep infinity
echo -n nerdctl-default > /sys/kernel/security/apparmor/.remove # simulate reboot
kill -9 "$(nerdctl inspect aa-repro --format '{{.State.Pid}}')"
nerdctl logs aa-repro # fails every ~10 s
mkdir -m 700 /run/user/4242 # simulate login: container starts within seconds
Describe the results you received and expected
Expected: containers start after boot without anyone logging in. Possible fixes: don't put XDG_RUNTIME_DIR in the hook env (rootful), or fall back to os.TempDir() when it's missing.
Workaround: a oneshot systemd unit that runs nerdctl apparmor load, ordered Before=containerd.service.
What version of nerdctl are you using?
v2.3.5 (reproduced). Same code in v2.4.2.
Are you using a variant of nerdctl? (e.g., Rancher Desktop)
None
Host information
Debian 13, kernel 6.12.117, AppArmor 4.1.0, containerd v2.3.3, runc 1.5.1, rootful.
- Lenguaje dominante
- Go
- Estrellas
- 10.5k
- Forks
- 853
- Merge medio
- 6 d 14 h
- PR fusionados (30 d)
- 38
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de containerd/nerdctl
-
Test and examples: update wordpress images (to silence potential false security alerts)Posiblemente ocupada @Guurdeep la tomó hace 20 días. Abiertoarea/ci documentation priority/low
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
containerd/nerdctl#5283 · 2 comentarios ·
Los mantenedores suelen responder en 3 días
-
`nerdctl kill` shouldn't set `containerd.io/restart.explicitly-stopped` label for non-stop signalsQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
containerd/nerdctl#5171 · 3 comentarios ·
Los mantenedores suelen responder en 3 días
-
area/project
Dificultad 1/5 Menos de una hora Aptitud para principiantes 25/100
containerd/nerdctl#5383 · 5 comentarios ·
Los mantenedores suelen responder en 3 días
-
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
containerd/nerdctl#5355 ·
Los mantenedores suelen responder en 3 días
-
v2.4.3 planningAbiertoarea/project
Dificultad 5/5 Más de una semana Aptitud para principiantes 12/100
containerd/nerdctl#5353 · 2 reacciones ·
Los mantenedores suelen responder en 3 días
Todos los issues de containerd/nerdctl
Issues similares
-
P3 tech debt
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
Los mantenedores suelen responder en 1 día
-
kind/feature needs-triage priority/unprioritized
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
NVIDIA/k8s-test-infra#1504 ·
Los mantenedores suelen responder en 1 día
-
Area/Infrastructure Aspect/Infra Resources Type/Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
wso2/agent-manager#2717 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
open-policy-agent/opa#9685 · 1 comentario ·
Los mantenedores suelen responder en 1 día