"Lost" /etc/rc* errors

Beau James ultra!beau at ames.arc.nasa.gov
Fri Mar 31 11:47:04 AEST 1989


Dianh Anderson writes (in part):

-- We ran into this very problem today. Our problem turned out to be an
-- error in rc.local. This caused the rpc.mountd and probably some other
-- key daemons not to be started at boot time. What happens is that an
-- error in rc.local can cause everything past that point in rc.local and
-- rc NOT to be executed.  The SUN never mentions that it is having a
-- problem. We first noticed the automounter NOT starting at boot time and
-- then the client boot problem.

Silent failures from the /etc/rc* scripts have been a pet peeve of mine
for many years.  I submitted my first bug report/RFE about this against
SunOS 0.9, and several times since then.  The response was to add this
comment to the scripts:

    # Note that all "echo" commands are in parentheses.  This is done
    # because all commands that redirect the output to "/dev/console"
    # must be done in a child of the main shell, so that the main shell
    # does not open a terminal and get its process group set.  Since
    # "echo" is a builtin command, redirection for it will be done
    # in the main shell unless the command is run in a subshell.

which misses the point entirely (and fails to explain why getting the
shell's process group set is a bad idea!).

As far as I am aware, the only reason for all this avoidance is to prevent
the startup scripts from being interruptable - so that you can't type "^C"
to interrupt or "^\" to core dump the main shell.

I'm not sure why that's a big win.  But if it really is desirable, then
the right approach should have been to run each command in a subshell,
with BOTH stdout and stderr redirected to the console.  

There is a simpler fix for the silent failure syndrome.  Place the line

	exec > /dev/console 2>&1

at the beginning of /etc/rc and /etc/rc.boot.  That will redirect both
stdout and stderr to the console, for the "main shell" and for each of the
commnands run from the main shell.

Once you add that line, you will also want to comment out the rc* lines
that are wrong for your configuration (e.g. "ifconfig ec0 ..." on a
machine with an "ie" interface) to avoid unnecessary error messages.

Beau James					beau at ultra.com
Ultra Network Technologies			sun!ames!ultra!beau



More information about the Comp.sys.sun mailing list