3

When the init process is executed when the kernel has loaded, does it read the /etc/inittab file in a top down approach i.e. it executes each line as it appears in the file.

If so and based on my reading and understanding, does this mean that it enters the documented run level and then launch sysinit process or vice versa?

For example the common examples I have seen are

id:3:initdefault:

# System initialization.
si::sysinit:/etc/rc.d/rc.sysinit

2 Answers2

5

First, note that the format of inittab is like so:

Identifier:RunLevel:Action:Command

The key point here being the runlevel. Given the following example code:

a:3::
b:123::
c:23::
d:123::
e:23::

Then the order of execution of the various IDs, starting from runlevel 1 would be:

init 1:  b d
init 2:  c e
init 3:  a
overall: b d c e a

As you can see, it will run them in the order that they are listed in the file, group by runlevel! Also remember, if the identifier is not in the specified runlevel, it will be issued a SIGTERM and then a SIGKILL.

Andrew M.
  • 244
0

It is not a script that is processed in any particular order. It is a configuration file that tells the system what script/commands to run for a particular event or run level. The order of the entries in the file will make no difference, and you can have multiple scripts or commands for each run level.

the first line you show "id:3:initdefault:" tells the system the default run level is 3 => multiuser mode for most flavors.

the "si::sysinit:..." line tells the system to run the script /etc/rc.d/rc/sysinit upon system initialization (runs when the system boots).

if you man inittab, you should get a list of all the options for the file.