Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kernel panic - not syncing: No working init found. Try passing init= option to kernel. See Linux Documentation/admin-guide/init.rst for guidance. #1

Closed
truelv opened this issue Aug 20, 2018 · 2 comments

Comments

@truelv
Copy link

truelv commented Aug 20, 2018

My comandline parameter:

sudo qemu-system-riscv64 -nographic -machine virt -kernel ./riscv-pk/build/bbl -append "root=/dev/vda ro console=ttyS0" -drive file=./busybear-linux/busybear.bin,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 -netdev type=tap,script=./ifup,downscript=./ifdown,id=net0 -device virtio-net-device,netdev=net0

My console says:
bbl loader
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
vvvvvvvvvvvvvvvvvvvvvvvvvvvv
rrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvvvv
rrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvv
rrrrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvv
rrrrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvv
rrrrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvv
rrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvv
rrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvv
rr vvvvvvvvvvvvvvvvvvvvvv
rr vvvvvvvvvvvvvvvvvvvvvvvv rr
rrrr vvvvvvvvvvvvvvvvvvvvvvvvvv rrrr
rrrrrr vvvvvvvvvvvvvvvvvvvvvv rrrrrr
rrrrrrrr vvvvvvvvvvvvvvvvvv rrrrrrrr
rrrrrrrrrr vvvvvvvvvvvvvv rrrrrrrrrr
rrrrrrrrrrrr vvvvvvvvvv rrrrrrrrrrrr
rrrrrrrrrrrrrr vvvvvv rrrrrrrrrrrrrr
rrrrrrrrrrrrrrrr vv rrrrrrrrrrrrrrrr
rrrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrr
rrrrrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrrrr
rrrrrrrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrrrrrr

   INSTRUCTION SETS WANT TO BE FREE

