System Administration Guide: Basic Administration

The /etc/inittab File

When you boot the system or change run levels with the init or shutdown command, the init daemon starts processes by reading information from the /etc/inittab file. This file defines three important items for the init process:

Each entry in the /etc/inittab file has the following fields:

id:rstate:action:process

The following table describes the fields in an inittab entry.

Table 11–2 Fields Descriptions for the inittab File

Field 

Description 

id

Is a unique identifier for the entry. 

rstate

Lists the run levels to which this entry applies. 

action

Identifies how the process that is specified in the process field is to be run. Possible values include: initdefault, sysinit, boot, bootwait, wait, and respawn.

initdefault identifies the default run level. For a description of the other action keywords, see inittab(4).

process

Defines the command or script to execute. 

Example—Default inittab File

The following example shows an annotated default inittab file that is installed with the Solaris release:


 

1 ap::sysinit:/sbin/autopush -f /etc/iu.ap
2 ap::sysinit:/sbin/soconfig -f /etc/sock2path
3 fs::sysinit:/sbin/rcS sysinit   >/dev/msglog 2<>/dev/msglog </dev/console
4 is:3:initdefault:
5 p3:s1234:powerfail:/usr/sbin/shutdown -y -i5 -g0 >/dev/msglog 2<>/dev/...
6 sS:s:wait:/sbin/rcS              >/dev/msglog 2<>/dev/msglog </dev/console
7 s0:0:wait:/sbin/rc0              >/dev/msglog 2<>/dev/msglog </dev/console
8 s1:1:respawn:/sbin/rc1           >/dev/msglog 2<>/dev/msglog </dev/console
9 s2:23:wait:/sbin/rc2             >/dev/msglog 2<>/dev/msglog </dev/console
10 s3:3:wait:/sbin/rc3             >/dev/msglog 2<>/dev/msglog </dev/console
11 s5:5:wait:/sbin/rc5             >/dev/msglog 2<>/dev/msglog </dev/console
12 s6:6:wait:/sbin/rc6             >/dev/msglog 2<>/dev/msglog </dev/console
13 fw:0:wait:/sbin/uadmin 2 0      >/dev/msglog 2<>/dev/msglog </dev/console
14 of:5:wait:/sbin/uadmin 2 6      >/dev/msglog 2<>/dev/msglog </dev/console
15 rb:6:wait:/sbin/uadmin 2 1      >/dev/msglog 2<>/dev/msglog </dev/console
16 sc:234:respawn:/usr/lib/saf/sac -t 300
17 co:234:respawn:/usr/lib/saf/ttymon -g -h -p "`uname -n` console login: " 
   -T terminal-type -d /dev/console -l console
-m ldterm,ttcompat  
  1. Initializes STREAMS modules

  2. Configures socket transport providers

  3. Initializes file systems

  4. Defines default run level

  5. Describes a power fail shutdown

  6. Defines single-user level

  7. Defines run level 0

  8. Defines run level 1

  9. Defines run level 2

  10. Defines run level 3

  11. Defines run level 5

  12. Defines run level 6

  13. Defines an unused level, firmware

  14. Defines an unused level, off

  15. Defines an unused level, reboot

  16. Initializes Service Access Controller

  17. Initializes console and identifies the terminal type

What Happens When the System Is Brought to Run Level 3

  1. The init process is started and reads the /etc/default/init file to set any environment variables. By default, only the TIMEZONE variable is set.

  2. Then init reads the inittab file and does the following:

    1. Identifies the initdefault entry, which defines the default run level (3).

    2. Executes any process entries that have sysinit in the action field so that any special initializations can take place before users login.

    3. Executes any process entries that have a 3 in the rstate field, which matches the default run level, 3.

      For a detailed description of how the init process uses the inittab file, see init(1M).

      The following table describes the keywords used for run level 3's action field.

      Table 11–3 Run Level 3 Action Keyword Descriptions

      Key Word 

      Description 

      powerfail

      Starts the process when the init process receives a power failure signal

      respawn

      Starts the process and restarts it when it dies 

      wait

      Starts the process and waits for it to finish before going on to the next entry for this run level 

The following table describes the processes (or commands) that are executed at run level 3.

Table 11–4 Command Descriptions for Run Level 3

Command or Script Name 

Description 

/usr/sbin/shutdown

Shuts down the system. The init process runs the shutdown command only if the system has received a power fail signal.

/sbin/rcS

Mounts and checks root (/), /usr, /var, and /var/adm file systems.

/sbin/rc2

Starts the standard system processes and brings the system up into run level 2 (multiuser level). 

/sbin/rc3

Starts NFS resource sharing for run level 3. 

/usr/lib/saf/sac -t 30

Starts the port monitors. This process is restarted if it fails. 

/usr/lib/saf/ttymon -g -h -p "`uname -n` console login: " -T terminal_type -d /dev/console -l console

Starts the ttymon process that monitors the console for login requests. This process is restarted if it fails.

The terminal_type on a SPARC based system is sun.

The terminal_type on an IA based system is AT386.