xref: /OK3568_Linux_fs/kernel/Documentation/admin-guide/init.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunExplaining the "No working init found." boot hang message
2*4882a593Smuzhiyun=========================================================
3*4882a593Smuzhiyun:Authors: Andreas Mohr <andi at lisas period de>
4*4882a593Smuzhiyun          Cristian Souza <cristianmsbr at gmail period com>
5*4882a593Smuzhiyun
6*4882a593SmuzhiyunThis document provides some high-level reasons for failure
7*4882a593Smuzhiyun(listed roughly in order of execution) to load the init binary.
8*4882a593Smuzhiyun
9*4882a593Smuzhiyun1) **Unable to mount root FS**: Set "debug" kernel parameter (in bootloader
10*4882a593Smuzhiyun   config file or CONFIG_CMDLINE) to get more detailed kernel messages.
11*4882a593Smuzhiyun
12*4882a593Smuzhiyun2) **init binary doesn't exist on rootfs**: Make sure you have the correct
13*4882a593Smuzhiyun   root FS type (and ``root=`` kernel parameter points to the correct
14*4882a593Smuzhiyun   partition), required drivers such as storage hardware (such as SCSI or
15*4882a593Smuzhiyun   USB!) and filesystem (ext3, jffs2, etc.) are builtin (alternatively as
16*4882a593Smuzhiyun   modules, to be pre-loaded by an initrd).
17*4882a593Smuzhiyun
18*4882a593Smuzhiyun3) **Broken console device**: Possibly a conflict in ``console= setup``
19*4882a593Smuzhiyun   --> initial console unavailable. E.g. some serial consoles are unreliable
20*4882a593Smuzhiyun   due to serial IRQ issues (e.g. missing interrupt-based configuration).
21*4882a593Smuzhiyun   Try using a different ``console= device`` or e.g. ``netconsole=``.
22*4882a593Smuzhiyun
23*4882a593Smuzhiyun4) **Binary exists but dependencies not available**: E.g. required library
24*4882a593Smuzhiyun   dependencies of the init binary such as ``/lib/ld-linux.so.2`` missing or
25*4882a593Smuzhiyun   broken. Use ``readelf -d <INIT>|grep NEEDED`` to find out which libraries
26*4882a593Smuzhiyun   are required.
27*4882a593Smuzhiyun
28*4882a593Smuzhiyun5) **Binary cannot be loaded**: Make sure the binary's architecture matches
29*4882a593Smuzhiyun   your hardware. E.g. i386 vs. x86_64 mismatch, or trying to load x86 on ARM
30*4882a593Smuzhiyun   hardware. In case you tried loading a non-binary file here (shell script?),
31*4882a593Smuzhiyun   you should make sure that the script specifies an interpreter in its
32*4882a593Smuzhiyun   shebang header line (``#!/...``) that is fully working (including its
33*4882a593Smuzhiyun   library dependencies). And before tackling scripts, better first test a
34*4882a593Smuzhiyun   simple non-script binary such as ``/bin/sh`` and confirm its successful
35*4882a593Smuzhiyun   execution. To find out more, add code ``to init/main.c`` to display
36*4882a593Smuzhiyun   kernel_execve()s return values.
37*4882a593Smuzhiyun
38*4882a593SmuzhiyunPlease extend this explanation whenever you find new failure causes
39*4882a593Smuzhiyun(after all loading the init binary is a CRITICAL and hard transition step
40*4882a593Smuzhiyunwhich needs to be made as painless as possible), then submit a patch to LKML.
41*4882a593SmuzhiyunFurther TODOs:
42*4882a593Smuzhiyun
43*4882a593Smuzhiyun- Implement the various ``run_init_process()`` invocations via a struct array
44*4882a593Smuzhiyun  which can then store the ``kernel_execve()`` result value and on failure
45*4882a593Smuzhiyun  log it all by iterating over **all** results (very important usability fix).
46*4882a593Smuzhiyun- Try to make the implementation itself more helpful in general, e.g. by
47*4882a593Smuzhiyun  providing additional error messages at affected places.
48*4882a593Smuzhiyun
49