14.6 The init Process

   

This is the most important process in the boot sequence. It is always started with a process ID of 1. After startup, it reads its configuration file, /etc/inittab , and looks for an entry, initdefault in the action field. This tells init the default runlevel of the system. Runlevel is a state of the system, and at all times HP-UX is in one of the defined runlevels. If the initdefault entry is not present, init prompts for a default runlevel to enter. It then spawns ioinit , bcheckrc , rc , and getty processes depending on the default runlevel chosen .

The main actions taken by the init process are:

  • Read the initdefault parameter from the /etc/inittab file

  • Initialize the kernel data structures using /sbin/ioinitrc

  • Run /sbin/bcheckrc

  • Run /sbin/rc and bring the system to the default runlevel

/etc/inittab File

The /etc/inittab file is a configuration file read by the init process. This file contains entries in the following general format.

 id:rstate:action:process 

Each entry consists of one line in the file. However, an entry can be continued on the next line by ending the line with a backslash character. The fields in the inittab file are explained here.

id It is a unique ID for each entry and can be 1 to 4 characters long.
rstate This is the runlevel in which the entry is processed . Multiple runlevels can be specified in this field. If no runlevel is given, the process is assumed to run in all runlevels.
action This is a keyword that tells init how to treat the process specified in the next field. A keyword " boot " in this field shows that the process is started at boot time but to not wait for its termination. The init process does not restart the process after it terminates. The keyword " bootwait " tells init to start the process at boot time and to wait for its termination; init does not restart the process after it terminates. The " initdefault " keyword tells init to which runlevel the system goes after the boot process is completed. It shows the default runlevel of the system. The " respawn " keyword tells the system that if this process does not exist or terminates due to some reason, restart it. A " sysinit " keyword in this file shows that this entry is processed before the init process accesses the console. This is usually for the initialization of devices. The keyword " wait " tells init to start the process and to wait for its termination.
process This is the actual process or command line that is executed.

Initialization of I/O Devices with ioinit

After reading the initdefault entry in the file, the init process starts executing commands or scripts that have sysinit . Most important of these is /sbin/ioinitrc . The ioinitrc file uses information from /etc/ ioconfig and invokes the ioinit command to check and maintain consistency between /etc/ioconfig and the kernel data structure. This command assigns instance numbers to all new devices found in the system and invokes the insf command to create special device files for all of these devices.

The /sbin/bcheckrc Script

This script does things that are necessary before mounting the file systems. It activates LVM if it is being used on your system. It also checks and cleans file systems using fsck before these are mounted. It also loads appropriate key maps depending on the keyboard used with the system. If your workstation is also equipped with a EISA backplane, it runs eisa_config in automatic mode to configure and initialize it.

The /sbin/rc Script

The /sbin/rc script is run whenever a new runlevel is created or when the system moves from a lower runlevel to a higher one or vice versa. When moving from a lower to a higher runlevel, the rc script starts daemons and server processes for that runlevel. When moving from a higher to a lower runlevel, the rc script stops all servers and daemons not needed in the lower runlevel. The rc script halts the system when moving to runlevel 0.

Sample /etc/inittab

This sample inittab file is taken from a 9000-series server.

 init:3:initdefault: ioin::sysinit:/sbin/ioinitrc >/dev/console 2>&1 tape::sysinit:/sbin/mtinit > /dev/console 2>&1 muxi::sysinit:/sbin/dasetup   </dev/console >/dev/console 2>&1 # mux init stty::sysinit:/sbin/stty 9600 clocal icanon echo opost onlcr \              ixon icrnl ignpar /dev/systty pwr::bootwait:/etc/powerstartup </dev/console >/dev/console 2>&1 # PowerPath brc1::bootwait:/sbin/bcheckrc </dev/console >/dev/console 2>&1 # fsck, etc. link::wait:/sbin/sh -c "/sbin/rm -f /dev/syscon; \                /sbin/ln /dev/systty /dev/syscon" >/dev/console 2>&1 cprt::bootwait:/sbin/cat /etc/copyright >/dev/syscon           # legal req sqnc::wait:/sbin/rc </dev/console >/dev/console 2>&1           # system init #powf::powerwait:/sbin/powerfail >/dev/console 2>&1            # powerfail cons:123456:respawn:/usr/sbin/getty console console            # system console #ttp1:234:respawn:/usr/sbin/getty -h tty0p1 9600 #ttp2:234:respawn:/usr/sbin/getty -h tty0p2 9600 #ttp3:234:respawn:/usr/sbin/getty -h tty0p3 9600 #ttp4:234:respawn:/usr/sbin/getty -h tty0p4 9600 #ttp5:234:respawn:/usr/sbin/getty -h tty0p5 9600 #ups::respawn:rtprio 0 /usr/lbin/ups_mond -f /etc/ups_conf ems1::bootwait:/sbin/cat </dev/null >/etc/opt/resmon/persistence/reboot_flag ems2::bootwait:/sbin/rm -f /etc/opt/resmon/persistence/runlevel4_flag ems3:3:once:touch /etc/opt/resmon/persistence/runlevel4_flag ems4:3456:respawn:/etc/opt/resmon/lbin/p_client 

   
Top


HP Certified
HP Certified: HP-UX System Administration
ISBN: 0130183741
EAN: 2147483647
Year: 2000
Pages: 390
Authors: Rafeeq Rehman

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net