Saturday, May 11, 2013

Linux init process

As we have seen before, the usual boot sequence of a Linux-based platform consists of several steps :


The init process :
  • completes the boot procedure
  • have the process ID '1'
  • starts the system processes (as described in /etc/inittab)
  • is not part of the kernel, it belongs to the user space ( /sbin/init )
  • never dies : it handles the operating system's life cycle (restart, shutdown,..)
There are many alternatives for the init process, it is usually installed with one of the following startup programs :

  • sysvinit : linux traditional init program
  • upstart : used by most of the linux distributions
  • systemd : Fedora
  • busybox : for small embedded systems
When built, these projects generate an init process and a set of common tools like telinit or initctl.

Run level

At boot, init checks the inittab configuration file for the runlevel parameter. This value goes from 0 to 6 and a specific set of actions is executed for each of them.


Depending on the default init level setting, the system will execute the programs from one of the following folders :

  • Run level 0 : /etc/rc.d/rc0.d
  • Run level 1 : /etc/rc.d/rc1.d
  • Run level 2 : /etc/rc.d/rc2.d
  • Run level 3 : /etc/rc.d/rc3.d
  • Run level 4 : /etc/rc.d/rc4.d
  • Run level 5 : /etc/rc.d/rc5.d
  • Run level 6 : /etc/rc.d/rc6.d
In these directories, the program names start with either S or K followed with a sequence number and the program name.
  • The programs starting with an S are executed on system Start while the programs starting with a K are executed on system Kill. 
  • The sequence number indicates when the program has the be executed.
For example, S12syslog has to be started before S80sendmail.

0 comments:

Post a Comment