/etc/default/grub
:
## remove (optional):
# GRUB_TIMEOUT_STYLE=hidden
## change:
# (optional)
# GRUB_TIMEOUT=0
GRUB_TIMEOUT=2
## add:
GRUB_TERMINAL="console serial"
GRUB_SERIAL_COMMAND="serial --speed=115200"
## change:
# GRUB_CMDLINE_LINUX=""
GRUB_CMDLINE_LINUX="console=tty1 console=ttyS0,115200"
With GRUB_TERMINAL="console serial"
, GRUB menu appears in both VGA console and serial terminal.
If you can’t see the serial output, consult the manual and adjust GRUB_SERIAL_COMMAND="serial --speed=115200"
to your hardware.
Finally, GRUB_CMDLINE_LINUX="console=tty1 console=ttyS0,115200"
is Linux kernel’s command-line parameter. Like GRUB_TERMINAL="console serial"
, this enables tty in/out on both VGA console (tty1) and serial console (ttyS0).
After editing /etc/default/grub
, execute sudo update-grub
. This will execute grub-mkconfig -o /boot/grub/grub.cfg
internally and modifies /boot/grub/grub.cfg
, which is actually loaded on the boot.
After reboot, we can see dmesg and login prompt on the serial console!