162306a36Sopenharmony_ciExplaining the "No working init found." boot hang message 262306a36Sopenharmony_ci========================================================= 362306a36Sopenharmony_ci:Authors: Andreas Mohr <andi at lisas period de> 462306a36Sopenharmony_ci Cristian Souza <cristianmsbr at gmail period com> 562306a36Sopenharmony_ci 662306a36Sopenharmony_ciThis document provides some high-level reasons for failure 762306a36Sopenharmony_ci(listed roughly in order of execution) to load the init binary. 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci1) **Unable to mount root FS**: Set "debug" kernel parameter (in bootloader 1062306a36Sopenharmony_ci config file or CONFIG_CMDLINE) to get more detailed kernel messages. 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_ci2) **init binary doesn't exist on rootfs**: Make sure you have the correct 1362306a36Sopenharmony_ci root FS type (and ``root=`` kernel parameter points to the correct 1462306a36Sopenharmony_ci partition), required drivers such as storage hardware (such as SCSI or 1562306a36Sopenharmony_ci USB!) and filesystem (ext3, jffs2, etc.) are builtin (alternatively as 1662306a36Sopenharmony_ci modules, to be pre-loaded by an initrd). 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci3) **Broken console device**: Possibly a conflict in ``console= setup`` 1962306a36Sopenharmony_ci --> initial console unavailable. E.g. some serial consoles are unreliable 2062306a36Sopenharmony_ci due to serial IRQ issues (e.g. missing interrupt-based configuration). 2162306a36Sopenharmony_ci Try using a different ``console= device`` or e.g. ``netconsole=``. 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_ci4) **Binary exists but dependencies not available**: E.g. required library 2462306a36Sopenharmony_ci dependencies of the init binary such as ``/lib/ld-linux.so.2`` missing or 2562306a36Sopenharmony_ci broken. Use ``readelf -d <INIT>|grep NEEDED`` to find out which libraries 2662306a36Sopenharmony_ci are required. 2762306a36Sopenharmony_ci 2862306a36Sopenharmony_ci5) **Binary cannot be loaded**: Make sure the binary's architecture matches 2962306a36Sopenharmony_ci your hardware. E.g. i386 vs. x86_64 mismatch, or trying to load x86 on ARM 3062306a36Sopenharmony_ci hardware. In case you tried loading a non-binary file here (shell script?), 3162306a36Sopenharmony_ci you should make sure that the script specifies an interpreter in its 3262306a36Sopenharmony_ci shebang header line (``#!/...``) that is fully working (including its 3362306a36Sopenharmony_ci library dependencies). And before tackling scripts, better first test a 3462306a36Sopenharmony_ci simple non-script binary such as ``/bin/sh`` and confirm its successful 3562306a36Sopenharmony_ci execution. To find out more, add code ``to init/main.c`` to display 3662306a36Sopenharmony_ci kernel_execve()s return values. 3762306a36Sopenharmony_ci 3862306a36Sopenharmony_ciPlease extend this explanation whenever you find new failure causes 3962306a36Sopenharmony_ci(after all loading the init binary is a CRITICAL and hard transition step 4062306a36Sopenharmony_ciwhich needs to be made as painless as possible), then submit a patch to LKML. 4162306a36Sopenharmony_ciFurther TODOs: 4262306a36Sopenharmony_ci 4362306a36Sopenharmony_ci- Implement the various ``run_init_process()`` invocations via a struct array 4462306a36Sopenharmony_ci which can then store the ``kernel_execve()`` result value and on failure 4562306a36Sopenharmony_ci log it all by iterating over **all** results (very important usability fix). 4662306a36Sopenharmony_ci- Try to make the implementation itself more helpful in general, e.g. by 4762306a36Sopenharmony_ci providing additional error messages at affected places. 4862306a36Sopenharmony_ci 49