From: Michael Tremer Date: Mon, 3 Oct 2011 21:25:48 +0000 (+0200) Subject: After killing all processes in the chroot, wait a bit. X-Git-Tag: 0.9.11~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=536438d9ea2293abb2de077e38a40b0dd52f5ecb;p=pakfire.git After killing all processes in the chroot, wait a bit. This is needed because processes to not close their file descriptors fast enough to umount directories. --- diff --git a/python/pakfire/util.py b/python/pakfire/util.py index 1ba2992a2..7d1690ab5 100644 --- a/python/pakfire/util.py +++ b/python/pakfire/util.py @@ -249,13 +249,15 @@ def orphans_kill(root, killsig=signal.SIGTERM): """ kill off anything that is still chrooted. """ - logging.debug("Killing orphans...") + logging.debug(_("Killing orphans...")) + killed = False for fn in [d for d in os.listdir("/proc") if d.isdigit()]: try: r = os.readlink("/proc/%s/root" % fn) if os.path.realpath(root) == os.path.realpath(r): - logging.warning("Process ID %s is still running in chroot. Killing..." % fn) + logging.warning(_("Process ID %s is still running in chroot. Killing...") % fn) + killed = True pid = int(fn, 10) os.kill(pid, killsig) @@ -263,6 +265,12 @@ def orphans_kill(root, killsig=signal.SIGTERM): except OSError, e: pass + # If something was killed, wait a couple of seconds to make sure all file descriptors + # are closed and we can proceed with umounting the filesystems. + if killed: + logging.warning(_("Waiting for processes to terminate...")) + time.sleep(3) + def scriptlet_interpreter(scriptlet): """ This function returns the interpreter of a scriptlet.