Complete Phase 1 implementation of KubeSolo OS — an immutable, bootable Linux distribution built on Tiny Core Linux for running KubeSolo single-node Kubernetes. Build system: - Makefile with fetch, rootfs, initramfs, iso, disk-image targets - Dockerfile.builder for reproducible builds - Scripts to download Tiny Core, extract rootfs, inject KubeSolo, pack initramfs, and create bootable ISO/disk images Init system (10 POSIX sh stages): - Early mount (proc/sys/dev/cgroup2), cmdline parsing, persistent mount with bind-mounts, kernel module loading, sysctl, DHCP networking, hostname, clock sync, containerd prep, KubeSolo exec Shared libraries: - functions.sh (device wait, IP lookup, config helpers) - network.sh (static IP, config persistence, interface detection) - health.sh (containerd, API server, node readiness checks) - Emergency shell for boot failure debugging Testing: - QEMU boot test with serial log marker detection - K8s readiness test with kubectl verification - Persistence test (reboot + verify state survives) - Workload deployment test (nginx pod) - Local storage test (PVC + local-path provisioner) - Network policy test - Reusable run-vm.sh launcher Developer tools: - dev-vm.sh (interactive QEMU with port forwarding) - rebuild-initramfs.sh (fast iteration) - inject-ssh.sh (dropbear SSH for debugging) - extract-kernel-config.sh + kernel-audit.sh Documentation: - Full design document with architecture research - Boot flow documentation covering all 10 init stages - Cloud-init examples (DHCP, static IP, Portainer Edge, air-gapped) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
49 lines
1.5 KiB
Bash
Executable File
49 lines
1.5 KiB
Bash
Executable File
#!/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
|