Serial and display console

Configuration examples on the internets for configuring GRUB to boot serial console tend to turn off the regular console, for GRUB and for Linux. Here’s how you get serial console and regular keyboard/monitor console for both GRUB and Linux:

# Tell GRUB to use both consoles

echo '#! /bin/sh
echo "
serial --unit=0 --speed=115200 --word=8 --parity=no --stop=0
terminal_input --append serial
terminal_output --append serial
"' > /etc/grub.d/01_serial 
chmod 755 /etc/grub.d/01_serial 

# Tell GRUB to have the kernel use both consoles

grep console=tty /etc/default/grub ||
         echo >> /etc/default/grub 'GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200n8"'

# Make new GRUB config with those settings

grub2-mkconfig > /etc/grub2.cfg  # CentOS
update-grub2

# /dev/ttyS0 serial login – on older systems

systemctl enable serial-getty@ttyS0.service
systemctl start serial-getty@ttyS0.service
This entry was posted in Stuff and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *