18c2ecf20Sopenharmony_ciExplaining the "No working init found." boot hang message
28c2ecf20Sopenharmony_ci=========================================================
38c2ecf20Sopenharmony_ci:Authors: Andreas Mohr <andi at lisas period de>
48c2ecf20Sopenharmony_ci          Cristian Souza <cristianmsbr at gmail period com>
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ciThis document provides some high-level reasons for failure
78c2ecf20Sopenharmony_ci(listed roughly in order of execution) to load the init binary.
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci1) **Unable to mount root FS**: Set "debug" kernel parameter (in bootloader
108c2ecf20Sopenharmony_ci   config file or CONFIG_CMDLINE) to get more detailed kernel messages.
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci2) **init binary doesn't exist on rootfs**: Make sure you have the correct
138c2ecf20Sopenharmony_ci   root FS type (and ``root=`` kernel parameter points to the correct
148c2ecf20Sopenharmony_ci   partition), required drivers such as storage hardware (such as SCSI or
158c2ecf20Sopenharmony_ci   USB!) and filesystem (ext3, jffs2, etc.) are builtin (alternatively as
168c2ecf20Sopenharmony_ci   modules, to be pre-loaded by an initrd).
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci3) **Broken console device**: Possibly a conflict in ``console= setup``
198c2ecf20Sopenharmony_ci   --> initial console unavailable. E.g. some serial consoles are unreliable
208c2ecf20Sopenharmony_ci   due to serial IRQ issues (e.g. missing interrupt-based configuration).
218c2ecf20Sopenharmony_ci   Try using a different ``console= device`` or e.g. ``netconsole=``.
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci4) **Binary exists but dependencies not available**: E.g. required library
248c2ecf20Sopenharmony_ci   dependencies of the init binary such as ``/lib/ld-linux.so.2`` missing or
258c2ecf20Sopenharmony_ci   broken. Use ``readelf -d <INIT>|grep NEEDED`` to find out which libraries
268c2ecf20Sopenharmony_ci   are required.
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci5) **Binary cannot be loaded**: Make sure the binary's architecture matches
298c2ecf20Sopenharmony_ci   your hardware. E.g. i386 vs. x86_64 mismatch, or trying to load x86 on ARM
308c2ecf20Sopenharmony_ci   hardware. In case you tried loading a non-binary file here (shell script?),
318c2ecf20Sopenharmony_ci   you should make sure that the script specifies an interpreter in its
328c2ecf20Sopenharmony_ci   shebang header line (``#!/...``) that is fully working (including its
338c2ecf20Sopenharmony_ci   library dependencies). And before tackling scripts, better first test a
348c2ecf20Sopenharmony_ci   simple non-script binary such as ``/bin/sh`` and confirm its successful
358c2ecf20Sopenharmony_ci   execution. To find out more, add code ``to init/main.c`` to display
368c2ecf20Sopenharmony_ci   kernel_execve()s return values.
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ciPlease extend this explanation whenever you find new failure causes
398c2ecf20Sopenharmony_ci(after all loading the init binary is a CRITICAL and hard transition step
408c2ecf20Sopenharmony_ciwhich needs to be made as painless as possible), then submit a patch to LKML.
418c2ecf20Sopenharmony_ciFurther TODOs:
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci- Implement the various ``run_init_process()`` invocations via a struct array
448c2ecf20Sopenharmony_ci  which can then store the ``kernel_execve()`` result value and on failure
458c2ecf20Sopenharmony_ci  log it all by iterating over **all** results (very important usability fix).
468c2ecf20Sopenharmony_ci- Try to make the implementation itself more helpful in general, e.g. by
478c2ecf20Sopenharmony_ci  providing additional error messages at affected places.
488c2ecf20Sopenharmony_ci
49