Images with 60 or more layers fail to start: "mount …/rootfs: No such file or directory"

Abierto
#253 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
docker, linux, rust

Línea de trabajo

Start with mount_rootfs in crates/kiri-init/src/linux/container.rs and inspect how it builds overlayfs mount options. The report identifies the 4 KiB mount option limit and says the Linux engine needs a fallback for older kernels; it also describes a branch that uses the newer mount API and a test mounting 120 layers. Done means the 60 layer repro starts, the 120 layer test passes, and older Linux kernels retain the fallback.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Kiri version and system

0.2.1 built from the v0.2.1 tag (0.2.0 release does the same) on macOS 27.2 (Apple silicon)

What you did

I hit this with nixos/nix, which has 69 layers. Here's a smaller repro:

mkdir layers65 && cd layers65
{ echo "FROM alpine:3.22"; for i in $(seq 1 64); do echo "RUN echo $i > /layer-$i"; done; } > Dockerfile
docker build -t layers65 .
docker run --rm layers65 cat /layer-64

and

docker run --rm nixos/nix:2.34.9 nix --version
What happened
docker: Error response from daemon: run <id>: mount /var/lib/kiri/containers/<id>/rootfs: No such file or directory (os error 2)
What you expected instead

The container starts. Both work on Docker and OrbStack.

Anything else

It's exactly at 60: with 59 layers (alpine plus 58 RUN lines) the image
starts, with 60 it doesn't.

I think it's the mount options getting too long. mount_rootfs
(crates/kiri-init/src/linux/container.rs:406) puts every layer in one
lowerdir= string, and each layer is a 64-character hash, so about 65
bytes per layer. mount(2) only copies one page (4 KiB) of options, so
around 60 layers the string gets cut off in the middle of a name and
overlayfs can't find that directory.

The guest kernel is 6.18, so the newer mount API can take each layer
separately with lowerdir+ (6.8 and later), which goes up to overlayfs's
own limit of 500. I've got that working on a branch, with a fallback to
the current mount(2) call for older kernels on the Linux engine and a
test that mounts 120 layers. nixos/nix runs with it. Happy to open a PR
if you'd like it done that way.

Lenguaje dominante
Rust
Estrellas
7.5k
Forks
329
Merge medio
7 h 48 min
PR fusionados (30 d)
105

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de libracoder/kiri

Todos los issues de libracoder/kiri

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.