Linux init failures now easier to debug

If you are an embedded Linux developer too, you have probably been frustrated by the lack of information from the Linux kernel when it failed to start the init process when you’re building a new root filesystem. The only thing you get is No init found, and this could hide many different causes:

  • No init program candidate found at all
  • Some init program candidates exist but they can’t be executed, for multiple possible causes (missing execute permissions, failed to load shared libraries, executable compiled for an unknown architecture…)

The good news is that this source of frustration will be gone in Linux 3.13. Thanks to a Free Electrons commit merged on Nov. 13, 2013, whenever an attempt to execute an init program candidate fails, there is a message in the console detailing the executable path and the error code. For example:

Starting init: /sbin/init exists but couldn't execute it (error -13)

When you get such a message, all you have to do is lookup the error code in include/uapi/asm-generic/errno-base.h or maybe in uapi/asm-generic/errno.h. In the above example, the -13 code meant permission denied, typically because of missing execution rights.

This had been annoying me for a long time, and I am glad that the Linux kernel community accepted my improvement!

By the way, many more improvements to the Linux kernel from Free Electrons are currently getting merged in 3.13. See all our contributions to the Linux kernel.

About Michael Opdenacker

Michael Opdenacker is the founder of Free Electrons. He is best known for all the free embedded Linux and kernel training materials that he created together with Thomas Petazzoni. He is always looking for ways to increase performance, reduce size and boot time, and to maximize Linux' world domination. More details...
This entry was posted in Technical and tagged , , . Bookmark the permalink.

4 Responses to Linux init failures now easier to debug

  1. Marco Cavallini says:

    This feature has always been necessary since in 2002 I developed with StrongArm, and I am glad that the Linux kernel community finally accepted it.
    This is a sign of how the community now pay more attention to the real world needs.

  2. Markus Franke says:

    Awesome! Thumbs up for the patch. Any additional information for debugging kernel bootup problems is very much welcome. 🙂

  3. tried withlove says:

    hello,
    First of all thank you to free Electrons for their courses.
    I am now improving at home the embedded Linux course and I am blocked on this issue with busybox over the network using NFS protocol
    I have try with chmod to change the properties of busybox compile file.
    the command fails.
    I have check on Busybox side and their suggestion although (instead of working on init run a fake one which is just a hello world) helpful doesn’t work neither.
    I’ve got the same error (error 13).
    Am using the same kernel patched and busybox version as the one indicated in the course.
    any clue to allow that execution?
    Everything from the beginning till there works fine.
    once more thank you for the course.

Leave a Reply

Your email address will not be published. Required fields are marked *