OpenWrt Forum Archive

Topic: Kernel panic - not syncing: No working init found

The content of this topic has been archived on 26 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I work at Broadcom and I was asked to see if I can get running our new chip with openwrt (at this point just a proof-of-concept). I substituted the tooolchain with our own and pointed to our own kernel tree (all done through make menuconfig).  I did not change anything else in the openwrt config - all default packages. The build succeeded and I have a vmlinux, vmllinux-initramfs as well as rootfs.tar.gz

Unfortunately my board fails during the boot process fails with the following error:
[    3.966865] VFS: Mounted root (ubifs filesystem) readonly on device 0:12.
[    3.975124] devtmpfs: mounted
[    3.978231] Freeing unused kernel memory: 264K (c0745000 - c0787000)
[    3.996134] Kernel panic - not syncing: No working init found.  Try passing init= option to kernel. See Linux Documentation/init.txt for guidance.
[    4.009279] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.14.13-1.2pre_rgu-1.5.00 #10
[    4.016963] [<c00149f8>] (unwind_backtrace) from [<c0010f08>] (show_stack+0x10/0x14)
[    4.024721] [<c0010f08>] (show_stack) from [<c056c3f8>] (dump_stack+0x80/0x90)
[    4.031955] [<c056c3f8>] (dump_stack) from [<c056a6f8>] (panic+0xa4/0x1f0)
[    4.038840] [<c056a6f8>] (panic) from [<c0567510>] (cpu_die+0x0/0x80)
[    4.045290] [<c0567510>] (cpu_die) from [<00000000>] (  (null))


I tried booting using vmlinux-initramfs and also tried vmlinux with the rootfs from the flash. The same error in both cases.

To see if the openwrt rootfs produced by the build is good I booted my board with the rootfs produced by the regular Broadcom build and mounted the openwrt rootfs. The mount succeeds and I can see the expected directory structure but any attempt to execute any of the binaries in the openwrt rootfs tree results in the following error:

# /mnt/flash/bin/busybox
sh: /mnt/flash/bin/busybox: No such file or directory

With strace:

