On Fri, 9 Dec 2016 19:58:17 +0000
Holger Levsen <hol...@layer-acht.org> wrote:

> On Wed, Dec 07, 2016 at 10:15:25AM +0100, Antonio Ospite wrote:
> > Ping. Is the change from below OK? If it is I will send a proper patch.
> 
> yes, please send a git patch. +thanks!
> 
> also a debian bug against the binfmt-support package would be
> appreciated, so that it also gets fixed properly there.
> 

Hi Holger,

I am attaching a patch which adds the workaround.

I also reported the issue to binfmt-support:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=847788

Thanks,
   Antonio

-- 
Antonio Ospite
https://ao2.it
https://twitter.com/ao2it

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
>From 5a5ae7619afadbc97f607a4d8370496333e8299f Mon Sep 17 00:00:00 2001
From: Antonio Ospite <a...@ao2.it>
Date: Sun, 11 Dec 2016 17:16:14 +0100
Subject: [PATCH] Umount /proc/sys/fs/binfmt_misc to work around a binfmt bug

Some java packages (e.g. "signtos") trigger update-binfmts, which mounts
/proc/sys/fs/binfmt_misc but never unmounts it.

When dealing with such scenario piuparts cannot unmount the chroot
successfully because /proc results busy.

Work around the issue by force-unmounting /proc/sys/fs/binfmt_misc
before anything else.

The same workaround was also used in other projects:
https://bugs.launchpad.net/ubuntu/+source/binfmt-support/+bug/534211
https://lists.debian.org/debian-live/2007/01/msg00039.html

Closes: #704037
---
 piuparts.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/piuparts.py b/piuparts.py
index dbf2b18d..f9b0b126 100644
--- a/piuparts.py
+++ b/piuparts.py
@@ -1577,6 +1577,12 @@ class Chroot:
 
     def unmount_all(self):
         """Unmount everything we mount()ed into the chroot."""
+
+        # Workaround to unmount /proc/sys/fs/binfmt_misc which is mounted by
+        # update-binfmts but never unmounted, see:
+        # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=704037
+        run(["umount", self.relative("/proc/sys/fs/binfmt_misc")], ignore_errors=True)
+
         for mountpoint in reversed(self.mounts):
             run(["umount", mountpoint], ignore_errors=True)
 
-- 
2.11.0

Reply via email to