Re: Machine freeze when X starts

From: Robert Watson <rwatson_at_freebsd.org>
Date: Mon, 17 Nov 2003 15:35:02 -0000
On Mon, 17 Nov 2003, Jens Rehsack wrote:

> > Hmm.  This failure mode is fairly common when a resource deadlock or lock
> > deadlock occurs in some kernel subsystems.  Any chance you can get a
> > serial console on the box so you can drop to DDB and generate some ps and
> > stacktrace output?
> 
> It seems to me a little bit more complicated to setup the serial
> console, so: yes, I can do it, but not today. Or - if you have a small
> "quick get DDB to serial console without many trouble", I can give it a
> quick start. I'll try to do this week. 

Hook up a null modem cable to the first serial port on your machine, and
to a serial port on another machine.  On the other machine, use tip to
attach to the com port, or some other com program of your choice.  Speed
should be 9600.

On the box to be debugged, add the following to /boot/loader.conf:

    console="comconsole"

Many people also like to edit /etc/ttys and make the ttyd0 line have an
"on" instead of an "off" so you can log in on the serial console.

Make sure "options DDB" is compiled into your kernel.  Add
"options BREAK_TO_DEBUGGER": this will allow a serial or console break to
drop you into DDB on demand.

Reboot.

Now your system is using a serial console, and you should see loader and
kernel output on the remote machine.  When the system panics, the DDB
output should now show up on the serial port.  You can force the system
into the debugger by pressing Ctrl-Alt-Escape on the actual console, or by
by sending a serial break using tip (~#).  Type "cont" to continue. 

The Developer's Handbook on the FreeBSD web page has a fairly extensive
section on kernel debugging, using core dumps, etc.  For our purposes,
seeing if your system panics, and what if any console messages are
generated is a good start.  If there's no panic and no interesting output,
try dropping to DDB, then using the "ps" command to list processes.  There
are some other interesting commands like "show lockedvnods" to show all
outstanding vnode locks, "trace [pid]" to stack trace a process, "show
locks [pid]" to show locks held by a process, etc.

Robert N M Watson             FreeBSD Core Team, TrustedBSD Projects
robert_at_fledge.watson.org      Network Associates Laboratories
Received on Mon Nov 17 2003 - 06:35:02 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:40 UTC