Enable Serial Console on CentOS/RHEL 7

Edit “/etc/sysconfig/grub”
Add to end of GRUB_CMD_LINELINUX, “console=ttyS0” Replace ttyS0 with your serial port.
Mine looks like this:

GRUB_TIMEOUT=5
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/root rd.lvm.lv=centos/swap crashkernel=auto rhgb quiet console=ttyS0"
GRUB_DISABLE_RECOVERY="true"

Run the following commands as root: Again replace ttyS0 with your serial port

stty -F /dev/ttyS0 speed 9600
grub2-mkconfig -o /boot/grub2/grub.cfg
systemctl start getty@ttyS0

 

4 thoughts on “Enable Serial Console on CentOS/RHEL 7”

  1. Speed just prints the speed parameter. If you want to set it to something different, use ispeed:

    stty -F /dev/ttyS1 ispeed 115200

  2. Regarding the note “Replace ttyS0 with your serial port” — you may be wondering which serial port to use. Look in the BIOS settings to see which COM port is configured for remote access. COM1 corresponds to ttyS0, COM2 to ttyS1, and COM3 to ttyS2. I have seen different generations of Supermicro servers with different default COM ports. If you see serial output from the BIOS screens while the server is booting, but output stops as soon as Linux starts to boot, you probably have the wrong TTY in the kernel command line.

Leave a Reply

Your email address will not be published. Required fields are marked *