I Cannot overlay mount after creating an mount namespace with unshare
$ unshare -rm
# mount -t overlay overlay -o lowerdir=/bin,upperdir=/overlay/upper/bin,workdir=/overlay/work/bin/ /overlay/merged/bin/
mount: /overlay/merged/bin: permission denied.
Also tried
$ unshare -rmpf --mount-proc
# mount -t overlay overlay -o lowerdir=/bin,upperdir=/overlay/upper/bin,workdir=/overlay/work/bin/ /overlay/merged/bin/
mount: /overlay/merged/bin: permission denied.
Is this a limitation of wsl or because I'm not really root or am I missing something?
bind mount works
# mount --bind /bin /overlay/merged/bin/
# grep bin /proc/self/mountinfo
127 126 0:19 / /proc/sys/fs/binfmt_misc rw,relatime - binfmt_misc binfmt_misc rw
137 106 8:16 /bin /overlay/merged/bin rw,relatime - ext4 /dev/sdb rw,discard,errors=remount-ro,data=ordered
I have write permission on upper and work and all directories are on the same filesystem
find /overlay/{upper,work} -name bin -ls
38672 4 drwxr-xr-x 2 badger badger 4096 Nov 3 17:05 /home/badger/overlay/upper/bin
38631 4 drwxr-xr-x 3 badger badger 4096 Nov 4 23:08 /home/badger/overlay/work/bin