Last Updated: March/07/2002
Errors/Comments: rajeev@rajeevnet.com

Setup Serial Console with 'GRUB' bootloader:

====================================================================
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You do not have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /, eg.
#          root (hd0,2)
#          kernel /boot/vmlinuz-version ro root=/dev/sda3
#          initrd /boot/initrd-version.img
#boot=/dev/sda
#
#default image is First(0) image from title list
default=0
#
#This is grub Menu timeout(sec)
timeout=30
#
###############################################
## Serial/Console setup
###############################################
# Avoid splashing any GUI!!
# splashimage=(hd0,2)/boot/grub/splash.xpm.gz
#
# Setup serial (COM1) here with baudrate 9600
# use --unit=1 (for COM2) and so on
serial --unit=0 --speed=9600
#
# Now setup terminal as both Serial Line(/dev/ttyS0) and
# Monitor Console(/dev/tty0) depending upon where you press key
# with in timeout (15 sec) period. Otherwise first entry
# (console(Monitor)=>tty0) is selected here.
terminal --timeout=15  console serial


# In images section below, we are selecting two consoles
# (Serial(ttyS0) and Monitor(tty0) here. But in case of single user mode,
# keyboard entry is allowed from last selected console in 'kernel' line below.
# So we need to setup two different images so that we should be able to
# login in single usermode from any console depending upon selection at boot time.
# But in both cases  kernel message (not OS message) will go to both consoles.
#
#Allow Single user mode from Console(Monitor)
title Red Hat Linux (2.4.17) !!! MONITOR !!!
        root (hd0,2)
        kernel /boot/vmlinuz-2.4.17 ro root=/dev/sda3 console=ttyS0 console=tty0

#Allow Single user mode from Serial Port(ttyS0).
title Red Hat Linux (2.4.17) !!! SERIAL CONSOLE !!!
        root (hd0,2)
        kernel /boot/vmlinuz-2.4.17 ro root=/dev/sda3 console=tty0 console=ttyS0

#Booting Windows through Grub.
title Win2000 Professional
     root        (hd0,1)
     makeactive
     chainloader +1
     # For loading DOS if Windows NT is installed
     # chainload /bootsect.dos

============================================================


            serial --unit=0 --speed=9600
This will only define serial port definition but won't do anything useful yet. Above is defining Serial port as (COM1), for COM2 specify --unit=1 and so on. After this define terminal for throwing display.
            terminal --timeout=15  console serial
 Here we are defining 15 seconds timeout and both console(Monitor or tty0) and serial port (ttyS0 or COM1) as display. For 15 seconds it will allow  to select either Monitor or Serial port selection depending upon where you press key. Otherwise after 15 seconds it will select first entry ('console' ) in above example as primary display device and show grub menu of OS selection there.



            kernel /boot/vmlinuz-2.4.17 ro root=/dev/sda3 console=ttyS0 console=tty0


 :Single user mode for Monitor
        kernel /boot/vmlinuz-2.4.17 ro root=/dev/sda3 console=ttyS0 console=tty0
                                                                     ^^^^^^^^^^
                                                                     Last Entry

 :Single user mode for Serial Port
            kernel /boot/vmlinuz-2.4.17 ro root=/dev/sda3 console=tty0 console=ttyS0
                                                                    ^^^^^^^^^^^
                                                                     Last Entry

In order to login as single user mode, at Grub boot selection menu, select kernel image by arrow (UP, DOWN keys) and then hit 'e' key to edit, which will show grub entry for image, select kernel line and append  word 'single'  and <Enter>,

kernel /boot/vmlinuz-2.4.17 ro root=/dev/sda3 console=tty0 console=ttyS0 single

 press 'b' to boot this image now. This edit is only temporary and won't overwrite /etc/grub.conf. By this way you can always edit grub entries for boot time temporarily.




  Add following line in your /etc/inittab
        # Add a tty to the serial console
        S0:2345:respawn:/sbin/mgetty -b -r -s 9600 -p "Serial Console Login: " ttyS0


   This will  run mgetty in as direct line (-r) (i.e no modem chat initiated), in block mode (-b), with speed as 9600 baud (-s 9600), login prompt as specified by -p option and device is ttyS0 (Serial port device /dev/ttyS0). Either reboot machine or type 'init q' to reread inittab file and that should start login process  on Serial console.