Search code examples
linuxsystemdinit

Why is the first level process init placed in /sbin?


In Linux essential executables that must be available in single user mode must be placed under /bin. However 'init' is placed in /sbin. Is this correct?


Solution

  • Why is the first level process init placed in /sbin?

    The Filesystem Hierarchy Standard (FHS) and fhs-3.0 says that:

    Utilities used for system administration (and other root-only commands) are stored in /sbin, /usr/sbin, and /usr/local/sbin. /sbin contains binaries essential for booting, restoring, recovering,and/or repairing the system in addition to the binaries in /bin.

    As the init process is a binary essential for booting the system, it is natural to place it in /sbin directory (if one follows the standard).

    In Linux essential executables that must be available in single user mode must be placed under /bin.

    Yes, the standard says so. Still, there is no "must", there is no enforcing. Yes, most distribution packages place essential executable in the /bin directory, as this is what standard says they should be placed there, so it's natural to place them there. You can do whatever you want with your system and have your own directory structure that you desire.

    However 'init' is placed in /sbin. Is this correct?

    Generally, as a convention, yes. Still, you can pass init= kernel command line parameter and basically init=/place/your/init/binary/anywhere/you/want. The first place the kernel searches for a startup process is /sbin/init.

    And yes, /sbin has binaries required for booting the system, not necessarily for administrating the system when no filesystem are mounted.

    Could it be that init (systemd) is not running in single user mode?

    On a system without systemd it is never running.