Machine freeze when X starts

Robert Watson rwatson at
Mon Nov 17 07:35:02 PST 2003

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:


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.


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      Network Associates Laboratories

More information about the freebsd-current mailing list