On Tue, 2011-07-05 at 00:02 +0200, Jean-Louis Dupond wrote:
> Having the same issue on Ubuntu Oneiric at this moment.
> 
> After some debugging, it seems the issue is not pbuilder, but 'debootstrap'.
> 
> This as after the debootstrap, the /proc in the chroot is NOT unmounted.
> 
> After the debootstrap, pbuilder tries to mount /proc again, which causes 
> the error.

Right.  debootstrap *tries* to unmount /proc - but it also hides errors
from its cleanup functions, and if I log the errors, I see:

umount: /proc: device is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))

This is presumably bug #634107.

Maybe I should reassign this bug to mount and merge with that, but we
might as well avoid this in debootstrap by using the '-n' option to
umount.  Since we run mount in the target chroot, none of the
directories mounted under the target will ever be present in the outer
/etc/mtab and there is no need for umount to read or write it.

Attaching patches to use umount -n and to log errors in cleanup.

Ben.

From ff9a3a444147282509a9d12eb1c95ebf85d080b9 Mon Sep 17 00:00:00 2001
From: Ben Hutchings <b...@decadent.org.uk>
Date: Sun, 7 Aug 2011 23:32:41 +0100
Subject: [PATCH 1/2] Use umount -n to unmount directories that were mounted
 in chroot

Closes: #631087
---
 debian/changelog |    8 ++++++++
 functions        |    2 +-
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 38988e7..a5b9bea 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+debootstrap (1.0.34+nmu1) UNRELEASED; urgency=low
+
+  * Non-maintainer upload.
+  * Use umount -n to unmount directories that were mounted in chroot.
+    Closes: #631087.
+
+ -- Ben Hutchings <b...@decadent.org.uk>  Sun, 07 Aug 2011 21:10:36 +0100
+
 debootstrap (1.0.34) unstable; urgency=low
 
   * Add more information regarding the version and architecture in case
diff --git a/functions b/functions
index fd94a59..819c296 100644
--- a/functions
+++ b/functions
@@ -918,7 +918,7 @@ UMOUNT_DIRS=
 
 umount_exit_function () {
 	for dir in $UMOUNT_DIRS; do
-		umount "$TARGET/${dir#/}" || true
+		umount -n "$TARGET/${dir#/}" || true
 	done
 }
 
-- 
1.7.5.4

From c7b05f7bfe6c0672813101a97cb9d3509aefbb2b Mon Sep 17 00:00:00 2001
From: Ben Hutchings <b...@decadent.org.uk>
Date: Sun, 7 Aug 2011 23:35:46 +0100
Subject: [PATCH 2/2] Log error output from cleanup functions

---
 debian/changelog |    1 +
 functions        |    2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index a5b9bea..5083b4c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,7 @@ debootstrap (1.0.34+nmu1) UNRELEASED; urgency=low
   * Non-maintainer upload.
   * Use umount -n to unmount directories that were mounted in chroot.
     Closes: #631087.
+  * Log error output from cleanup functions.
 
  -- Ben Hutchings <b...@decadent.org.uk>  Sun, 07 Aug 2011 21:10:36 +0100
 
diff --git a/functions b/functions
index 819c296..2677659 100644
--- a/functions
+++ b/functions
@@ -1275,7 +1275,7 @@ N_EXIT_THINGS=0
 exit_function () {
 	local n=0
 	while [ "$n" -lt "$N_EXIT_THINGS" ]; do
-		(eval $(eval echo \${EXIT_THING_$n}) 2>/dev/null || true)
+		(eval $(eval echo \${EXIT_THING_$n}) || true)
 		n="$(( $n + 1 ))"
 	done
 	N_EXIT_THINGS=0
-- 
1.7.5.4

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to