tags 391390 + patch
stop

        Hi Martin,

On Fri, Oct 06, 2006, martin f krafft wrote:
>  -> unmounting proc filesystem
> umount: /proc: device is busy
> umount: /var/cache/pbuilder/build/27006/proc: not mounted
> umount: /proc: device is busy
> umount: /var/cache/pbuilder/build/27006/proc: not mounted
> W: Retrying to unmount proc
> umount: /var/cache/pbuilder/build//27006/proc: not mounted
> 
>   Could not unmount proc, there might be some program 
>   still using files in /proc (klogd?).
>   Please check and kill the process manually so that I can unmount proc
> 
>   This error is only happens with chroot; try using user-mode-linux to 
>   avoid this message.

 Could you please try the attached patch?  I've tested it in both
 working and not working cases, and it seems do what I want it to do:
 ignore only your particular type of umount error.

 Suggestions to avoid the ugly construct around UMOUNT_OUTPUT are
 welcome.  I just wiped a bind mounted dir trying this out.  :-/

   Bye,
-- 
Loïc Minier <[EMAIL PROTECTED]>
Index: ChangeLog
===================================================================
RCS file: /cvsroot/pbuilder/pbuilder/ChangeLog,v
retrieving revision 1.411
diff -u -r1.411 ChangeLog
--- ChangeLog   28 Oct 2006 14:39:42 -0000      1.411
+++ ChangeLog   28 Oct 2006 16:16:06 -0000
@@ -8,6 +8,9 @@
        * testsuite/run-test-satisfy-depends.log: initial test results.
        * testsuite/run-test-satisfy-depends.sh: fix invocation from CVS
        checkout by only copying debian/rules and not debian/*.
+       * pbuilder-modules: ignore umount errors of the type "umount: /foobar:
+       not mounted" as retries will be useless anyway, and these errors are
+       not caused by open files; fixes #391390.
 
 2006-10-27  Junichi Uekawa  <[EMAIL PROTECTED]>
 
Index: pbuilder-modules
===================================================================
RCS file: /cvsroot/pbuilder/pbuilder/pbuilder-modules,v
retrieving revision 1.99
diff -u -r1.99 pbuilder-modules
--- pbuilder-modules    24 Aug 2006 22:58:57 -0000      1.99
+++ pbuilder-modules    28 Oct 2006 16:16:06 -0000
@@ -93,24 +93,36 @@
        return
     fi
     echo " -> unmounting $1 filesystem"
-    if ! umount "$BUILDPLACE/$1"; then
+    local UMOUNT_OUTPUT
+    local error
+    set +e
+    UMOUNT_OUTPUT="$( exec 2>&1; LC_ALL=C umount "$BUILDPLACE/$1")"
+    error="$?"
+    set -e
+    if [ "$error" -ne 0 ]; then
+        if echo "$UMOUNT_OUTPUT" | grep -q ': not mounted$'; then
+           echo "W: umount said $1 is not mounted, skipping"
+        else
            echo "W: Retrying to unmount $1"
            sleep 5s
            while ! umount "$BUILDPLACE/$1"; do
                sleep 5s
                cat <<EOF
 
-  Could not unmount $1, there might be some program 
-  still using files in /proc (klogd?).
-  Please check and kill the process manually so that I can unmount $1
+  Could not unmount $1, some programs might
+  still be using files in /proc (klogd?).
+  Please check and kill these processes manually
+  so that I can unmount $1.  Last umount error was:
+$UMOUNT_OUTPUT
 
-  This error is only happens with chroot; try using user-mode-linux to 
-  avoid this message.
+  This error only affects chroots; you may want to use
+  user-mode-linux to avoid this message.
 
 EOF
                chroot "$BUILDPLACE" bin/sh
            done
-       fi
+        fi
+    fi
 }
 
 function umountproc () {

Reply via email to