I had a classic problem, old server without a remote KVM capabilities – if it goes down, no other chances to debug it than going next to it, plug in a monitor and a keyboard.
Then, one day, an epiphany. There is a “Console redirection” in BIOS, and after a quick enable & check – it really worked. BIOS was accessible over serial connection.
Next step, /etc/default/grub (under Debian) open and
GRUB_CMDLINE_LINUX="console=ttyS0 console=tty0" will enable Linux console through serial. Switching from
GRUB_TERMINAL="console serial" enables Grub to work with serial.
update-grub made the changes active, and during reboot it was confirmed that the whole boot from bios screen to linux login console was accessible through serial connection.
So what about Raspberry Pi?
By default Pi has a serial console active, which can be accessed through GPIO pins 8 & 10 (Pi B+). This needs to be disabled to make console port usable for userspace, by removing
console=ttyAMA0 from /boot/cmdline.txt (or by disabling a correct service). After spending less than 1€ on Ebay (to get “MAX3232 RS232 Serial Port To TTL Converter Module DB9 Connector With Cable”) I had the required hardware to connect them together.
– Fits in 1U? *** Yes
– Pretty setup? *** No
– Works? *** Yes
Setup through the COM2 header found in the corner of the motherboard would have been nicer, but it just refused to work.
There’s also cables from the Pi into the reset button -pins on the motherboard, because I needed a way to make a hard reset. Power On/Off could also be managed through power button-pins, but for me it’s quite useless because the Pi is powered by the server through USB (and the server is always on).
Now I can access the Pi through SSH-session and use it to access console on the main server, if I ever need to do so.
GPIO connections (Pi B+ -> other end):
Pin 2 -> RS232 converter: VCC
Pin 6 -> RS232 converter: GND
Pin 8 -> RS232 converter: TXD
Pin 10 -> RS232 converter: RXD
Pin 14 -> Motherboard: Reset GND
Pin 16 -> Motherboard: Reset +
Reset-software (python-rpi.gpio required, don’t blame me if it destroys everything):
import RPi.GPIO as GPIO
# We're currently sinking the current through Pi.
# This causes a "push event" on a reset button.