Subject: Re: Bug#762304: debootstrap doesn't unmount /proc and /sys if caught Ctrl-C

From: Cyril Brulebois <[email-masked]>
Date: Sun, 21 Sep 2014 00:02:21 +0200

Control: severity -1 important

Askar Safin <[email-masked]> (2014-09-21):
> Package: debootstrap
> Version: 1.0.48+deb7u1
> Severity: grave
> 
> debootstrap doesn't unmount /proc and /sys (on my Debian GNU/Linux)
> if caught Ctrl-C in unpacking stage.
> 
> I started debootstrap, then I changed my mind, pressed Ctrl-C and
> then decided to delete target (let's assume it is /tmp/wheezy). I
> typed "rm -r /tmp/wheezy", and then unexpectedly I saw the
> following:
> 
> rm: cannot remove `/tmp/wheezy/proc/asound/PCH': Operation not permitted
> rm: cannot remove `/tmp/wheezy/proc/asound/card0/id': Operation not permitted
> rm: cannot remove `/tmp/wheezy/proc/asound/card0/codec#0': Operation not permitted
> [...]
> rm: cannot remove `/tmp/wheezy/proc/1/mem': Permission denied
> rm: cannot remove `/tmp/wheezy/proc/1/cwd': Permission denied
> rm: cannot remove `/tmp/wheezy/proc/1/root': Permission denied
> rm: cannot remove `/tmp/wheezy/proc/1/exe': Permission denied
> rm: cannot remove `/tmp/wheezy/proc/1/mounts': Permission denied
> [...]
> 
> This is very frustrating output. It is similar to output of the "rm
> -rf /*" command, so I was scared and I decided then I am deleting
> all my files. Then I discovered that the files are safe. (But I
> think this is possible that "rm -r /tmp/wheezy/proc /tmp/wheezy/sys"
> somehow damages host system.)

Hi,

and thanks for your report.

Well, debootstrap mostly performs the initial bootstraping, so I don't
think it would be introducing things like bind mounts which would then
endanger the root filesystem.

While it probably isn't too difficult to catch signals and do some
clean-up like unmounting filesystems, I don't think failing to do so
is a serious bug (important at most), and I'm lowering the severity
accordingly.

FWIW/IMHO: deciding to remove a chroot should always be accompanied
with checking (bind-)mounted filesystems.

Mraw,
KiBi.