X-Git-Url: https://iankelling.org/git/?p=newns;a=blobdiff_plain;f=newns;h=d4ee334ac784232c291548307c65f25166ad4c76;hp=4bd1650f7179bddeb1ba0e09888d37d27bf49b31;hb=14d6a0952aec6a7c35caa83f7b58c1a830c3b70f;hpb=48072c26a8715f462677c8ce9eaa64c2164b5f6e diff --git a/newns b/newns index 4bd1650..d4ee334 100755 --- a/newns +++ b/newns @@ -38,24 +38,20 @@ fi usage() { cat </dev/null; then existing=true @@ -190,13 +190,26 @@ start() { mkdir -p /root/mount_namespaces if ! mountpoint /root/mount_namespaces >/dev/null; then mount --bind /root/mount_namespaces /root/mount_namespaces - mount --make-private /root/mount_namespaces fi + # note: This is outside the mount condition because I've mysteriously + # had this become shared instead of private, perhaps it + # got remounted somehow and lost the setting. + mount --make-private /root/mount_namespaces if [[ ! -e /root/mount_namespaces/$nn ]]; then touch /root/mount_namespaces/$nn fi if ! mountpoint /root/mount_namespaces/$nn >/dev/null; then - unshare --mount=/root/mount_namespaces/$nn + # documentation on propagation is a bit weird because it + # confusingly talks about binds, namespaces, and mirrors (which + # seems to be just another name for bind), shared subtrees + # (which seems to a term for binds and namespaces), and does not + # properly specify whether the documentation applies to binds, + # namespaces, or both. Notably, propagation for binds is marked + # on the original mount point, and propagation for a mount + # namespace is marked on mounts within the namespace. Here, we + # specify that we want mount changes propagated to us, but not + # back. + unshare --propagation slave --mount=/root/mount_namespaces/$nn fi #### end mount namespace setup ####