Linux: Configure / Enable Serial Console By Editing GRUB Boot Loader

How do I configure and enable console redirection in the BIOS? I want see my remote dedicate server boot information and any diagnostic information that is normally printed to the screen. I’ve already enabled serial ports in my server BIOS and wired them up. Now how do I configure and access Linux over a serial console?

The serial console is helpful in troubleshooting difficult problems. This is useful if you are remotely administrate the Linux server even if the network has failed or crashed. In order to use serial console you need to configure GRUB boot loader and make changes to /etc/inittab file. Following instructions are tested on :
Tutorial details
Difficulty Intermediate (rss)
Root privileges Yes
Requirements None
Time N/A
[1] Cent OS version 4/5 [2] Redhat Enterprise Linux (RHEL) version 3/4/5 [3] Debian version 3/4/5/6

Step # 1: Serial redirection in the GRUB

Open the grub configuration file /boot/grub/menu.lst (Debian / Ubuntu Linux) or /boot/grub/grub.conf (Redhat/CentOS/Fedora Core Linux), enter:
# vi /boot/grub/grub.conf
Append the following lines below “hiddenmenu” option:

serial --unit=1 --speed=19200
terminal --timeout=8 console serial
  • The first line tells GRUB to use the first serial port at a baud rate of 19200
  • The second line gives the user 9 seconds to decide where GRUB should output it’s information.
  • Please adjust port number and speed as per your setup.

Next make sure splashimage options is disabled as graphics can’t be displayed across the serial port. Remove splashimage line or just comment it out by prefixing # symbol:

Step # 2: Enabling serial output from the Linux kernel

Find the kernel line (grub config file) which corresponds to your currently running kernel. Add the following at the end of that line – console=tty0 console=ttyS0,9600n8:

title Red Hat Enterprise Linux ES (2.6.9-42.0.10.ELsmp)
        root (hd0,0)
        kernel /vmlinuz-2.6.9-42.0.10.ELsmp ro root=LABEL=/ console=tty0 console=ttyS1,19200n8
        initrd /initrd-2.6.9-42.0.10.ELsmp.img

Save and close the file. When multiple console= options are listed, the Linux kernel will output (tty0, ttyS1) to both when possible. Now the kernel errors get logged with on both the normal VGA console and on the serial console.

Step #3: Logging in via the serial console

Finally open the /etc/inittab file, enter:
# vi /etc/inittab
Append the following line:
1:23:respawn:/sbin/agetty -h -L ttyS1 19200 vt100
Save and close the file. The above line allows you to login via the serial device. You are attaching agetty process to serial consol. Your Linux distribution may have the above line.

Step # 4: Test your setup

Next, reboot the server. Make sure you connect to the serial console using IPMI Java client or IPMIView Linux client. Finally, you should see the following message on screen:
Press any key to continue.
Now hit any key to launch GRUB on the serial console. Please note that if you do nothing, it will open server’s VGA console.

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 8 comments so far... add one

CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
8 comments… add one
  • John Doe Jul 6, 2011 @ 19:32

    I started banging my head on the wall when I got to “now reboot your server”. Contradiction in terms.

  • Stefan Lasiewski Jan 12, 2012 @ 23:49
    Append the following line:
    1:23:respawn:/sbin/agetty -h -L ttyS1 19200 vt100

    The first column ‘1’ may cause problems on most RHEL5 installations. In my case, this cause the error ‘INIT: /etc/inittab[69]: duplicate ID field “1”‘ upon boot.

    This is because the first column is a unique identifier, and is commonly used to identify tty1:

    # Run gettys in standard runlevels
    1:2345:respawn:/sbin/mingetty tty1
    2:2345:respawn:/sbin/mingetty tty2
    3:2345:respawn:/sbin/mingetty tty3
    4:2345:respawn:/sbin/mingetty tty4
    5:2345:respawn:/sbin/mingetty tty5
    6:2345:respawn:/sbin/mingetty tty6

    A better name would be something like S0:

    S0:2345:respawn:/sbin/agetty -h -L ttyS0 9600 vt100
    • Paul M Apr 30, 2015 @ 12:24

      it’s important to distinguish between centos5/rhel5 and c6/c7/r6/r7 as serial console is much easier in the latter as it doesn’t need you to do anything other than touch the kernel command line opts in grub config

  • Chris Quinn Feb 21, 2012 @ 18:19

    This is awesome! Thank you very much this is what I was looking for. I got IPMI working on my Supermicro server!

  • Jorge Medina Nov 25, 2012 @ 18:33

    Why people use console=tty0 in grub, afaik that tty/file doesn’t exist by default in any linux distribution, I realized that when people set tty0 in grub the system boots but without a valid tty and without login, you have to type alt+f1 to get a valid tty.

    To fix it you have to set grub to a valid tty/console, like this:

    GRUB_CMDLINE_LINUX=”console=tty1 console=ttyS0,115200n8″

    Best regards.

  • foolar Jun 4, 2013 @ 9:09

    why console just start on runleves 2,3? what about single user mode, for server recovery?

  • Aleksandar Kostadinov Jan 13, 2015 @ 8:42

    FYI, if you’re looking for same info on distros with SystemD, then look at here []

  • asterinux Jul 28, 2015 @ 9:51

    im using this guide on both CentOS 6 and Ubuntu 14.10, i was able to configure correctly on CentOS however theres a problem in Ubuntu, i notice that the console only display during boot, after the VM is fully up, the console freezes. Here is the config i used:


    GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
    GRUB_CMDLINE_LINUX=”console=tty0 console=ttyS0,9600n8″

    # Uncomment to enable BadRAM filtering, modify to suit your needs
    # This works with Linux (no patch required) and with any kernel that obtains
    # the memory map information from GRUB (GNU Mach, kernel of FreeBSD …)

    # Uncomment to disable graphical terminal (grub-pc only)
    GRUB_SERIAL_COMMAND=”serial –unit=1 –speed=19200 terminal –timeout=8 console serial”

    And then i create
    start on stopped rc RUNLEVEL=[12345]
    stop on runlevel [!12345]

    exec /sbin/getty -L 115200 ttyS1 vt102

    Any idea?


Leave a Reply

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

Use HTML <pre>...</pre> for code samples. Problem posting comment? Email me @