# strace /mnt/flash/bin/busybox
execve("/mnt/flash/bin/busybox", ["/mnt/flash/bin/busybox"], [/* 9 vars */]) = -1 ENOENT (No such file or directory)
dup(2)                                  = 3
fcntl64(3, F_GETFL)                     = 0x20002 (flags O_RDWR|O_LARGEFILE)
fstat64(3, {st_mode=S_IFCHR|0600, st_rdev=makedev(4, 64), ...}) = 0
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, {B115200 opost isig icanon echo ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6f2b000
_llseek(3, 0, 0xbeae8a08, SEEK_CUR)     = -1 ESPIPE (Illegal seek)
write(3, "strace: exec: No such file or di"..., 40strace: exec: No such file or directory
) = 40
close(3)                                = 0
munmap(0xb6f2b000, 4096)                = 0
exit_group(1)                           = ?

It seems to me that the two problems (boot and executing mounted binary) are related but I am not sure what causes them.

Both Broadcom built and openwrt built busybox binaries seem to be compiled correctly:

# file /bin/busybox
/bin/busybox: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, stripped

# file /mnt/flash/bin/busybox
/mnt/flash/bin/busybox: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, stripped

Any help appreciated.

Looks like it does not find the dynamic linker (ld.so). Try executing the binaries after a chroot.

Unfortunately I am unable to chroot:

# chroot /mnt/flash
chroot: can't execute '/bin/sh': No such file or directory
#
#
#
# strace chroot /mnt/flash
execve("/sbin/chroot", ["chroot", "/mnt/flash"], [/* 11 vars */]) = 0
brk(0)                                  = 0x78000
uname({sys="Linux", node="(none)", ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6ff8000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/mnt/flash/lib/tls/v7l/neon/vfp/libcrypt.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/mnt/flash/lib/tls/v7l/neon/vfp", 0xbeb444e8) = -1 ENOENT (No such file or directory)
open("/mnt/flash/lib/tls/v7l/neon/libcrypt.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/mnt/flash/lib/tls/v7l/neon", 0xbeb444e8) = -1 ENOENT (No such file or directory)
open("/mnt/flash/lib/tls/v7l/vfp/libcrypt.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/mnt/flash/lib/tls/v7l/vfp", 0xbeb444e8) = -1 ENOENT (No such file or directory)
open("/mnt/flash/lib/tls/v7l/libcrypt.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/mnt/flash/lib/tls/v7l", 0xbeb444e8) = -1 ENOENT (No such file or directory)
open("/mnt/flash/lib/tls/neon/vfp/libcrypt.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/mnt/flash/lib/tls/neon/vfp", 0xbeb444e8) = -1 ENOENT (No such file or directory)
open("/mnt/flash/lib/tls/neon/libcrypt.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/mnt/flash/lib/tls/neon", 0xbeb444e8) = -1 ENOENT (No such file or directory)
open("/mnt/flash/lib/tls/vfp/libcrypt.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/mnt/flash/lib/tls/vfp", 0xbeb444e8) = -1 ENOENT (No such file or directory)
open("/mnt/flash/lib/tls/libcrypt.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/mnt/flash/lib/tls", 0xbeb444e8) = -1 ENOENT (No such file or directory)
open("/mnt/flash/lib/v7l/neon/vfp/libcrypt.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/mnt/flash/lib/v7l/neon/vfp", 0xbeb444e8) = -1 ENOENT (No such file or directory)
open("/mnt/flash/lib/v7l/neon/libcrypt.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/mnt/flash/lib/v7l/neon", 0xbeb444e8) = -1 ENOENT (No such file or directory)
open("/mnt/flash/lib/v7l/vfp/libcrypt.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/mnt/flash/lib/v7l/vfp", 0xbeb444e8) = -1 ENOENT (No such file or directory)
open("/mnt/flash/lib/v7l/libcrypt.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/mnt/flash/lib/v7l", 0xbeb444e8) = -1 ENOENT (No such file or directory)
open("/mnt/flash/lib/neon/vfp/libcrypt.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/mnt/flash/lib/neon/vfp", 0xbeb444e8) = -1 ENOENT (No such file or directory)
open("/mnt/flash/lib/neon/libcrypt.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/mnt/flash/lib/neon", 0xbeb444e8) = -1 ENOENT (No such file or directory)
open("/mnt/flash/lib/vfp/libcrypt.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/mnt/flash/lib/vfp", 0xbeb444e8) = -1 ENOENT (No such file or directory)
open("/mnt/flash/lib/libcrypt.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0@\t\0\0004\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=30400, ...}) = 0
mmap2(NULL, 254328, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb6f95000
mprotect(0xb6f9c000, 61440, PROT_NONE)  = 0
mmap2(0xb6fab000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x6) = 0xb6fab000
mmap2(0xb6fad000, 156024, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb6fad000
close(3)                                = 0
open("/mnt/flash/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\rw\1\0004\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=902844, ...}) = 0
mmap2(NULL, 972136, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb6ea7000
mprotect(0xb6f7f000, 65536, PROT_NONE)  = 0
mmap2(0xb6f8f000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xd8) = 0xb6f8f000
mmap2(0xb6f92000, 9576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb6f92000
close(3)                                = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6ff7000
set_tls(0xb6ff76d0, 0xb6ffb058, 0xb6ff7db8, 0xb6ff76d0, 0xb6ffb058) = 0
mprotect(0xb6f8f000, 8192, PROT_READ)   = 0
mprotect(0xb6fab000, 4096, PROT_READ)   = 0
mprotect(0xb6ffa000, 4096, PROT_READ)   = 0
getuid32()                              = 0
chroot("/mnt/flash")                    = 0
chdir("/")                              = 0
execve("/bin/sh", ["/bin/sh", "-i"], [/* 11 vars */]) = -1 ENOENT (No such file or directory)
brk(0)                                  = 0x78000
brk(0x99000)                            = 0x99000
write(2, "chroot: can't execute '/bin/sh':"..., 59chroot: can't execute '/bin/sh': No such file or directory
) = 59
exit_group(127)                         = ?
#

Hmmm..... If I invoke the binary using dynamic linker directly everything works. What does it mean?

# /lib/ld-2.18-2013.10.so /mnt/flash/bin/busybox
BusyBox v1.22.1 (2015-03-04 10:34:46 EST) multi-call binary.
BusyBox is copyrighted by many authors between 1998-2012.
Licensed under GPLv2. See source distribution for detailed
copyright notices.

Usage: busybox [function [arguments]...]
   or: busybox --list
   or: function [arguments]...

    BusyBox is a multi-call binary that combines many common Unix
    utilities into a single executable.  Most people will create a
    link to busybox for each function they wish to use and BusyBox
    will act like whatever it was invoked as.

Currently defined functions:
    [, [[, arping, ash, awk, basename, brctl, bunzip2, bzcat, cat, chgrp,
    chmod, chown, chroot, clear, cmp, cp, crond, crontab, cut, date, dd,
    devmem, df, dirname, dmesg, du, echo, egrep, env, expr, false, fgrep,
    find, free, fsync, grep, gunzip, gzip, halt, head, hexdump, hostid,
    hwclock, id, ifconfig, kill, killall, less, ln, lock, logger, ls,
    md5sum, mkdir, mkfifo, mknod, mkswap, mktemp, mount, mv, nc, netmsg,
    netstat, nice, nslookup, ntpd, passwd, pgrep, pidof, ping, ping6,
    pivot_root, poweroff, printf, ps, pwd, readlink, reboot, reset, rm,
    rmdir, route, sed, seq, sh, sleep, sort, start-stop-daemon, strings,
    switch_root, sync, sysctl, tail, tar, tee, telnet, telnetd, test, time,
    top, touch, tr, traceroute, true, udhcpc, umount, uname, uniq, uptime,
    vconfig, vi, wc, wget, which, xargs, yes, zcat

# /mnt/flash/lib/ld-2.18-2013.10.so /mnt/flash/bin/busybox
BusyBox v1.22.1 (2015-03-04 10:34:46 EST) multi-call binary.
BusyBox is copyrighted by many authors between 1998-2012.
Licensed under GPLv2. See source distribution for detailed
copyright notices.

Usage: busybox [function [arguments]...]
   or: busybox --list
   or: function [arguments]...

    BusyBox is a multi-call binary that combines many common Unix
    utilities into a single executable.  Most people will create a
    link to busybox for each function they wish to use and BusyBox
    will act like whatever it was invoked as.

Currently defined functions:
    [, [[, arping, ash, awk, basename, brctl, bunzip2, bzcat, cat, chgrp,
    chmod, chown, chroot, clear, cmp, cp, crond, crontab, cut, date, dd,
    devmem, df, dirname, dmesg, du, echo, egrep, env, expr, false, fgrep,
    find, free, fsync, grep, gunzip, gzip, halt, head, hexdump, hostid,
    hwclock, id, ifconfig, kill, killall, less, ln, lock, logger, ls,
    md5sum, mkdir, mkfifo, mknod, mkswap, mktemp, mount, mv, nc, netmsg,
    netstat, nice, nslookup, ntpd, passwd, pgrep, pidof, ping, ping6,
    pivot_root, poweroff, printf, ps, pwd, readlink, reboot, reset, rm,
    rmdir, route, sed, seq, sh, sleep, sort, start-stop-daemon, strings,
    switch_root, sync, sysctl, tail, tar, tee, telnet, telnetd, test, time,
    top, touch, tr, traceroute, true, udhcpc, umount, uname, uniq, uptime,
    vconfig, vi, wc, wget, which, xargs, yes, zcat

#

OK. I think I understand the problem now. The section called ".interp" of each elf file contains the path to the dynamic linker. This path was added during build time. In my case:

# objdump -s -j .interp bin/busybox

bin/busybox:     file format elf32-little

Contents of section .interp:
10134 2f6c6962 2f6c642d 75436c69 62632e73  /lib/ld-uClibc.s
10144 6f2e3000                             o.0.           


However,  /lib/ld-uClibc.so is not present in my rootfs. Now I have to figure out how to set it properly during build.

I confirmed the problem by creating a soft link:

/lib/ld-uClibc.so.0 -> ld-2.18-2013.10.so

and executing /mn/flash/bin/busybox again.

Hi,
I would like to know the difference between this tow commandline:
  make -C feeds/my_projet/new_package/compile
  make package/new_package

please help me smile

In general "make -C" causes make to switch to the directory specified after "-C" and use the make file in this directory.

Is this question related to this thread somehow? If not it should have been posted as a new thread...

The discussion might have continued from here.