Serial Port Console under Devuan Linux
This document covers serial port console access, whether it be a physical serial port, Serial Over Lan (SOL), or console access from a Xen DOM0 to a Xen DOMU.
The first part is to create an entry so the grub bootloader exports both the standard console (tty0) and the serial port to the console. This allows you to monitor the boot process, but ceases at the point in the boot process where the Linux init system takes over.
On Debian Linux, edit the file /etc/default/grub
and add the following three lines at the bottom:
GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,115200n8" GRUB_TERMINAL=console GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"
This tells grub (the Linux bootloader) to set up console access via ttys0 (that is also the unit= part on the third line) using 115200 baud, no parity, 8 bits, one stop bit.
After saving the file, issue the command
update-grub2
to reinitialize the grub code to perform this function. This will be active on the next reboot.
Once the init system takes over, we lose functionality. To add this to the running operating system, edit the file /etc/inittab
and add the following line at the bottom. Ensure there is no other line in the file containing ttyS0 in it (that is not commented) and make sure there is nothing named s0 (the first value is a label, which must be unique).
s0:2345:respawn:/sbin/getty -L 115200 ttyS0 vt102
This says that for every runlevel 2-5, open a getty session using 115200 baud on ttyS0, using vt102 protocol (very basic protocol).
Once you have saved the file, you can start it up immediately by running
init q
which immediately reloads the init system, rereading inittab. In this case, you do not need to reboot; you will immediately have console access.