Configuring A Solaris Serial Console
2010-05-13

I do a lot of Solaris and OpenSolaris driver development on x86 systems and there is nothing I hate more than debugging on a physically attached keyboard and monitor. A simple solution is to attach a KVM over IP dohickey but another (free) solution is to configure Solaris to use a serial console. This, of course, requires the Solaris box to be within "serial cable reach" length of the system you will be debugging from. Don't forget hooking up a console server to the serial port is pro...

Configuring the serial console on Solaris can be a pain in the ass but is really simple once you know what to do. First and foremost, if you want to use speeds greater than 9600 you have to modify the /etc/ttydefs file. Change the console line from 9600 to something tolerable like 115200. For example:

console:115200 hupcl opost onlcr:115200::console

Next you need to tell Grub to boot the kernel with your serial console settings. Passing parameters to the kernel is done via the -B option. The parameters that must be set for serial configuration are (assuming ttya):

console=ttya
ttya-mode="115200,8,n,1,-"

The resulting kernel line will similar to:

kernel /platform/i86pc/multiboot -B console=ttya,ttya-mode="115200,8,n,1,-" -k

Note: Also add -k to the end of the kernel boot line which tells Solaris to drop into kmdb on the console when a panic occurs. This is required for any kind of kernel development and/or debugging.

Now reboot and select the kernel you modified in the Grub boot menu and your console will be directed out the serial port. You'll notice that Grub is still presenting itself on the VGA console. Luckily we can configure Grub to use the serial port as well!

Edit /boot/grub/menu.lst and add the following two lines near the top:

serial --unit=0 --speed=115200
terminal --timeout=20 serial

Finally, AND THIS IS VERY IMPORTANT, make sure you comment out the splashimage line specified by Grub.

That's it! Now reboot and you'll now see the Grub menu over the serial line.

Note for SPARC systems learn how to use the embedded ILOM for accessing the console. You'll be able to access the terminal directly via ssh.