Debian Headless ServerTo create a server which uses a serial port terminal for system console. This allows for the removal of X servers and all graphical user interfaces. Except for bios updates and hardware trouble shooting, dedicated monitors and keyboards are not required for normal functioning of the server.
The changes below will result in grub and system startup/shutdown messages to be output to the serial console. The serial console output must be connected to another computer/laptop/dumb terminal or with further modification connected to a modem for dial in service (to be describe later). The modem combination allows for isolation of the server from the Internet for standalone application such as a PBX connected only to PSTN and analog phones but still be able to be deployed remotely and managed remotely with maximum access.
Always make proper backup before proceeding.
Please report problems and direct all inquiries to Contact US.
Make sure we have a serial port.
# dmesg | grep tty [ 0.821570] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A [ 0.821677] serial8250: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A [ 0.822003] 00:05: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A [ 0.822151] 00:06: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
To define getty process with serial port. Modify /etc/inittab with your favourite editor but make a backup first. Find the section that deals with the getty processes and modify id=1.
To add a getty to a serial line (for a terminal), add the following line to inittab.
You can select other baud rate in your configurations. To make the setting take effect immediately, run as root:
#init q
To redirect output in grub and kernel load during boot up, edit menu.lst residing in /boot/grub but make a backup first. You will need root access. Add the following before automagic kernel list.
Modify the defoptions with the following (quiet is optional). Note statements beginning with '##' are comments, '#' are snippets of statements added to the kernel statements generated automatically every time a new kernel is deployed and grub-update is ran. Resulting in a updated menu.lst is and the defoptions will be included in the automagically created kernel statements.
Do the same for altoptions.
Exit the editor Run update-grub as root and check to make sure the options are added to the automagic kernel lines correctly.
#update-grub
Connect a serial terminal to the serial port with the null modem cable. When you reboot, you will see messages redirected from the monitor to the serial port. Login as root and run the following command.
# dmesg | grep tty [ 0.000000] Command line: root=/dev/mapper/server.domain.org-root ro console=ttyS0,19200n8 quiet [ 0.000000] Kernel command line: root=/dev/mapper/server.domain.org-root ro console=ttyS0,19200n8 quiet [ 0.004000] console [ttyS0] enabled [ 0.821570] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A [ 0.821677] serial8250: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A [ 0.822003] 00:05: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A [ 0.822151] 00:06: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
This will even work with LVM encrypted volumes, you will be prompted for passphrase shortly after the grub load.