Hi. I just looked into this a bit more. First off, I think we should unmount as many things as we can, instead of giving up at the first failure. This is the first patch that is attached.
For the bigger issue here, you are right. Systemd is at fault: https://bugs.freedesktop.org/show_bug.cgi?id=81695 I won't claim to fully understand what's going on here, but the attached second patch fixes the problem. The duplicate mounts are created (presumably inside the kernel) without extra mount() syscalls. Also for some reason zsh tickles this behavior, but bash does not. I have several chroots that I use constantly with zsh, and so I hit this issue very often. It would be great if some sort of fix was deployed. Sorry I couldn't provide more insight. dima.
>From b85966683ae3b216333b2691fbd2ab84ab4e3ad4 Mon Sep 17 00:00:00 2001 From: Dima Kogan <d...@secretsauce.net> Date: Sat, 2 Jul 2016 14:56:15 -0700 Subject: [PATCH] Unmount everything that we can, instead of giving up at the first failure --- etc/setup.d/10mount | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/etc/setup.d/10mount b/etc/setup.d/10mount index 27c18d0..bbd631c 100755 --- a/etc/setup.d/10mount +++ b/etc/setup.d/10mount @@ -93,12 +93,16 @@ do_umount_all() ( flock 9 mounts="$("$LIBEXEC_DIR/schroot-listmounts" -m "$1")" + anyfailed="" if [ "x$mounts" != 'x' ]; then echo "$mounts" | while read mountloc; do info "Unmounting $mountloc" - umount "$mountloc" || exit 1 - done || exit 1 + umount "$mountloc" || anyfailed="yes" + done + + [ -n "$anyfailed" ] && exit 1 + true fi ) 9>"/var/lock/schroot/umount" else -- 2.8.0.rc3
>From 94494132d8bb3b95fa22dd82f9d974fbe8f5b2e4 Mon Sep 17 00:00:00 2001 From: Dima Kogan <d...@secretsauce.net> Date: Sat, 2 Jul 2016 19:38:56 -0700 Subject: [PATCH 2/2] Disabled bind mount propagation See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=829125 https://bugs.freedesktop.org/show_bug.cgi?id=81695 --- bin/schroot-mount/schroot-mount-main.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/schroot-mount/schroot-mount-main.cc b/bin/schroot-mount/schroot-mount-main.cc index 327f5ed..b92f330 100644 --- a/bin/schroot-mount/schroot-mount-main.cc +++ b/bin/schroot-mount/schroot-mount-main.cc @@ -200,6 +200,7 @@ main::action_mount () { sbuild::string_list command; command.push_back("/bin/mount"); + command.push_back("--make-rslave"); if (opts->verbose) command.push_back("-v"); command.push_back("-t"); -- 2.8.0.rc3