On the server, we are going to set up:
A serial console on ttyS0
Have kernel booting messages output to the serial console
Make Grub outputs to the serial console
2.1. The serial console
To set up a serial console, We need to create a new file called /etc/event.d/ttyS0 in order to spawn a getty on the serial device. getty will take care of prompting the user for a username and password.
Go and edit '/etc/event.d/ttyS0' and add:
# ttyS0 - getty
This service maintains a getty on ttyS0 from the point the system is
started until it is shut down again.
start on runlevel 2
start on runlevel 3
start on runlevel 4
start on runlevel 5
stop on runlevel 0
stop on runlevel 1
stop on runlevel 6
respawn
exec /sbin/getty -L 115200 ttyS0 vt102
To authorize root (if you enabled root account on your machine) to log in through the serial console, you need to edit /etc/securetty and add:
ttyS0
2.2. Having grub outputting to ttyS0
grub can be configured to output on the serial console.Edit grub and add:
serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
terminal --timeout=10 serial console
```I
n the section before the different kernels. This will take care of having grub being displayed one the serial console so you can actually modify grub through the serial console or boot using another kernel.
If using ```ttyS1```, then change it to ```–unit=1```
Also, in order to get the booting messages outputted to the serial console, you can append to your kernel line the following:
console=ttyS0,115200n8 console=tty0
So, finally, the kernel line will look like:
kernel /boot/vmlinuz-2.6.24-16-generic root=UUID=uuuuuu-iii3-dddd-uuuu-iiiiiddddd ro quiet splash console=ttyS0,115200n8 console=tty0
That’s it, upon next reboot, you will be able to connect directly to your box using a serial console!.