Serial Console
Updated March 18, 2004
Created March 09, 2004


Autogenerated Site Map
Search this Site!:
Search this site powered by FreeFind


What is a serial console and how is it useful?

A serial console is a means of communicating with a computer system via the serial port. Sometimes this is serial port to serial port and sometimes it is via a modem. Usually a terminal emulator program is used to communicate via the serial console.

A serial console is useful in the following situations:
controlling a headless server (no video, keyboard, or mouse)
debugging a computer system when the local video and keyboard may be non-functional


Physical Connection

The standard connection is made with a "null modem" or "laplink" cable. This cable would normally go between the serial ports of 2 computer systems.


Serial Port Availability and Naming

In linux the serial ports are referenced via ttyS0 (for COM1) and ttyS1 (for COM2). You can check which ports were detected by running one or more of the following:

dmesg | grep ttyS
cat /var/log/messages | grep ttyS
stty -F /dev/ttyS0
stty -F /dev/ttyS1
stty -F /dev/ttyS2
stty -F /dev/ttyS3


Terminal Software Configuration

We will discuss usage information for minicom; however, any terminal program should work if configured correctly. Other terminal programs are miterm, hyperterminal, and more.

On your workstation start the terminal emulation program and configure the communications port to the correct settings:
9600 8 n 1 vt100/vt102.

Your workstation is now configured. The following configuration steps apply to the headless computer system.


Displaying kernel messages on one or more consoles

On each kernel line listed in /boot/grub/grub.conf and/or /etc/lilo.conf, append the correct "console" statement as a parameter to the kernel. The following is an example from grub.conf (my addition to the line appears in bold):

kernel /vmlinuz-2.4.20-18.8 ro root=LABEL=/ console=tty1 console=ttyS0,9600

The example above will display the init sequence on both consoles (vt1 and serial port). The last console listed will appear as the primary console to initscripts (i.e. you will get more messages on whichever console you list last).


Disable Serial Port Probing

Serial port probing can cause problems so disable it. In /etc/sysconfig/kudzu, change the "SAFE=no" to the following:

SAFE=yes


Provide a login prompt to the serial console

In /etc/inittab, below the 6 mingetty lines, add the following agetty line:

S0:12345:respawn:/sbin/agetty 9600 ttyS0 vt100


Allow root to login via the serial console

To the end of /etc/securetty add the following line:

ttyS0


Optionally boot to text mode rather than X11 mode

X11 mode uses extra CPU cycles. If the local X11 console (on the headless system) will not be used, then configure it to boot to text mode. Remember X11 can be started in the future as needed with "startx". Also remember that booting to text mode will not affect remote clients who might run graphical applications from this server which display on their local workstations.

In /etc/inittab, find the line that says id:5:initdefault: and change it to:

id:3:initdefault:


Enabling Grub Serial Console Support

To control grub via the serial console then make the following changes:

In the global section of /boot/grub/grub.conf enter the following:

serial --unit=0 --speed=9600
terminal --timeout=2 serial console


Optionally enable sysrq support

If serial console is being configured for use with sysrq, then enable sysrq support by performing one of the following tasks:

1. To enable sysrq support each time the system boots then make the following change in /etc/sysctl.conf (change shown in bold):

# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 1

2. To enable sysrq support now (without a reboot) then run the following command. Note that this change is not persistant across a reboot:

echo 1 >/proc/sys/kernel/sysrq


Completing and Testing the Headless Server Configuration

Because of the particular parameters that were modified, the headless server will need to be rebooted in order for those parameters to take affect. Be sure to watch via the terminal emulator to verify that each portion is working via the serial port.

The portions to watch for are the grub menu (optional), kernel boot messages, initscript boot messages, and finally the login prompt. Test the login prompt via the terminal emulator to verify that root can login.


Minicom usage info

* Skip modem init:
minicom -o
* Exit without modem reset:
CTRL-a q
* Start minicom with logging turned on (and no modem init):
minicom -o -C mylogfile
* Start/Stop logging from within minicom:
CTRL-a l
* Sysrq via minicom / Sysrq via serial port (CTRL-a f sends a BREAK in minicom, there may be a 5 second timeout)
CTRL-a f SysrqKeyStroke


References

For further configuration information please refer to:

http://www.tldp.org/HOWTO/Remote-Serial-Console-HOWTO/


Search this Site!:
Search this site powered by FreeFind

Homepage: http://www.cpqlinux.com
Site Map: http://www.cpqlinux.com/sitemap.html