Distroname and release: Debian Squeeze

Serial Console

Ever experienced not to be able to connect with example SSH to a remote host, and there is no keyboard or monitor connected to this host!? If so, you might want to continue reading.

With Serial Console setup, it is possible to connect to the host using a workstation with a Com / Com Adapter.
We actually do not need to install anything here, which is very good. Just need a Com / Com Adapter, and we are ready to go.

Edit grub

Edit grubs conf file menu.lst, and add the following to the top of the file.
/boot/grub/menu.lst
serial --unit=0 --speed=9600
terminal --timeout=10 serial console
Next we will change the boot parameter, so that grub starts with the serial port listening.We will insert this line to console=tty0 console=ttyS0,9600 at the end of the kernel parameter!

Example
/etc/grub/menu.lst
title		Debian GNU/Linux, kernel 2.6.8-2-386 (VT)
root		(hd0,0)
kernel		/vmlinuz-2.6.8-2-386 root=/dev/hda3 ro console=tty0 console=ttys 0,9600
initrd		/initrd.img-2.6.8-2-386
savedefault
Now we are done setting up grub. Save the file and quit the editor.

Setting up inittab

We will have to setup inittab, to decide on which runlevels the new VirtualConsole should listen.
Uncomment or add the following line in /etc/inittab
/etc/inittab
T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
After saving the changes, reboot the computer. When booting the kernel with the console parameters it should come up with the following message.
This is actually the timeout, we have specified in the menu.lst file.
Press any key to contnue..... 
Press any key to contnue..... 
Press any key to contnue..... 
Press any key to contnue..... 
Press any key to contnue..... 
Press any key to contnue..... 
Press any key to contnue..... 
Press any key to contnue..... 
Press any key to contnue..... 
Press any key to contnue..... 
Just let it be, and it will continue to boot! If you press a button on the server, it will show the screen here. If you press a button on the client connected, it will show up on the client instead!
We have setup our inittab to load this everytime so we always can access it. If not we will have to interact so we get the ttys display to the serial port.

Connecting with clients

From a workstation, in example a laptop, you can now connect to this machine when the cable is plugged in. I usally uses GTKTerm, which is an GTK application.

Another very cool trick, is to use the screen application, together with ttyS0 like this.
$screen /dev/ttyS0 115200
This will open, the TTY on the our other machine.

If you are using GTKTerm, it is sometimes needed to press enter when the client is open, to get to the tty.
Copyright LinuxLasse.net 2009 - 2017 All Rights Reserved.

Valid HTML 4.01 Strict Valid CSS!