#!/bin/sh # emergency-shell.sh — Drop to a debug shell on boot failure # Called by init when a critical stage fails # POSIX sh only — BusyBox ash compatible echo "" >&2 echo "=====================================================" >&2 echo " KubeSolo OS — Emergency Shell" >&2 echo "=====================================================" >&2 echo "" >&2 echo " The boot process has failed. You have been dropped" >&2 echo " into an emergency shell for debugging." >&2 echo "" >&2 echo " Useful commands:" >&2 echo " dmesg | tail -50 Kernel messages" >&2 echo " cat /proc/cmdline Boot parameters" >&2 echo " cat /proc/mounts Current mounts" >&2 echo " blkid Block device info" >&2 echo " ip addr Network interfaces" >&2 echo " ls /usr/lib/kubesolo-os/init.d/ Init stages" >&2 echo "" >&2 # Show version if available if [ -f /etc/kubesolo-os-version ]; then echo " OS Version: $(cat /etc/kubesolo-os-version)" >&2 fi # Show what stage failed if known if [ -n "${FAILED_STAGE:-}" ]; then echo " Failed stage: $FAILED_STAGE" >&2 fi echo "" >&2 echo " Type 'exit' to attempt re-running the init sequence." >&2 echo " Type 'reboot' to restart the system." >&2 echo "=====================================================" >&2 echo "" >&2 # Ensure basic env is usable export PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin" export PS1="[kubesolo-emergency] # " export HOME=/root export TERM="${TERM:-linux}" # Create home dir if needed mkdir -p /root exec /bin/sh