[Piuparts-devel] RFC: preview/umount-more-carefully

Andreas Beckmann debian at abeckmann.de
Sun Jun 17 18:31:51 UTC 2012

getting this under discussion again ...

it works nicely, umounting binfmt_misc for a long time now

commit 0d090009d83a776270da345d64d4fa96aa3dd63b
Author: Andreas Beckmann <debian at abeckmann.de>
Date:   Sun Nov 20 00:16:46 2011 +0100

    unmount averything thats mounted into the chroot

    Installing certain packages may actually mount things inside the chroot,
    e.g. /proc/sys/fs/binfmt_misc. This needs to be taken care of when
    removing the chroot.

    Add to Chroot two methods get_mounted() and unmount_all() that replace
    unmount_proc(). Use them for cleanup and add some extra checking before
    running rmtree().

    TODO: Cooperation + order with unmount_selinux() is unclear.
    TODO: LVM and VirtServ support?

    TODO: Possible problems: symlinks on the way to the tempdir may cause
    /proc/mounts to use a different directory name from Chroot.name, so that
    prefix matching does not work and the mount points are not found.
    Assuming "everything unmounted" in that case may be problematic.

    A rather safe approach to cleanup the chroot would be
    * umount known extra mounts (e.g. /proc/sys/fs/binfmt_misc)
    * umount all known mountpoints (/proc, bindmounts)
    * umount everything recorded in /proc/mounts matching this chroot
    * use rm -rf --one-file-system

    Signed-off-by: Andreas Beckmann <debian at abeckmann.de>

More information about the Piuparts-devel mailing list