Running Linux Without A Monitor 

http://www.chinalinuxpub.com/doc/www.siliconvalleyccie.com/linux-hn/network-osi.htm#_Toc42860940

You can reduce the cost of ownership of your Linux system by not using a VGA monitor. This creates what is also known as a "headless" system. Operating costs may not be important at home, but will be in a corporate environment with large numbers of Linux servers racked in data centers. In such cases, access to the Linux box can be more cheaply provided via the COM port.

I've included this section as I have occasionally hosted the website www.linuxhomenetworking.com at friends' homes and felt badly about borrowing their monitors. Having access via the COM ports has also helped me in both the home and business situations. The most common occurrence is when the system is hung, locking out network access, and I need to get to it by using:

Preparing To Go "Headless" 

  • One of the advantages of this method is that you don't need a keyboard either. Unfortunately your BIOS may halt the system during the Power On Self Test (POST) if it doesn't detect a keyboard. Make sure you disable this feature in the BIOS setup of your PC before proceeding. This feature can usually be found on the very first screen under the "Halt On" option.
  • You will also need to make sure that you have activated your COM ports in your BIOS settings.
  • For non-modem connectivity (PC to PC) connect a NULL modem cable to the COM port you want to test, connect the other end to the client PC running "Hyperterm" or whatever terminal emulation software you are using. One popular Linux equivalent to Hyperterm is "minicom". A brief configuration guide for minicom follows the section below.
  • If you're using a modem for connectivity, then you'll need a FULL modem cable and testing will have to be done using a dial up connection.

Configuration Steps 

In RedHat Linux, the COM1 and COM2 ports are controlled by a program called "agetty", but "agetty" usually isn't activated when you boot up unless its configuration file /etc/inittab is modified. In other versions of Linux, "agetty" may be called just plain "getty". Here is a table that lists the physical ports to their equivalent Linux device names.

Port Linux "agetty" Device Name
COM1 ttyS0
COM2 ttyS1

The following lines added to /etc/inittab will configure your COM ports for terminal access:

# Run COM1 and COM2 gettys in standard runlevels
S0:235:respawn:/sbin/agetty -L 19200 ttyS0 vt102
S1:235:respawn:/sbin/agetty -L 19200 ttyS1 vt102

In summary, these lines mean:

  • At boot time, when the system enters runlevels 2, 3 or 5, "agetty" must attach itself to devices ttyS0 and ttyS1 and emulate a VT102 terminal running at 19200 baud.
  • The "-L" means ignore modem control signals, this option should be omitted if you are connecting the port to a modem.
  • The respawn means that agetty will restart automatically if, for whatever reason, it dies.

The next step is to restart the "init" process to re-read /etc/inittab

[root@bigboy tmp]# init q

Now you need to configure the terminal client such "as Hyperterm" to match the speed settings in /etc/inittab. Connect the console / modem cable between the client and your Linux box. Hit "enter" a couple times, and celebrate when you see something like this:

Red Hat Linux release 8.0 (Psyche)
Kernel 2.4.18-14 on an i586
bigboy login:

Note: By default, user "root" will not be able to log in from a terminal. To do this you'll have to edit the /etc/securetty file which contains the device names of tty lines on which root is allowed to login. Just add ttyS0 and ttyS1 to the list if you need this access.

documented on: 2008-05-21