diff --git a/package/base-files/files/lib/upgrade/stage2 b/package/base-files/files/lib/upgrade/stage2 index e12f60e70d..95a68e50fe 100755 --- a/package/base-files/files/lib/upgrade/stage2 +++ b/package/base-files/files/lib/upgrade/stage2 @@ -19,17 +19,18 @@ include /lib/upgrade supivot() { # /bin/mount | grep "on $1 type" 2>&- 1>&- || /bin/mount -o bind $1 $1 mkdir -p $1$2 $1/proc $1/sys $1/dev $1/tmp $1/overlay $1/ext_overlay && \ - /bin/mount -o noatime,move /proc $1/proc && \ + /bin/mount -o noatime,rbind /proc $1/proc && \ pivot_root $1 $1$2 || { /bin/umount -l $1 $1 return 1 } - /bin/mount -o noatime,move $2/sys /sys - /bin/mount -o noatime,move $2/dev /dev - /bin/mount -o noatime,move $2/tmp /tmp + /bin/mount -o noatime,move $2/sys /sys || /bin/mount -o noatime,rbind $2/sys /sys + /bin/mount -o noatime,move $2/dev /dev || /bin/mount -o noatime,rbind $2/dev /dev + /bin/mount -o noatime,move $2/tmp /tmp || /bin/mount -o noatime,bind $2/tmp /tmp /bin/mount -o noatime,move $2/overlay /overlay 2>&- /bin/mount -o noatime,move $2/ext_overlay /ext_overlay 2>&- + /bin/umount -l $2/proc $2/sys $2/dev $2/tmp $2/overlay $2/ext_overlay 2>&- return 0 } @@ -140,8 +141,6 @@ killall -9 ash kill_remaining TERM sleep 3 sync -/usr/bin/umount -R -d /mnt & -sleep 5 kill_remaining KILL 1 sleep 1 diff --git a/package/base-files/files/sbin/sysupgrade b/package/base-files/files/sbin/sysupgrade index 7e0a00e13b..15153029a0 100755 --- a/package/base-files/files/sbin/sysupgrade +++ b/package/base-files/files/sbin/sysupgrade @@ -357,6 +357,12 @@ if [ $TEST -eq 1 ]; then exit 0 fi +# In case $RAM_ROOT was mounted or a regular file +/bin/umount -l $RAM_ROOT 2>/dev/null +rm -f $RAM_ROOT +/bin/mount -o bind /tmp /tmp +mkdir $RAM_ROOT + install_bin /sbin/upgraded v "Commencing upgrade. Closing all shell sessions."