SUMMARY: Debugging boot process

From: Matthias Kurz <mk_at_baerlap.north.de>
Date: Fri Apr 05 2002 - 01:24:37 EST
On Thu, Apr 04, 2002 at 12:02:55PM +0200, Matthias Kurz wrote:
> I have a Blade 100 that hangs somewhere during the boot. But i don't know
> where. Is there an easy way to enable debug output or so ?
> My only idea is to put a line in the beginning of every script in
> /etc/init.d (after #!/bin/sh):
> [ -r /etc/init.d/debugcmds.inc ] && . /etc/init.d/debugcmds.inc
> but that is a lot of work...

The reason for the hang was, that there were static NFS mounts without
"bg" option in /etc/vfstab. The machine has sometimes problems to get
a network link (guilty is most probably an old hub).

To the debugging:
-----------------

Thanks to:

David Leach
Fabrice Guerini
Hindley Nick
John Elser
Mark Mcmanus
Stuart Little
sunsrv@blr.cmc...
Vinnie German


There seems to be no "standard mechanism". The informations from
"boot -a" or "boot -v" were not very usable in my situation.

There are some tricks:

- start from single user mode
  Try to boot into single user mode (boot -s). Then run the S*-scripts
  in /etc/rc2.d etc. one after the other from the command line.

- modify /etc/rc?
  Do not edit every script in /etc/init.d, but the scripts
  /etc/rc[S012...].
  There is a loop in every script, where the different scripts in the
  rcX.d dirs are started. One can add control messages and modify the
  "/sbin/sh $f stop/start" calls to look like "/sbin/sh -x $f ...".

- insert a debug line in every script in /etc/init.d
  e.g.
  [ -r /etc/init.d/debugcmds.inc ] && . /etc/init.d/debugcmds.inc
  and then put something like
     echo "debugcmds.inc : $0 $*"
     set -x
  into /etc/init.d/debugcmds.inc

  This script adds the line as second line in _every_ file in /etc/init.d:

     #!/bin/sh
     cd /etc/init.d || exit 1
     if   [ ! -d sav ]
     then mkdir sav || exit 1
          cp * sav
     fi
     for i in *; do
     ed $i <<EOF
     2i
     [ -r /etc/init.d/debugcmds.inc ] && . /etc/init.d/debugcmds.inc
     .
     w
     q
     EOF
     done

  When all is done:
     cp /etc/init.d/sav/* /etc/init.d
     rm -rf /etc/init.d/sav

- force a crash dump
  When the machine hangs, press STOP+A. Then, at the ok-Prompt
  type "sync". Then you need do boot somehow to analyze the crash
  dump. Should work, if you are able to boot into single user mode.

The original versions of edited scripts should be restored after
the problem is discovered, to prevent side effects, problems with
checksums and perhaps problems with later patching.


   (mk)

-- 
Matthias Kurz; Fuldastr. 3; D-28199 Bremen; VOICE +49 421 53 600 47
   >> Im prdmotorischen Cortex kann jeder ein Held sein. (bdw) <<
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
Received on Fri Apr 5 00:27:22 2002

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:42:39 EST