Gentoo Wiki


Have you ever needed to connect a dumb terminal (like a Wyse 50) to a Linux host? Do you need to login to a Linux server from a laptop to perform administrative functions, because there is no monitor or keyboard attached to the server? If you are accustomed to administering routers, switches, or firewalls in this manner, then you may be interested in doing the same with some of your GNU/Linux hosts.


Check your system's serial support

You may need to emerge sys-apps/setserial for this part.

First, let's make sure that your operating system recognizes serial ports in your hardware. You should make a visual inspection and make sure that you have one or more serial ports on your motherboard or add-in PCI card. Most motherboards have two built-in ports, which are called COM1: and COM2: in the DOS/Windows world. You may need to enable them in BIOS before the OS can recognize them. After your system boots, you can check for serial ports with the following commands:

# dmesg | grep tty
ttyS0 at 0x03f8 (irq = 4) is a 16550A
ttyS1 at 0x02f8 (irq = 3) is a 16550A

# setserial -g /dev/ttyS[01]
/dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4
/dev/ttyS1, UART: 16550A, Port: 0x02f8, IRQ: 3

As you can see, the two built-in serial ports are /dev/ttyS0 and /dev/ttyS1.

Configure your inittab to support serial console logins

The /etc/inittab file must be reconfigured to allow serial console logins. You will note that the mingetty daemon is used to listen for virtual consoles (like the 6 that run by default with your keyboard and monitor). You will need to configure agetty or mgetty to listen on the serial ports, because they are capable of responding to input on physical serial ports. In the past, I have used both full-featured gettys. In this document, I will only discuss agetty, since it is already included in the default Red Hat 9 installation. It handles console/dumb terminal connections as well as dial-in modem connections.

What is a getty?

A getty is is a program that opens a tty port, prompts for a login name, and runs the /bin/login command. It is normally invoked by init.

Before you edit /etc/inittab, which is a very important config file, you should make a backup copy:

# cp /etc/inittab /etc/

The required /etc/inittab additions are right below "# SERIAL CONSOLES":

File: /etc/inittab
# /etc/inittab:  This file describes how the INIT process should set up
#                the system in a certain run-level.
# Author:  Miquel van Smoorenburg, <>
# Modified by:  Patrick J. Volkerding, <>
# Modified by:  Daniel Robbins, <>
# Modified by:  Martin Schlemmer, <>
# $Header: /var/cvsroot/gentoo-x86/sys-apps/sysvinit/files/inittab,v 1.5 2005/12/22 02:03:23 vapier Exp $

# Default runlevel.

# System initialization, mount local filesystems, etc.
si::sysinit:/sbin/rc sysinit

# Further system initialization, brings up the boot runlevel.
rc::bootwait:/sbin/rc boot

l0:0:wait:/sbin/rc shutdown
l1:S1:wait:/sbin/rc single
l2:2:wait:/sbin/rc nonetwork
l3:3:wait:/sbin/rc default
l4:4:wait:/sbin/rc default
l5:5:wait:/sbin/rc default
l6:6:wait:/sbin/rc reboot

c1:12345:respawn:/sbin/agetty 38400 tty1 linux
c2:2345:respawn:/sbin/agetty 38400 tty2 linux
c3:2345:respawn:/sbin/agetty 38400 tty3 linux
c4:2345:respawn:/sbin/agetty 38400 tty4 linux
c5:2345:respawn:/sbin/agetty 38400 tty5 linux
c6:2345:respawn:/sbin/agetty 38400 tty6 linux

s0:2345:respawn:/sbin/agetty -L -f /etc/issueserial 9600 ttyS0 vt100
s1:2345:respawn:/sbin/agetty -L -f /etc/issueserial 38400 ttyS1 vt100
#s0:12345:respawn:/sbin/agetty 9600 ttyS0 vt100
#s1:12345:respawn:/sbin/agetty 9600 ttyS1 vt100

# What to do at the "Three Finger Salute".
ca:12345:ctrlaltdel:/sbin/shutdown -r now

# Used by /etc/init.d/xdm to control DM startup.
# Read the comments in /etc/init.d/xdm for more
# info. Do NOT remove, as this will start nothing
# extra at boot if /etc/init.d/xdm is not added
# to the "default" runlevel.

agetty options explained:

Possible serial line rates (sometimes called baud rates) for the 16550A UART:

