1. Add the file:
cat > /etc/default/grub.d/99console.cfg << EOF
GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT console=tty0 console=ttyS0,38400n8"
GRUB_TERMINAL=serial
GRUB_SERIAL_COMMAND="serial --speed=38400 --unit=0 --word=8 --parity=no --stop=1"
EOF
  1. Update grub:
sudo update-grub

References

  1. Configure console access on the target machine