OpenSUSE 13: GRUB2 and Linux with serial console

This article will describe changing GRUB2 and Linux to serial console. This is not for desktop environment but embedded system and virtual machine environment.

1 /etc/default/grub

Change /etc/default/grub as below.

  • Change GRUB terminal to console and ttyS0. This will provide one GRUB to a monitor display and serial console.
  • Remove hidden parameter for avoiding "no video mode activated" error. And change GRUB timeout from 8 seconds to 1 second.
  • Change linux kernel console to tty1 and ttyS0. This setting will be taken over to userland, and there will be two login prompt for tty1 and ttyS0.
> diff -uprN /etc/default/grub{.org,}
--- /etc/default/       2016-11-18 20:36:48.028609459 +0900
+++ /etc/default/grub   2016-11-18 20:40:57.438040576 +0900
@@ -6,23 +6,21 @@
 # /boot/grub2/grub.cfg.
-GRUB_CMDLINE_LINUX_DEFAULT=" resume=/dev/system/swap splash=silent quiet showopts"
+GRUB_CMDLINE_LINUX_DEFAULT=" resume=/dev/system/swap splash=silent showopts"
 # kernel command line options for failsafe mode
 GRUB_CMDLINE_LINUX_RECOVERY="showopts apm=off noresume edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 nomodeset x11failsafe"
+GRUB_CMDLINE_LINUX="console=tty1 console=ttyS0,115200"
 # 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_TERMINAL="console serial"
 # The resolution used on graphical terminal
 # note that you can use only modes which your graphic card supports via VBE
 # you can see them in real GRUB with the command `vbeinfo'
 # Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
 # Uncomment to disable generation of recovery mode menu entries

2 grub2-mkconfig

Update grub.cfg with grub2-mkconfig.

> sudo grub2-mkconfig -o /boot/grub2/grub.cfg

You can operate GRUB and Linux via serial console. You can also operate these via tty1.