Operating System - HP-UX
1833790 Members
2816 Online
110063 Solutions
New Discussion

Mount hangs during rc3.d script in ignite build

 
GXW_1
Frequent Advisor

Mount hangs during rc3.d script in ignite build

Hi,

Very strange problem here. I built an HP-UX 11i v3 Ignite server and have built another 11i v3 (Itanium) server from the depot I built on the Ignite Server. All works fine - tested many times.

Problem occurs when I add a post-install script to install some in-house software. The post-install file creates a S99etc script in /sbin/rc3.d so it gets run during the first reboot, then deletes itself. The S99etc script simply mounts the software from an export on the Ignite Server and installs it. That's the theory anyway. In fact the mount hangs and my system never comes up. The wierd thing is, when I get the post-install script to create S99etc as _S99etc (i.e. to bypass it) system obviously builds OK as before, but a subsequent manual invokation of _S99etc works perfectly exactly as I had intended - and installs the software!

SO, question is - what's different between the mount command in a rc3.d script being executed as part of a first reboot, and it being executed manually afterwards?

Could this be a synchronisation error? I tried to build in a 10-min delay before doing my mount, but it still hung.

Any ideas at all?
10 REPLIES 10
Dennis Handly
Acclaimed Contributor

Re: Mount hangs during rc3.d script in ignite build

rc(1M) indicates you should have a 3 digit number, S099etc.
And NFS is only S100nfs.server.
GXW_1
Frequent Advisor

Re: Mount hangs during rc3.d script in ignite build

OMG! I never noticed the 3-digit thing. I'm sure it always used to be 2-digit (I was trained in 9.04 :-/, and I naively assumed since my script was at the bottom of an ls output, it would be executed last - but clearly 99 is less than 100 and that would explain the hang! I'll change it to S999 and re-test.

I'll let you know in a couple of hours :-)

Thanks Dennis.
GXW_1
Frequent Advisor

Re: Mount hangs during rc3.d script in ignite build

Sadly S999etc hangs too so back to square one - any ideas?
Pete Randall
Outstanding Contributor

Re: Mount hangs during rc3.d script in ignite build

Does /etc/rc.log offer any clues?


Pete

Pete
Pete Randall
Outstanding Contributor

Re: Mount hangs during rc3.d script in ignite build

And, since it runs manually, I have to wonder about the environment available to it at startup. Does the script use full path names and define all environment variables it needs?


Pete

Pete
GXW_1
Frequent Advisor

Re: Mount hangs during rc3.d script in ignite build

The system hangs on the mount command, so I can't check rc.log - I either rebuild or just now I tried to boot into single user mode to move the S999etc out of the way and let the system come up which it did, but over-wrote rc.log :-/

As for the environment yes that is a possible area for discrepancy but I have full path names for all commands. Thing I noticed is that mount is in /usr/sbin whereas all the other commands in my script are in /usr/bin. However, if the mount command was absent I'd expect an error message, not a hang. No environment variables are expected.
Scot Bean
Honored Contributor

Re: Mount hangs during rc3.d script in ignite build

To break out of a hung rc script, try "ctrl \" from the console. Then you maybe can see more of what is going on. May need to hit this break sequence several times.
GXW_1
Frequent Advisor

Re: Mount hangs during rc3.d script in ignite build

Thanks Scot, the "ctrl \" trick helped me a lot, as it enabled me to test changes a lot quicker.

In fact, I have fixed it now, and it was a very strange problem indeed.

Since my S999etc script was going to be run only once then deleted, to install some in-house software, I didn't bother adding the case statement with the start and stop cases etc. I just had the commands I wanted to execute.

Unfortunately, what HP-UX 11i v3 seems to do, and I don't know if the same is true of earlier versions, is execute all startup scripts with a parm of "start_msg" to build the list of things it needs to start, and collects all the start_msgs which will eventually go on the console suffixed by [OK] .... BUT it found my S999etc script and executed my code way before I expected it to, and clearly well before NFS was up - hence why my Mount was failing.

When I added the case statement, it worked fine, and when you see it working OK, it becomes very obvious why it wasn't working before.

Anyway, thanks to all who responded. This may well be my first AND last attempt at messing about with rc scripts :-/
OldSchool
Honored Contributor

Re: Mount hangs during rc3.d script in ignite build

actually, they're not so bad. Just remember the following:

a) start with /sbin/init.d/template next time
b) its 3 digits
c) the "number" of the start and kill script should = 1000. i.e. S100xxx and K900xxx so things get started and stopped in the correct order
Bill Hassell
Honored Contributor

Re: Mount hangs during rc3.d script in ignite build

One other note about rc scripts:

/sbin/init.d/template

This script has lots of comments describing the design of such a script. I have attached a similar script with a useful function for stopping a process or application and a lot of extra comments. Makes rc script writing a lot easier.


Bill Hassell, sysadmin