1

Here's the test case:

#!/bin/bash

more="$@"
saved="$EUID"

if [ "$EUID" = "0" ]; then
    echo "don't run as root"
    exit
fi

m="/tmp/mount-point"

exec sudo unshare -m /bin/bash <<UNSHARED
mkdir -p "$m"
mount -t tmpfs tmpfs "$m"
cd "$m"
mkdir top merge work

mount -t overlay overlay -o lowerdir=/,upperdir=top,workdir=work merge

#bash < /dev/tty
chroot merge sh -c 'sudo -u "#$saved" sh -c "id; ls /proc -lR"'
UNSHARED

Here's what it prints:

uid=1001(username) gid=1001(username) groups=1001(username),7(lp),10(wheel)
/proc:
total 0

My /proc, as you can probably guess, is mounted and not empty in the big fs.

0

An answer from the maintainer Miklos Szeredi:

It's just how overlayfs works. Mount a new instance of proc under /merge

So I'm guessing overlayfs is unioning filesystems starting from the specified directories not the general mount-composited image the userland is seeing. Furthermore:

There are userspace variants which make this possible; e.g. unionfs-fuse.

Thanks,
Miklos

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.