Configuring serial console

Introduction

This page describes how to configure a serial console.

Procedure

  1. Run:
    systemctl enable serial-getty@ttyS0.service
    systemctl start serial-getty@ttyS0.service
    
  2. Install minicom.
  3. Edit /etc/default/grub and add/modify the following settings:
    GRUB_TERMINAL="console serial"
    GRUB_CMDLINE_LINUX_DEFAULT="... console=tty1 console=ttyS0"
    GRUB_TERMINAL_INPUT="console serial"
    GRUB_TERMINAL_OUTPUT="console serial"
    GRUB_BACKGROUND=
    GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"

    (Yes, GRUB_TERMINAL, GRUB_TERMINAL_INPUT and GRUB_TERMINAL_OUTPUT must all be set.)

  4. Run:
    update-grub
    reboot
  5. Note that while kernel messages will go to both consoles, systemd’s ‘OK’ messages will go only to the second console (be that non-serial or serial). For details see here, here and here.

See also