Friday, January 03, 2014

troubleshooting for init

Recently, I had an error message like
"Kernel panic - not syncing: No init found.  Try passing init= option to kernel."

After I did some investigations, the possible problems are listed below,
1. is the kernel config "Kernel support for ELF binaries" not enabled?
   from http://blog.whatisthisbird.com/2010/08/linuxkernel-panic-not-syncing-no-init.html
2. the init file cannot execute normally, maybe lack of the needed libraries.
   from http://dicky-chiang.blogspot.tw/2009/07/embedded-linux.html

But I have neither of these problems.

Finally, I found that the tricky is that
in openwrt, init/main.c init_post() will try to invoke /etc/preinit, but there is not such thing in my rootfs.
(normally, init/main.c init_post() will try
 /sbin/init
 /etc/init
 ...
)

So my solution is to append "init=/sbin/init" to the kernel command line to tell the kernel the exact init location.

No comments: