sreedharmahadevan
Posts: 19
Joined: Tue Sep 22, 2020 5:56 pm

Raspberry Pi 4B - Kernel panic - not syncing: Attempted to kill init!

Thu Oct 15, 2020 7:20 am

Hello folks,

I am trying to build and use my own Bootloader and Linux version on a Raspberry Pi 4B hardware. I am facing a Kernel panic from which I am not able to solve my way out.

Kernel panic - not syncing: Attempted to kill init! exitcode=0x00007f00 - Not able to resolve

I saw some posts regarding the same but none seems to be conclusive.

U-Boot: v2020.07
Linux Kernel: v5.8.9

Used busybox to prepare my Root-FS which seems to be mounted, as per what I see on console. This is where I get stuck at the end:
Screenshot from 2020-10-12 13-59-44.png
Screenshot from 2020-10-12 13-59-44.png (179.9 KiB) Viewed 569 times
Can you please suggest a way out?

cleverca22
Posts: 1906
Joined: Sat Aug 18, 2012 2:33 pm

Re: Raspberry Pi 4B - Kernel panic - not syncing: Attempted to kill init!

Thu Oct 15, 2020 7:28 am

what are the contents of the /sbin/init you put on the rootfs?
what does "file" say about it when ran on that file?

sreedharmahadevan
Posts: 19
Joined: Tue Sep 22, 2020 5:56 pm

Re: Raspberry Pi 4B - Kernel panic - not syncing: Attempted to kill init!

Thu Oct 15, 2020 8:46 am

I get this when I run file init inside the /sbin folder:

init: symbolic link to ../bin/busybox

And the ../bin folder has the busybox file too. Any idea what is normally expected?

cleverca22
Posts: 1906
Joined: Sat Aug 18, 2012 2:33 pm

Re: Raspberry Pi 4B - Kernel panic - not syncing: Attempted to kill init!

Thu Oct 15, 2020 8:49 am

and if you run file on busybox instead?
and/or `file -L init` ?

sreedharmahadevan
Posts: 19
Joined: Tue Sep 22, 2020 5:56 pm

Re: Raspberry Pi 4B - Kernel panic - not syncing: Attempted to kill init!

Thu Oct 15, 2020 8:57 am

This is what I see:

file busybox

busybox: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 4.20.8, stripped

file -L init
init: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 4.20.8, stripped


sreedharmahadevan
Posts: 19
Joined: Tue Sep 22, 2020 5:56 pm

Re: Raspberry Pi 4B - Kernel panic - not syncing: Attempted to kill init!

Thu Oct 15, 2020 10:18 am

Yes, it is a 64-bit kernel I built with the arm64 toolchain.

When I provide iminfo 00080000 in U-Boot command prompt, this is what I get:

## Checking Image at 00080000 ...
Legacy image found
Image Name: 15Oct2020LinuxImage
Image Type: AArch64 Linux Kernel Image (uncompressed)
Data Size: 34241024 Bytes = 32.7 MiB
Load Address: 00200000
Entry Point: 00200000
Verifying Checksum ... OK
U-Boot>

cleverca22
Posts: 1906
Joined: Sat Aug 18, 2012 2:33 pm

Re: Raspberry Pi 4B - Kernel panic - not syncing: Attempted to kill init!

Thu Oct 15, 2020 10:27 am

try replacing /sbin/init with:

Code: Select all

#!/bin/ash

echo testing 1 2 3
and ensure that ash is a symlink to busybox

sreedharmahadevan
Posts: 19
Joined: Tue Sep 22, 2020 5:56 pm

Re: Raspberry Pi 4B - Kernel panic - not syncing: Attempted to kill init!

Thu Oct 15, 2020 11:27 am

Sorry, I didn't quite understand your message. Can you please elaborate on what exactly I should try?

cleverca22
Posts: 1906
Joined: Sat Aug 18, 2012 2:33 pm

Re: Raspberry Pi 4B - Kernel panic - not syncing: Attempted to kill init!

Thu Oct 15, 2020 11:29 am

make /sbin/init into a normal shell script, with the #! set to ash
and then make ash a symlink to busybox

sreedharmahadevan
Posts: 19
Joined: Tue Sep 22, 2020 5:56 pm

Re: Raspberry Pi 4B - Kernel panic - not syncing: Attempted to kill init!

Thu Oct 15, 2020 3:00 pm

I tried doing it and ensured the symlink to Busybox for /bin/ash - I still see the same error. Not sure if I did it the right way. Any ideas?
Screenshot from 2020-10-15 20-21-32.png
Screenshot from 2020-10-15 20-21-32.png (179.11 KiB) Viewed 456 times

swahren
Posts: 149
Joined: Mon Sep 19, 2016 5:24 pm
Location: Germany

Re: Raspberry Pi 4B - Kernel panic - not syncing: Attempted to kill init!

Thu Oct 15, 2020 5:34 pm

Does the kernel cmdline point to the right mmcblk device (mmclbk0 vs mmcblk1)?

sreedharmahadevan
Posts: 19
Joined: Tue Sep 22, 2020 5:56 pm

Re: Raspberry Pi 4B - Kernel panic - not syncing: Attempted to kill init!

Fri Oct 16, 2020 3:20 am

Yes, I guess it did, since I had configured the /dev/mmcblk1p2 as the root in cmdline.txt , which is the rootfs partition of my 32GB SD Card. And this is what I see on the log:

[ 6.473890] Waiting for root device /dev/mmcblk1p2...
[ 6.562961] mmc1: new ultra high speed DDR50 SDHC card at address aaaa
[ 6.577512] mmcblk1: mmc1:aaaa SC32G 29.7 GiB
[ 6.598088] mmcblk1: p1 p2
[ 6.618752] usb 1-1: new high-speed USB device number 2 using xhci_hcd
[ 6.675074] EXT4-fs (mmcblk1p2): mounted filesystem with ordered data mode. Opts: (null)
[ 6.683924] VFS: Mounted root (ext4 filesystem) readonly on device 179:2.
[ 6.696399] devtmpfs: mounted

sreedharmahadevan
Posts: 19
Joined: Tue Sep 22, 2020 5:56 pm

Re: Raspberry Pi 4B - Kernel panic - not syncing: Attempted to kill init!

Tue Oct 20, 2020 6:01 am

Hi all,

An update: Apparently I came across another post elsewhere which seemed to imply that busybox needs to be statically linked and not dynamic, which seemed to be the issue for me as well. I changed the build config to make it static linking and then the kernel panic disappeared.

I now am able to reach the Kernel console successfully, but I have a strange problem now. I reach /sbin/init and then the UART output to the host PC freezes. But when I connect HDMI to the Raspberry Pi, all is good and I get the console on the HDMI display.

Do you know of any solution to this problem? This seems to be reported here already but no one seems to have a conclusive solution for it .(viewtopic.php?t=270723)

cleverca22
Posts: 1906
Joined: Sat Aug 18, 2012 2:33 pm

Re: Raspberry Pi 4B - Kernel panic - not syncing: Attempted to kill init!

Tue Oct 20, 2020 1:56 pm

if busybox is dynamic, then you must also copy all of the dynamic libraries it depends on, thats true for any dynamic binary

you can test things by using chroot to run the binary in an isolated environment

Return to “Linux Kernel”