Run the following commands on linux (4.4.59 and 4.9.8 are tested) will fail:
mkdir -p /tmp/proc
mount -t overlay overlay -o lowerdir=/proc:/tmp/proc /tmp/proc
and there is a error message in dmesg:
overlayfs: maximum fs stacking depth exceeded
Why can't /proc be a layer of a overlay file system?
If I replace /proc
with /dev
or /sys
, it mounts without issue, so it seems there is something special with /proc
.
P.S. The use case is creating a safer chroot environment, I want to make /dev
, /sys
and /proc
read-only in chroot.