diff options
Diffstat (limited to 'init')
-rw-r--r-- | init | 19 |
1 files changed, 18 insertions, 1 deletions
@@ -180,6 +180,24 @@ else nfsmount ${nfs_option:+-o ${nfs_option}} "${nfs_server}:${nfs_path}" /new_root fi +[ -z "${init}" ] && init="/sbin/init" +if [ "$(stat -f -c %i /)" = "$(stat -f -c %i /new_root)" ]; then + # Nothing got mounted on /new_root. This is the end, we don't know what to do anymore + # We fall back into a shell, but the shell has now PID 1 + # This way, manual recovery is still possible. + err "Failed to mount the real root device." + echo "Bailing out, you are on your own. Good luck." + echo + launch_interactive_shell --exec +elif [ ! -f "/new_root${init}" ]; then + # Successfully mounted /new_root, but ${init} is missing + # The same logic as above applies + err "Root device mounted successfully, but ${init} does not exist." + echo "Bailing out, you are on your own. Good luck." + echo + launch_interactive_shell --exec +fi + #Special handling if udev is running udevpid=$(/bin/pidof udevd) if [ -n "${udevpid}" ]; then @@ -191,5 +209,4 @@ fi umount /proc umount /sys -[ -z "${init}" ] && init="/sbin/init" exec /sbin/switch_root -c /dev/console /new_root ${init} "$@" |