Serial console output can be generated for grub messsages, for the kernel boot process, and the access to the system. Different configuration changes need to be done in order to do that.

Grub boot messages

If you want to see boot messages through the console, you need to pass additional arguments to the kernel through kernel arguments. This can be done via the grub config. Simply add the following to your default arguments:

GRUB_TERMINAL=serial
GRUB_SERIAL_COMMAND="serial --speed=38400 --unit=0 --word=8 --parity=no --stop=1"

into your grub config (e.g. /etc/conf.d/grub on gentoo or /etc/default/grub on Debian)

Then regenerate your grub.cfg by running your update grub:

 grub-mkconfig -o /boot/grub/grub.cfg

or

update-grub

or

update-grub2

depending on the distro.

Kernel Boot Messages

If you want to see boot messages through the console, you need to pass additional arguments to the kernel through kernel arguments. This can be done via the grub config. Simply add the following to your default arguments:

  GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,38400n8"

System

Without systemd

For systems without systemd, you simply edit the /etc/inittab by adding a new getty process to the serial terminal:

s0:12345:respawn:/sbin/agetty -L 115200 ttyS0 vt100

If the file /etc/securetty exists, then add the following to the end of it

S0

This allows root to login through the serial console.

With systemd

While old Linux systems were configured using /etc/inittab most new systems now use systemd as their init system. Systemd does not use the old inittab, but uses systemctl to start a getty process on a the serial port. In order to start a getty only ones, you need to run

systemctl start serial-getty@ttyS0.service

In order to run it at boot time, you need enable by running:

systemctl enable serial-getty@ttyS0.service