[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#968927: debootstrap in docker: may umount the docker instance's /proc



Package: debootstrap
Version: 1.0.123
X-Debbugs-CC: syq@debian.org

In a docker instance called with --privileged, debootstrap will umount the /proc of the whole docker instance.
It is due to in the 1st stage, the TARGET/proc is a symlink to /proc,
and in setup_proc, debootstrap will try to umount TARGET/proc.

--- a/functions
+++ b/functions
@@ -1183,7 +1183,12 @@ setup_proc () {
                 umount_on_exit /dev/shm
                 umount_on_exit /proc
                 umount_on_exit /proc/bus/usb
-               umount "$TARGET/proc" 2>/dev/null || true
+               if [ -L "$TARGET/proc" ];then
+                       rm -f $TARGET/proc
+                       mkdir $TARGET/proc
+               else
+                       umount "$TARGET/proc" 2>/dev/null || true
+               fi
 
                 # some container environment are used at second-stage, it already treats /proc and so on
                 if [ -z "$(ls -A "$TARGET/proc")" ]; then

Reply to: