Linux Boot Process


As many people have often wondered, how does the Linux / Unix operating system boot? How could I put in a process to run during boot so that I do not have to start it every time manually? To do this one has to understand the basic environment procedure that is currently in place to add anything to it.

On a typical Linux system, I prefer Debian, the bootloader points to the kernel which in turn points to a file under / etc known as inittab. The interaction between the bootloader and the kernel is complex enough for another article.

  1. The / etc / inittab is a file that contains a set of instructions to call a specific directory under the / etc directory. It is a Shell script that looks something like this:

    # / etc / inittab: init (8) configuration.
    # $ Id: inittab, v 1.91 2002/01/25 13:35:21 miquels Exp $

    # The default runlevel.
    id: 2: initdefault:

    # Boot-time system configuration / initialization script.
    # This is run first except when boot in emergency (-b) mode.
    si :: sysinit: /etc/init.d/rcS

  2. The system then calls the /etc/init.d/rcS shell script. This script then executes each shell script found in /etc/rcS.d/ directory. When an application is added to the system it will place its startup script in either the /etc/rcS.d/ or the /etc/rc2.d/ directory. This set of scripts are run initially and are system specific and should never be tampered with. After this set of scripts spawns off each process the /etc/init.d/rcS script then calls all files under /etc/rc2.d/ directory. The /etc/rc2.d/ directory is usually application software and not software required specifically for the system. Each file in these directories has a S (for start) and a number. For example: S43portmap. The number does not mean it will be the 43rd process started, but instead is used to stem which process is started. So, if you wanted something to start before or after S43portmap you would set the prefix to be S40 for before the S43portmap and S50 for after the S43portmap.
  3. If you wanted to add your own application to be run you should always add it into the /etc/rc2.d/ directory. The /etc/rc2.d/ is the default runlevel used on most Linux systems.
  4. If you find yourself in the /etc/rc2.d/ directory you may notice that each file is actually symlinked back to the /etc/init.d/ directory. You are in fact correct. Its actually pretty neat if you think about it, as you could just create a symlink with a different number to start any of these scripts at a different time. This also gives the flexibility to the user to easily modify the boot process for his / her system.

Now show me how to do that in Windows!

For more information related to Linux and UNIX head over to


Leave a Reply