[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

schroot: fix binfmt unmount for setup-stop stage in schroot



Hello,

15binfmt file obviously doesn't explicitly handle setup-stop stage. So it tries to perform bind mount while schroot is going to end session and this produces erroneous behavior in schroot --end-session --all-sessions command. My patch fixed this issue.

--
Max A. Dednev
+7(916)039-6336

Fixes mount/unmount binfmt handler sequence for start/stop schroot stages.
--- a/etc/setup.d/15binfmt
+++ b/etc/setup.d/15binfmt
@@ -40,8 +40,13 @@
     if [ ! -e "$emulator" ]; then
         info "Missing emulator: $emulator; not enabling binfmt support"
     else
-        [ -e "$dst" ] || { mkdir -p "$(dirname "$dst")"; touch "$dst"; }
-        mount --bind "$emulator" "$dst"
-        mount -o remount,ro,bind "$dst"
+        if [ "$STAGE" == "setup-start" ] || \
+           [ "$STAGE" == "setup-recover" ]; then
+	    [ -e "$dst" ] || { mkdir -p "$(dirname "$dst")"; touch "$dst"; }
+	    mount --bind "$emulator" "$dst"
+	    mount -o remount,ro,bind "$dst"
+        elif [ "$STAGE" == "setup-stop"  ]; then
+            umount "$dst"
+        fi
     fi
 done

Reply to: