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