Enable Serial Console Support

Reference:
Remote-Serial-Console-HOWTO

Hardware, BIOS, kernel

For serial support, you need to make sure that the serial port is enabled in the BIOS, and
compiled into the kernel
you also need to have a null modem serial cable (see www.tldp.org/HOWTO/Remote-Serial-Console-HOWTO/serial-pc-terminal.html for a pinout) attached between this machine and another that you can reach (and run minicom or kermit on so that you can access the serial port on that machine).

GRUB configuration

The following options in /boot/grub/menu.list
need to be added (or modified) to enable serial port console:

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

kernel /vmlinuz-2.4.20-raid-smb root=/dev/hda2 ro console=tty0 console=ttyS0,115200n8

Login configuration

The init system should keep a process running to monitor the serialójnsole for logins. This is done by modifying /etc/inittab so that it says the following:

T0:23:respawn:/sbin/getty -L ttyS0 115200 vt100

It is a good idea to allow root to login via the serial console, to enable this, add /dev/ttyS0 to /etc/securetty.

Remove saved console settings

The file /etc/ioctl.save contains the serial and terminal parameters to use in single user mode. The serial and terminal parameters are usually set by getty during single user mode no getty runs and the contents of /etc/ioctl.save are used to set the serial and terminal parameters. rm /etc/ioctl.save

This file will be recreated next time you can login via the serial console.

Remote terminal program setup

Configure minicom on the remote end so that it is set for 115200 baud, 8n1 and no flow control... Also change the hangup and modom initialization settings so tat there is no AT commands sent. If you are using kermit, then you are better off.

Final steps: test, create ioctl file

Test by connecting to the serial port via the second machine, and restart the original one, you should get the grub menu and it should boot completely. once it has, you need to recreate the /etc/ioctl.save file.

Log in as root from the serial console and send the console into single user mode. The modem may hang up whilst doing this and you may need to re-connect.

Without a /etc/ioctl.save containing the saved terminal settings, init assumes a directly attached terminal running at 9600bps with 8 data bits, no parity, 1 stop bit and no flow control. Configure your terminal with these settings.

remote ttyS0 login: root
Password:
sh# rm -f /etc/ioctl.save
bash# telinit 1
Telling INIT to go to single user mode.
INIT: Going single user
INIT: Sending processes the TERM signal

sh# stty sane -parenb cs8 crtscts brkint -istrip -ixoff -ixon

As you use stty to alter the Linux's terminal settings remember to also alter the settings of the attached terminal.

Exiting from single user mode back to the default run level will save the serial console termnial configuration into /etc/ioctl.save.

sh# exit

bash# ls -l /etc/ioctl.save
-rw------- 1 root root 60 Jan 1 00:00 /etc/ioctl.save

The terminal settings saved in /etc/ioctl.save will be used if the machine boots into single user mode for any reason.