AlpineLinux 3.8: extlinux and Linux with serial console

This article will describe changing extlinux and Linux to serial console.

1 Enable serial console

  • Enable serial console and disable hidden menu in extlinux.
  • Append console=ttyS0,115200 to kernel parameter. Delete quiet from kernel parameter. Kernel log and syslog will be output to serial console.
  • Enable getty entry of ttyS0 in /etc/inittab.
  • Enable login from serial console.
#!/bin/sh -e


. /etc/update-extlinux.conf
O="${default_kernel_opts} console=ttyS0,115200"
sudo sed -i /etc/update-extlinux.conf \
    -e 's/^serial_port=/serial_port=0/g' \
    -e "s/^hidden=1/hidden=0/g" \
    -e "s;^default_kernel_opts=.*;default_kernel_opts=\"${O}\";g" \
    -e 's;^default_kernel_opts=\(.*\)quiet\(.*\);default_kernel_opts=\1\2;g'
sudo sed -i /etc/inittab \
     -e 's;^#ttyS0;ttyS0;g'
sudo update-extlinux
sudo reboot

2 Execution result

extlinux to monitor display is as below.

0001_extlinux-to-Display.png

extlinux to serial console is as below. This article used "sudo virsh console <vmname>" for connecting serial console.

0002_extlinux-to-SerialConsole.png

Login prompt to monitor display is as below. tty1 is displayed with press Ctrl + Alt + F1.

0003_Linux-to-Display.png

Login prompt to serial console is as below.

0004_Linux-to-SerialConsole.png