debug: log every step of pre-switch_root mount sequence to /dev/console
Some checks failed
CI / Go Tests (push) Successful in 1m27s
CI / Shellcheck (push) Failing after 34s
CI / Build Go Binaries (amd64, linux, linux-amd64) (push) Failing after 32s
CI / Build Go Binaries (arm64, linux, linux-arm64) (push) Failing after 1m11s

The ARM64 generic boot is failing with 'Segmentation fault' from a child
process before any visible init output. Adding per-step debug lines to
narrow down which mount/mkdir crashes.

To revert: git revert <this commit> before tagging v0.3.0.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-14 15:27:50 -06:00
parent 65938d6d04
commit dc48caa959

View File

@@ -14,6 +14,12 @@
# kubesolo.cloudinit=<path> Path to cloud-init config # kubesolo.cloudinit=<path> Path to cloud-init config
# kubesolo.flags=<flags> Extra flags for KubeSolo binary # kubesolo.flags=<flags> Extra flags for KubeSolo binary
# Redirect ALL output to /dev/console for visibility during early boot.
# This is temporary v0.3 ARM64 debugging — revert when generic ARM64 is stable.
exec >/dev/console 2>&1
echo "[KSOLO-DBG] init.sh PID=$$ shell=$(readlink -f /proc/$$/exe 2>/dev/null || echo unknown)"
echo "[KSOLO-DBG] uname=$(uname -a 2>&1)"
set -e set -e
# --- Switch root: escape initramfs so runc pivot_root works --- # --- Switch root: escape initramfs so runc pivot_root works ---
@@ -22,11 +28,22 @@ set -e
# set up container root filesystems. To fix this, we copy the rootfs to a # set up container root filesystems. To fix this, we copy the rootfs to a
# tmpfs and switch_root to it. The sentinel file prevents infinite loops. # tmpfs and switch_root to it. The sentinel file prevents infinite loops.
if [ ! -f /etc/.switched_root ]; then if [ ! -f /etc/.switched_root ]; then
echo "[KSOLO-DBG] entering switch_root block"
echo "[KSOLO-DBG] mount proc..."
mount -t proc proc /proc 2>/dev/null || true mount -t proc proc /proc 2>/dev/null || true
echo "[KSOLO-DBG] mount proc exit=$?"
echo "[KSOLO-DBG] mount sysfs..."
mount -t sysfs sysfs /sys 2>/dev/null || true mount -t sysfs sysfs /sys 2>/dev/null || true
echo "[KSOLO-DBG] mount sysfs exit=$?"
echo "[KSOLO-DBG] mount devtmpfs..."
mount -t devtmpfs devtmpfs /dev 2>/dev/null || true mount -t devtmpfs devtmpfs /dev 2>/dev/null || true
echo "[KSOLO-DBG] mount devtmpfs exit=$?"
echo "[KSOLO-DBG] mkdir /mnt/newroot..."
mkdir -p /mnt/newroot mkdir -p /mnt/newroot
echo "[KSOLO-DBG] mkdir /mnt/newroot exit=$?"
echo "[KSOLO-DBG] mount tmpfs /mnt/newroot..."
mount -t tmpfs -o size=400M,mode=755 tmpfs /mnt/newroot mount -t tmpfs -o size=400M,mode=755 tmpfs /mnt/newroot
echo "[KSOLO-DBG] mount tmpfs exit=$?"
echo "[init] Copying rootfs to tmpfs..." >&2 echo "[init] Copying rootfs to tmpfs..." >&2
# Copy each top-level directory explicitly (BusyBox cp -ax on rootfs is broken) # Copy each top-level directory explicitly (BusyBox cp -ax on rootfs is broken)
for d in bin sbin usr lib lib64 etc var opt; do for d in bin sbin usr lib lib64 etc var opt; do