Note
If you do not have a serial port and want to catch kernel output, check out netconsole.

How to use the serial console in Linux

Find your serial ports.

dmesg | grep tty

Find out about them.

setserial -g /dev/ttyS[01]

This may require getting setserial.

emerge setserial

First, decide on serial parameters so you’re 100% consistent everywhere. 9600 Baud is a good speed for the ultimate compatibility, but it sometimes is too slow for fast refreshing console output. I use: 38400, 8, n, 1

BIOS

If the BIOS supports serial redirect, that’s worth trying, but many BIOS implementations do a sketchy job (ahem Dell) so it’s best to at least turn that off after the bootloader and let Linux do it right.

GRUB

Here’s a working grub.conf that does serial output.

default 0
timeout 7

serial --unit=0 --speed=38400 --word=8 --parity=no --stop=1
terminal --timeout=10 serial console

#splashimage=(hd0,0)/boot/grub/splash.xpm.gz

title Gentoo Linux 2.6.24-r5
root (hd0,0)
kernel /boot/vmlinuz-2.6.33xed100305 root=/dev/md2 console=tty0 console=ttyS0,38400n8

Note that there are two timeouts, one for console and one for serial. Grub polls every second waiting for you to Press a Key to Continue thereby choosing where the output is sent. I guess you can have more time on one than the other, and I think it fails over to the other one after the first timeout. I’m not certain of that.

Next notice that there needs to be explicit serial settings in the grub configuration. The terminal command has both "serial" and "console" since generally you want the option to use either.

KERNEL

And finally you want the kernel to be passed an option to redirect to serial. There are two "console=" parameters which, like with GRUB, provide functionality to both output streams.

The kernel needs to have

SERIAL_CORE_CONSOLE
CONFIG_SERIAL_8250_CONSOLE
Device Drivers -> Character devices -> Serial drivers
   -> 8250/16550 and compatible serial support
       -> Console on 8250/16550 and compatible serial port

Then add the console parameters to your grub.conf file:

kernel /boot/vmlinuz root=/dev/md2 console=tty0 console=ttyS0,38400n8

Fancy console option parameters look like:

"console=uart8250,io,0x3f8,9600n8"
"console=uart8250,mmio,0xff5e0000,115200n8".

This actually just redirects the kernel messages on start up and shut down and other random times. That’s quite handy for troubleshooting of course which is usually why one would have serial out put at all. However to have actual interactive sessions you need to change the behavior of agetty.

agetty

You need to have inittab run agetty on a serial console. Do this by editing /etc/inittab to include something like:

s0:12345:respawn:/sbin/agetty 38400 ttyS0 vt100

If you can log in through the normal keyboard and monitor as root, but you can’t log in as root with the serial connection, you might need to add the serial device to your list of permissible root login sources which is found in /etc/securetty. Try:

$ echo ttyS0 >> /etc/securetty

Minicom

Use lsusb to find your USB to serial converter. Mine is a "Trendnet TU-S9" and works well in Linux. Here’s its lsusb profile: Bus 003 Device 004: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port In your kernel configuration, you need to enable:

Device Drivers -> USB support -> USB Serial Converter support
    -> USB Prolific 2303 Single Port Serial Driver

Set up your minicom for 38400 8N1 with no flow control and enjoy.