I have tried all of these line rates. 9600 bps is generally O.K., and is a very common setting for networking hardware. 38,400 bps is the speed of the standard Linux console, so it is my second choice. If your dumb terminal or terminal emulator cannot handle 38,400 bps, then try 19,200 bps: it is reasonably speedy and you will not be annoyed.

Here was my custom issue file, /etc/issueserial. It uses escape sequences defined in the agetty manpage to add some useful information, such as the serial port number, line speed, and how many users are currently logged on:

Connected on \l at \b bps

Now, you must activate the changes that you made in /etc/inittab. This is done with the following command, which forces the init process to re-read the configuration file:

# init q

Now, let's make sure that the agetty process is listening on the serial ports:

$ ps -ef | grep agetty
root       958     1  0 Dec13 ttyS0    00:00:00 /sbin/agetty -L -f /etc/issueserial 9600 ttyS0 vt100
root      1427     1  0 Dec13 ttyS1    00:00:00 /sbin/agetty -L -f /etc/issueserial 38400 ttyS1 vt100

Test serial port login with an external dumb terminal or terminal emulator

Wyse 50b

I have tested this setup with a WYSE dumb terminal, a Linux laptop running Minicom, and Windows 2000/XP laptops running HyperTerminal. They all worked just fine.

Terminal settings: should be 9600, N, 8, 1. Terminal emulation should be set to VT100 or VT102. Turn flow control off. If you want to use the 38,400 bps serial port on ttyS1, then your settings should be adjusted to 38400, N, 8, 1.

Cable: To connect a laptop to the serial port on the Linux host, you need to have a null-modem cable. The purpose of a null-modem cable is to permit two RS-232 DTE devices to communicate with each other without modems between them. While you can construct this yourself, a good, sturdy manufactured null-modem cable is inexpensive and will last longer.

If you insist on making the cable yourself, then check out Nullmodem.Com for the wiring and pinout diagram.

Connectors: Motherboard serial ports are typically male DE-9 connectors, but some serial ports use DB-25 connectors. You may need some DE-9 to DB-25 converters or gender-changers in order to connect to your terminal. For a typical laptop to server connection, a DE-9 null-modem cable should be sufficient.

Here is what you should see on the dumb terminal or terminal emulator:

Connected on ttyS1 at 38400 bps
3 users login:  

Note: If you want to be able to login via serial console as the root user, you will need to edit the /etc/securetty config file. The entries to add are highlighted in red:


Modifying the agetty settings

If you want to change the baud rate or some other agetty setting, you will need to perform these 3 steps:

  1. Modify the /etc/inittab configuration file
  2. Activate the config change by forcing init to re-read the config file
  3. Restart the agetty daemons

Here is an example of steps 2 and 3:

# init q
# pkill agetty

Configure serial port as THE system console (Optional)

You can use options in /etc/grub.conf to redirect console output to one of your serial ports. This can be handy if you do not have a keyboard or monitor available for the Linux host in question. You can also see all of the bootup and shutdown messages from your terminal. In this example, we will make the /dev/ttyS1 port be the console. The text to add to the config file is highlighted in red:

title Red Hat Linux (2.4.20-24.9)
        root (hd0,0)
        kernel /vmlinuz-2.4.20-24.9 ro root=LABEL=/ console=ttyS1,38400
        initrd /initrd-2.4.20-24.9.img

Now, if you drop your system into single user mode with the "init 1" command, you will still be able to administer the system from your serial-connected terminal. No monitor or keyboard is required!

Warning!: The kudzu hardware detection program may "choke" on boot when the serial port becomes the console, instead of the video adapter. To remedy this situation, you should disable kudzu (assuming that your hardware is configured properly and won't be changing). This is how you would do that:

# rc-update del kudzu
# rc-update -v show | grep -i rsyncd
             rsyncd | 

You should also know how to break into the Grub bootloader during system startup and edit the kernel line. By deleting the console argument from the kernel line, you can boot the system with the standard console, which uses the video card and attached keyboard. You have been warned!


Now, you should be able to login from the serial ports on your GNU/Linux host. This could be useful for maintenance or for serving a whole room full of dumb terminals. In the future, I will investigate a PCI multiport serial card in the latter role.

Have fun!


Retrieved from ""

Last modified: Fri, 05 Sep 2008 23:24:00 +0000 Hits: 7,927