Today I had two (planned) power outages that I forgot about, and when I came home my home server would not boot up anymore. I could not ssh into it, and it is located in the server room without a display.
I wanted to connect the home server with a serial cable to my laptop and see what happened, but the serial console was not enabled :/
Enabling
Here is what I had to do to activate the serial console on Debian 9:
-
Edit /etc/default/grub and change the GRUB_CMDLINE_LINUX_DEFAULT line to:
GRUB_CMDLINE_LINUX_DEFAULT="console=ttyS0 console=tty0"
It enables the serial console in the linux kernel. Note that the default speed is 9600 baud.
- Run update-grub. /boot/grub/grub.cfg will contain the console kernel parameters now.
- Reboot. The serial console is activated.
Connect
Before rebooting, I connected my laptop via a USB-to-serial adapter and a serial cable to the home server. Then I started minicom:
$ minicom -D /dev/ttyUSB0
Once started, I changed the speed to 9600:
(Yes, I tried setting the speed with a cli parameter, but that did not work.)
Then I rebooted the home server and saw the kernel messages flowing into minicom. Then I could login as root and examine my system.
systemd also offers serial console support, but enabling it manually via
$ systemctl enable serial-getty@ttyS0.service
only led to the issue that I could not see system service startup messages anymore when a display is connected.
But it's also automatically enabled when the console kernel parameter is detected.. Strange.