On Thu, 19 Apr 2018 10:06:49 +0200 Raphael Hertzog <hert...@debian.org> wrote: > Your patch will try to umount /proc even if it has not been mounted by > debootstrap. That's wrong. If you detect that /proc was handled outside of > debootstrap, then you should also not umount it.
+ if [ ! -n "$(ls -A /proc)" ]; then + in_target mount -t proc proc /proc is when there's no file under /proc, then try to mount /proc - not try to umount it. > And the handling of /sys should be entirely separate from /proc. Even if > /proc was already mounted, you want debootstrap to ensure that /sys is > mounted too. Okay, it should be that. diff --git a/functions b/functions index 1e41862..cb2c1d9 100644 --- a/functions +++ b/functions @@ -1137,10 +1137,12 @@ setup_proc () { # and also fix failure on lxc environment if [ ! -n "$(ls -A /proc)" ]; then in_target mount -t proc proc /proc - if [ -d "$TARGET/sys" ] && \ - grep -q '[[:space:]]sysfs' /proc/filesystems 2>/dev/null; then - umount_on_exit /sys - umount "$TARGET/sys" 2>/dev/null || true + fi + if [ -d "$TARGET/sys" ] && \ + grep -q '[[:space:]]sysfs' /proc/filesystems 2>/dev/null; then + umount_on_exit /sys + umount "$TARGET/sys" 2>/dev/null || true + if [ ! -n "$(ls -A /sys)" ]; then in_target mount -t sysfs sysfs /sys fi fi