From 863f498cc2c0afa6cc8953795020891d9ac4114d Mon Sep 17 00:00:00 2001 From: Adolfo Delorenzo Date: Thu, 14 May 2026 14:43:35 -0600 Subject: [PATCH] fix: kernel must use /sbin/init, not piCore's /init MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Root cause of the 'Run /init as init process' -> immediate SIGSEGV panic on the generic ARM64 boot: piCore64's rootfs ships a /init script at the rootfs root, and the kernel's init search order picks /init over /sbin/init. piCore's init then exec's something incompatible with our environment and segfaults. Two fixes: 1. inject-kubesolo.sh now removes the upstream /init after replacing /sbin/init. This is the structural fix — the rootfs no longer has the conflicting entry-point. 2. grub-arm64.cfg passes init=/sbin/init explicitly. Belt-and-suspenders in case any future rootfs source re-introduces /init. Co-Authored-By: Claude Opus 4.7 (1M context) --- build/grub/grub-arm64.cfg | 4 ++-- build/scripts/inject-kubesolo.sh | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/build/grub/grub-arm64.cfg b/build/grub/grub-arm64.cfg index d990c17..34ee0e9 100644 --- a/build/grub/grub-arm64.cfg +++ b/build/grub/grub-arm64.cfg @@ -64,7 +64,7 @@ fi menuentry "KubeSolo OS (${slot_label})" { echo "Booting KubeSolo OS from ${slot_label}..." echo "Boot counter: ${boot_counter}, Boot success: ${boot_success}" - linux /vmlinuz kubesolo.data=LABEL=KSOLODATA console=ttyS0,115200 console=ttyAMA0,115200 + linux /vmlinuz init=/sbin/init kubesolo.data=LABEL=KSOLODATA console=ttyS0,115200 console=ttyAMA0,115200 initrd /kubesolo-os.gz } @@ -76,7 +76,7 @@ menuentry "KubeSolo OS (${slot_label}) — Debug Mode" { menuentry "KubeSolo OS — Emergency Shell" { echo "Booting to emergency shell..." - linux /vmlinuz kubesolo.shell console=ttyS0,115200 console=ttyAMA0,115200 + linux /vmlinuz init=/sbin/init kubesolo.shell console=ttyS0,115200 console=ttyAMA0,115200 initrd /kubesolo-os.gz } diff --git a/build/scripts/inject-kubesolo.sh b/build/scripts/inject-kubesolo.sh index 798485c..3aa8550 100755 --- a/build/scripts/inject-kubesolo.sh +++ b/build/scripts/inject-kubesolo.sh @@ -55,6 +55,15 @@ rm -f "$ROOTFS/sbin/init" cp "$PROJECT_ROOT/init/init.sh" "$ROOTFS/sbin/init" chmod +x "$ROOTFS/sbin/init" +# Remove piCore/TC's /init at the rootfs root. The kernel's init search order +# is /init -> /sbin/init -> ..., so leaving piCore's /init in place causes the +# kernel to run that instead of ours, which then segfaults (it tries to do +# piCore-specific TCE handling on a host that doesn't have it). +if [ -e "$ROOTFS/init" ]; then + rm -f "$ROOTFS/init" + echo " Removed upstream /init (kernel will fall through to /sbin/init)" +fi + # Init stages mkdir -p "$ROOTFS/usr/lib/kubesolo-os/init.d" for stage in "$PROJECT_ROOT"/init/lib/*.sh; do