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

Aperta
#253 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
docker, linux, rust

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Rust
Stelle
7.5k
Fork
329
Merge medio
7h 48m
PR unite (30g)
105

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di libracoder/kiri

Tutte le issue di libracoder/kiri

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.