I've run into an odd problem regarding mount namespaces on Linux. I have two systems, both X86_64 running kernel 3.2.3-2 under Fedora 16. I am attempting to mount a tmpfs filesystem in a child namespace created using the unshare command:
unshare -m /bin/bash From the man page:
mount namespace mounting and unmounting filesystems will not affect rest of the system (CLONE_NEWNS flag), On one system, this works as expected. That is, if I start with this:
# ls /mnt file1 file2 file3 And then mount a tmpfs filesystem over /mnt in a child namespace:
# PS1="child# ' unshare -m /bin/bash child# mount -t tmpfs tmpfs /mnt The contents of /mnt are masked in the child namespace:
child# ls /mnt child# But continue to be visible in the parent:
# ls /mnt file1 file2 file3 On the second system, the exact same sequence of commands will result in a mount that is visible in the parent namespace as well as in the child namespace. In other words, it appears that the unshare command is not actually resulting in a separate mount namespace.
I am not aware of any substantial differences between the two systems. One is running a desktop environment, the other is not. SELinux is disabled on both systems.
I'm looking for any suggestions as to what could be causing this difference in behavior.