fir3net
PPS-Firenetbanner-780.5x190-30-03-17

Enabling a serial connection when booting a Redhat Server into Single User mode.

Please note : This article is based on RHEL5 and grub.

Below shows the 2 methods you can use to ensure serial connectivity when booting into single user mode.
You may find without changing this setting your connection is lost just after Redhat starts booting.This configuration change can be via the grub.conf or via the kernel line via the grub menu at boot.

Via the grub.conf

Edit the grub.conf file so that the console setting is equal to ttyS0. (Lines have been omitted with !)

root@localhost:~$ vi /boot/grub/grub.conf
!
serial --unit=0 --speed=9600
terminal --timeout=5 serial console
!
!
timeout=5
title Red Hat Enterprise Linux Server (2.6.18-92.el5PAE)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-92.el5PAE ro root=/dev/vg0/root console=ttyS0 
        initrd /initrd-2.6.18-92.el5PAE.img
title Red Hat Enterprise Linux Server-base (2.6.18-92.el5)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-92.el5 ro root=/dev/vg0/root console=ttyS0
        initrd /initrd-2.6.18-92.el5.img


Via the Grub Menu

When booting a server into single user mode the serial console which is normally supplied via the mingetty

  1. From the GRUB menu
  2. Press "p"
  3. Enter the password if there is one.
  4. Select the necessary kernel
  5. Type "e"
  6. Select the Kernel line (which begins with Kernel)
  7. Type "e"
  8. Ensure that the line includes "console=ttyS0" if not make the required changes
  9. Press Return
  10. Type "b"

Additional Notes

The tty settings equate to :

  • /dev/tty0     - current virtual console
  • /dev/tty1     - first      virtual console
  • /dev/tty63   -  63rd    virtual console
  • /dev/ttyS0   -  first     serial  port
  • /dev/ttyS63 -  64th    serial  port

If using LILO you will need to change settings in /etc/lilo.conf.
This document doesn't include the steps to get into single mode. Which are :

  1. Run the command `init 1` from the shell when in run level 3.
  2. Edit the inittab.conf file to so the necessary line reads "id:1:initdefault:" and reboot.

About the Author

RDonato

R Donato

Rick Donato is the Founder and Chief Editor of Fir3net.com. He currently works as a Principal Network Security Engineer and has a keen interest in automation and the cloud.

You can find Rick on Twitter @f3lix001