Operating System - HP-UX
1832642 Members
2875 Online
110043 Solutions
New Discussion

Want to understand more about init process

 
SOLVED
Go to solution
Ken Englander
Regular Advisor

Want to understand more about init process

I am trying to understand the sequence that is used to execute the lines in /etc/inittab. The issue I have is due to the fact that the inittab entries for Oracle CRS do not get executed until after the startup links in /sbin/rc*.d. The entries for Oracle are as follows:

h1:3:respawn:/sbin/init.d/init.evmd run >/dev/null 2>&1 h2:3:respawn:/sbin/init.d/init.cssd fatal >/dev/null 2>&1 h3:3:respawn:/sbin/init.d/init.crsd run >/dev/null 2>&1
I have read the man pages for init and inittab. I understand the following line actually executes the files in /sbin/rc*.d, but it is not clear what determines the order of processing the lines in /etc/inittab.

sqnc::wait:/sbin/rc /dev/console 2>&1 # system init

The Oracle lines are currently close to the end of /etc/inittab. I tried moving them before the sqnc line, but that did not make any difference.

So, what I am wanting is to understand the order in which the lines in /etc/inittab are executed.

Thanks!
11 REPLIES 11
Steven E. Protter
Exalted Contributor

Re: Want to understand more about init process

Shalom,

This is an awful way for Oracle to be configured. It is bad systems administration practice.

Oracle startup scripts belong in /sbin/init.d/

Link to Oracle startup scripts can be created as follows:

cd /sbin/rc3.d
ln -s S900oracle
cd /sbin/rc2.d
ln -s K100oracle
This assumes Oracle doesn't ship with these toys already in place.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Ken Englander
Regular Advisor

Re: Want to understand more about init process

Oracle drops these lines into /etc/inittab and I suspect you know it is best not to mess around with what they set up. I figure they are doing this to utilize the respawn option which would not be available otherwise.

Regardless, this is not helping me understand the init process.
James R. Ferguson
Acclaimed Contributor

Re: Want to understand more about init process

Hi Ken:

When the 'init' daemon first transitions to run-level 3, the scripts you show are started by '/sbin/rc'. Since your 'inittab' specifies 'respawn', the 'init' daemon watches the process to make sure it continues to remain alive. Should the process die, 'init' will restart it without requiring a run-level transition again.

Regards!

...JRF...

Ken Englander
Regular Advisor

Re: Want to understand more about init process

Hi James - actually, unless I misunderstand you, that is not what happens. The h1, h2, and h3 scripts are not executed until after all the scripts in /sbin/rc3.d. And it does matter where those lines are in /etc/inittab.

It almost seems like something special is being done with the sqnc line - perhaps the lines in /etc/inittab are processed based on the action (wait or respawn or ...).
James R. Ferguson
Acclaimed Contributor

Re: Want to understand more about init process

Hi (again) Ken:

Your 'h*' tokens are the IDs for the entries. The 'inittab' format is:

id:rstate:action:process

The 'rstate' (run-state) can assume the values 0-6 and 'a', 'b' or 'c'.

Regards!

...JRF...
Jim Walls
Trusted Contributor

Re: Want to understand more about init process

From the inittab man page

wait
When boot init enters the run level that matches the entry's rstate, start the process and wait for its termination. Any subsequent reads of the inittab file while boot init is in the same run level cause boot init to ignore this entry.

Thus the sqnc line causes intit to wait until /sbin/rc completes. This will occur at the end of processing all the startup scripts present in /sbin/rc3.d.

This should explain the behaviour you have observed. The ordering of lines in /etc/inittab is quite arbitary.
Ken Englander
Regular Advisor

Re: Want to understand more about init process

James - thanks for the explanation, but I was simply trying to identify my reference - I understand the format of the lines.

Jim - I am still trying to understand how init handles what it finds in /etc/inittab - I have read the man pages already - I do not understand exactly what you mean the order of the lines is arbitrary - there has to be some flow to how the lines are handled by init since we are talking about a computer program. That is really what I was hoping to find out here. I have found that it is clearly NOT sequential since it does NOT matter if I move the entries for Oracle in front of the "system init" line.

Does any one understand how init processes the lines in /etc/inittab beyond what is stated on the man page?
Bob E Campbell
Honored Contributor

Re: Want to understand more about init process

Ken, the init.d scripts are transistion scripts. I believe that the system is not in the new run level until all of the transistion scripts have run.
Matti_Kurkela
Honored Contributor
Solution

Re: Want to understand more about init process

When the system is booting up, init first runs the lines with the action type "sysinit". At this time, the system console may not yet be fully initialized, so the output from these actions must be restricted to a minimum. These are executed in the order they appear in the inittab file. These actions handle very basic initialization, such as /sbin/ioinitrc, and the stty command to initialize the console to a known state.

Once the sysinit actions have been completed, the next step is the actions of type "boot" and "bootwait", again in the order they appear in the inittab file. These actions can expect the console to be basically functional, so more complex output is possible.

The difference between "boot" and "bootwait" would be that "boot" is left to run in the background while init goes forward in the boot process, and "bootwait" causes init to wait for the action to complete before it does anything else. The most important bootwait action is /sbin/bcheckrc, which runs the file system checks, changes the root filesystem to a read/write mode and mounts other filesystems.

At this point, init begins to transition the system to the runlevel defined by the initdefault entry (usually runlevel 3 in HP-UX). This means yet another pass through the inittab file. At this time, it runs the actions with types "once" or "respawn" - and only if the runlevel field is empty or matches the target runlevel.

When you moved your Oracle CRS inittab lines before the /sbin/rc line, the system probably attempted to execute them at this point. But because the system is still in a very "bare" state at this point, these scripts probably failed, possibly without leaving any trace to any logs.

(For further investigation: Read the init.evmd, init.cssd and init.crsd scripts, looking for any tests that would cause the scripts to terminate silently. Would the test conditions be true when the system has not yet completed booting up?)

The /sbin/rc line is the main workhorse of HP-UX startup and shutdown. It runs the /sbin/rc?.d scripts as appropriate. These scripts (and *only* them) have the additional benefit of logging their output to /etc/rc.log.

Once the main boot-up pass through the inittab file is complete, init settles to its normal run-time role of monitoring all its child processes. If one of init's children dies, and it was started by a "respawn" action, init will start that process again. (In modern Unix-style systems, there is usually a safety check that delays the restart if the process has failed for more than X times within the last minute or so.)

Because your Oracle CRS lines are using the "respawn" action type, they probably failed the first time if they were run before /sbin/rc (probably because the system was not yet functional enough for them), then succeeded after init restarted them on its first monitoring pass.

MK
MK
Ken Englander
Regular Advisor

Re: Want to understand more about init process

Matti - thanks a lot - that helps a bunch! I think I still have a few gaps in my understanding but I'm getting closer.
Ken Englander
Regular Advisor

Re: Want to understand more about init process

Thank you all for your input!