Run the following commands on linux (4.4.59 and 4.9.8 are tested) and it will fail:
mkdir -p /tmp/proc mount -t overlay overlay -o lowerdir=/proc:/tmp/proc /tmp/proc
and there is a error message in
overlayfs: maximum fs stacking depth exceeded
/proc be a layer of a overlay file system?
If I replace
/sys, it mounts without issue, so it seems there is something special with
P.S. The use case is creating a safer
chroot environment, I want to make
/proc read-only in
chroot. There are 2 known workarounds:
- read-only bind mount. The limitation is two commnads instead one required.
- read-only special mount:
mount -t proc -o ro none /tmp/proc. The limitation is sub-mount not mapped automatically.
Anyway, I'm still curious about why
/sys play well with overlay but
The question is migrated from stackoverflow.