[ 0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000
[ 0.000000] Linux version 4.15.0 (wangya@ubuntu) (gcc version 8.2.0 (GCC)) #2 Mon Aug 20 15:30:47 CST 2018
[ 0.000000] bootconsole [early0] enabled
[ 0.000000] Zone ranges:
[ 0.000000] DMA32 [mem 0x0000000080200000-0x0000000087ffffff]
[ 0.000000] Normal [mem 0x0000000088000000-0x0000087fffffffff]
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x0000000080200000-0x0000000087ffffff]
[ 0.000000] Initmem setup node 0 [mem 0x0000000080200000-0x0000000087ffffff]
[ 0.000000] software IO TLB [mem 0x83e3d000-0x87e3d000] (64MB) mapped at [ (ptrval)- (ptrval)]
[ 0.000000] elf_hwcap is 0x112d
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 31815
[ 0.000000] Kernel command line: root=/dev/vda ro console=ttyS0
[ 0.000000] Dentry cache hash table entries: 16384 (order: 5, 131072 bytes)
[ 0.000000] Inode-cache hash table entries: 8192 (order: 4, 65536 bytes)
[ 0.000000] Sorting __ex_table...
[ 0.000000] Memory: 56660K/129024K available (2612K kernel code, 211K rwdata, 657K rodata, 100K init, 780K bss, 72364K reserved, 0K cma-reserved)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] NR_IRQS: 0, nr_irqs: 0, preallocated irqs: 0
[ 0.000000] riscv,cpu_intc,0: 64 local interrupts mapped
[ 0.000000] riscv,plic0,c000000: mapped 10 interrupts to 1/2 handlers
[ 0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x24e6a1710, max_idle_ns: 440795202120 ns
[ 0.000269] sched_clock: 64 bits at 10MHz, resolution 100ns, wraps every 4398046511100ns
[ 0.006140] Console: colour dummy device 80x25
[ 0.011585] Calibrating delay loop (skipped), value calculated using timer frequency.. 20.00 BogoMIPS (lpj=100000)
[ 0.018418] pid_max: default: 32768 minimum: 301
[ 0.022913] Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
[ 0.028504] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes)
[ 0.091983] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.099809] futex hash table entries: 256 (order: 0, 6144 bytes)
[ 0.133450] random: get_random_u32 called from bucket_table_alloc+0xac/0x1de with crng_init=0
[ 0.141286] NET: Registered protocol family 16
[ 0.173734] vgaarb: loaded
[ 0.191184] clocksource: Switched to clocksource riscv_clocksource
[ 0.216058] NET: Registered protocol family 2
[ 0.233111] TCP established hash table entries: 1024 (order: 1, 8192 bytes)
[ 0.238970] TCP bind hash table entries: 1024 (order: 1, 8192 bytes)
[ 0.240636] TCP: Hash tables configured (established 1024 bind 1024)
[ 0.247359] UDP hash table entries: 256 (order: 1, 8192 bytes)
[ 0.253394] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[ 0.259166] NET: Registered protocol family 1
[ 0.310106] workingset: timestamp_bits=62 max_order=14 bucket_order=0
[ 0.364292] random: fast init done
[ 0.442080] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254)
[ 0.446808] io scheduler noop registered
[ 0.448291] io scheduler deadline registered
[ 0.450300] io scheduler cfq registered (default)
[ 0.454955] io scheduler mq-deadline registered
[ 0.457721] io scheduler kyber registered
[ 0.656392] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[ 0.705117] console [ttyS0] disabled
[ 0.713086] 10000000.uart: ttyS0 at MMIO 0x10000000 (irq = 1, base_baud = 230400) is a 16550A
[ 0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000
[ 0.000000] Linux version 4.15.0 (wangya@ubuntu) (gcc version 8.2.0 (GCC)) #2 Mon Aug 20 15:30:47 CST 2018
[ 0.000000] bootconsole [early0] enabled
[ 0.000000] Zone ranges:
[ 0.000000] DMA32 [mem 0x0000000080200000-0x0000000087ffffff]
[ 0.000000] Normal [mem 0x0000000088000000-0x0000087fffffffff]
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x0000000080200000-0x0000000087ffffff]
[ 0.000000] Initmem setup node 0 [mem 0x0000000080200000-0x0000000087ffffff]
[ 0.000000] software IO TLB [mem 0x83e3d000-0x87e3d000] (64MB) mapped at [ (ptrval)- (ptrval)]
[ 0.000000] elf_hwcap is 0x112d
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 31815
[ 0.000000] Kernel command line: root=/dev/vda ro console=ttyS0
[ 0.000000] Dentry cache hash table entries: 16384 (order: 5, 131072 bytes)
[ 0.000000] Inode-cache hash table entries: 8192 (order: 4, 65536 bytes)
[ 0.000000] Sorting __ex_table...
[ 0.000000] Memory: 56660K/129024K available (2612K kernel code, 211K rwdata, 657K rodata, 100K init, 780K bss, 72364K reserved, 0K cma-reserved)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] NR_IRQS: 0, nr_irqs: 0, preallocated irqs: 0
[ 0.000000] riscv,cpu_intc,0: 64 local interrupts mapped
[ 0.000000] riscv,plic0,c000000: mapped 10 interrupts to 1/2 handlers
[ 0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x24e6a1710, max_idle_ns: 440795202120 ns
[ 0.000269] sched_clock: 64 bits at 10MHz, resolution 100ns, wraps every 4398046511100ns
[ 0.006140] Console: colour dummy device 80x25
[ 0.011585] Calibrating delay loop (skipped), value calculated using timer frequency.. 20.00 BogoMIPS (lpj=100000)
[ 0.018418] pid_max: default: 32768 minimum: 301
[ 0.022913] Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
[ 0.028504] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes)
[ 0.091983] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.099809] futex hash table entries: 256 (order: 0, 6144 bytes)
[ 0.133450] random: get_random_u32 called from bucket_table_alloc+0xac/0x1de with crng_init=0
[ 0.141286] NET: Registered protocol family 16
[ 0.173734] vgaarb: loaded
[ 0.191184] clocksource: Switched to clocksource riscv_clocksource
[ 0.216058] NET: Registered protocol family 2
[ 0.233111] TCP established hash table entries: 1024 (order: 1, 8192 bytes)
[ 0.238970] TCP bind hash table entries: 1024 (order: 1, 8192 bytes)
[ 0.240636] TCP: Hash tables configured (established 1024 bind 1024)
[ 0.247359] UDP hash table entries: 256 (order: 1, 8192 bytes)
[ 0.253394] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[ 0.259166] NET: Registered protocol family 1
[ 0.310106] workingset: timestamp_bits=62 max_order=14 bucket_order=0
[ 0.364292] random: fast init done
[ 0.442080] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254)
[ 0.446808] io scheduler noop registered
[ 0.448291] io scheduler deadline registered
[ 0.450300] io scheduler cfq registered (default)
[ 0.454955] io scheduler mq-deadline registered
[ 0.457721] io scheduler kyber registered
[ 0.656392] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[ 0.705117] console [ttyS0] disabled
[ 0.713086] 10000000.uart: ttyS0 at MMIO 0x10000000 (irq = 1, base_baud = 230400) is a 16550A
[ 0.792525] console [ttyS0] enabled
[ 0.792525] console [ttyS0] enabled
[ 0.999335] NET: Registered protocol family 10
[ 0.999335] NET: Registered protocol family 10
[ 1.044316] Segment Routing with IPv6
[ 1.044316] Segment Routing with IPv6
[ 1.050285] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[ 1.050285] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[ 1.062418] bootconsole [early0] uses init memory and must be disabled even before the real one is ready
[ 1.062418] bootconsole [early0] uses init memory and must be disabled even before the real one is ready
[ 1.070272] bootconsole [early0] disabled
[ 1.070272] bootconsole [early0] disabled
[ 1.131410] EXT4-fs (vda): couldn't mount as ext3 due to feature incompatibilities
[ 1.759260] EXT4-fs (vda): mounted filesystem with ordered data mode. Opts: (null)
[ 1.796334] VFS: Mounted root (ext4 filesystem) readonly on device 254:0.
[ 1.856910] Freeing unused kernel memory: 100K
[ 1.861720] This architecture does not have kernel memory protection.
[ 2.281119] Kernel panic - not syncing: No working init found. Try passing init= option to kernel. See Linux Documentation/admin-guide/init.rst for guidance.
[ 2.290953] CPU: 0 PID: 1 Comm: swapper Not tainted 4.15.0 #2
[ 2.293739] Call Trace:
[ 2.294717] [< (ptrval)>] walk_stackframe+0x0/0xa2
[ 2.298269] [< (ptrval)>] show_stack+0x26/0x34
[ 2.300199] [< (ptrval)>] dump_stack+0x20/0x2c
[ 2.301867] [< (ptrval)>] panic+0xc4/0x1d6
[ 2.303213] [< (ptrval)>] kernel_init+0xd8/0xe8
[ 2.304496] [< (ptrval)>] ret_from_syscall+0xa/0xe
[ 2.306144] ---[ end Kernel panic - not syncing: No working init found. Try passing init= option to kernel. See Linux Documentation/admin-guide/init.rst for guidance.

My effort:
I check this codebase and haven't seen a init script ~~~ It seems a bug ~~~

@michaeljclark
Copy link
Owner

Thanks for the bug report.

I reproduced this issue on my system and believe I have a fix for it.

I noticed there was an issue when building with a multilib toolchain. The script copies /lib into the image but does not copy /lib64 into the image. The dynamic linker, /lib/ld-linux-riscv64-lp64d.so.1 points to /lib64/lp64d/libc-2.26.so, which is not in the image, and thus /sbin/init does not load because the dynamic loader cannot be found when following the symlink. NoteL /sbin/init is a symlink to ../bin/busybox which should indeed exist.

You could fetching the latest revision from master where i've made the fix to copy /lib64 into the image:

You can see the multilib lib directory here:

$ find lib -ls
     4097      1 drwxr-xr-x   3 root     root         1024 Jul  2 20:45 lib
       29      0 lrwxrwxrwx   1 root     root           24 Jun 29 21:18 lib/ld-linux-riscv64-lp64.so.1 -> ../lib64/lp64/ld-2.26.so
       28      0 lrwxrwxrwx   1 root     root           26 Jun 29 21:19 lib/ld-linux-riscv32-ilp32d.so.1 -> ../lib32/ilp32d/ld-2.26.so
       27      0 lrwxrwxrwx   1 root     root           25 Jun 29 21:19 lib/ld-linux-riscv32-ilp32.so.1 -> ../lib32/ilp32/ld-2.26.so
       30      0 lrwxrwxrwx   1 root     root           25 Jun 29 21:18 lib/ld-linux-riscv64-lp64d.so.1 -> ../lib64/lp64d/ld-2.26.so
       13      1 drwxr-xr-x   2 root     root         1024 Aug 20 21:12 lib/modules

Let me know how you go...

@truelv
Copy link
Author

truelv commented Aug 20, 2018

Aha,everything goes well.Thx for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants