SME Server serial console

Since the SME Server doesn’t do anything graphical, it doesn’t really need to have a video card and monitor. Instead, in the glorious tradition of Unix servers, you can use a dumb terminal to administer the system from console. This document explains how to configure your SME Server for a serial console.

Note: This document was not produced by Mitel Networks, and the modifications described within may render your server inoperable or invalidate any agreement you have with Mitel Networks. Follow these instructions at your own risk.

1. Caveat: PC BIOS woes
2. Selecting a Terminal
3. Attaching the Terminal
4. Configuring agetty
5. Configuring the console
6. References

Caveat: PC BIOS woes

The primary problem with using a serial console with a Linux system is that as firmware goes, PC BIOSes are braindead things. Your BIOS is almost certainly designed to only speak to a video card, and the serial console will only start displaying the boot process after control is handed to the operating system.

Practically, this means:

  • Video: You should keep a VGA card installed in the system in case a failure occurs before control is handed to Linux; that way, you will be able to connect a monitor temporarily to see where the failure occurs.
  • Keyboard: You may need to go into your BIOS and tell it to proceed without a keyboard attached. Otherwise, the BIOS may halt the boot process when it sees no keyboard. Some BIOSes may always refuse to boot without a keyboard, in which case you will need to buy a cheap keyboard and keep it attached to the system. This seems frustratingly unnecessary, but you still avoid the weight, heat, and cost of a monitor, and even a partially-broken keyboard will suffice (but not one with stuck keys!)

Selecting and Configuring a Terminal

In order to use a serial console, you will need something capable of acting as a dumb terminal. I recommend using something that can emulate a DEC VT100, VT220, or VT320; there may even be console components which expect VT100-compatibility.

Popular choices are a real DEC terminals, such as the VT420 or Wyse terminals with a vt100 mode such as the WY-75. My personal terminals of choice are the IBM 3151 — via which I first learned Unix — or an old Toshiba T1200 286 laptop with terminal software. You could also use terminal software on another PC that’s already near the SME server.

Attaching and Configuring the Terminal

To connect the terminal to the SME Server, connect its serial port to a free serial port on the back of the server with a null modem cable. (A null modem cable has some conductors swapped, so that you can connect terminal directly to system without a pair of modems in between.)

For the benefit of users who have never had to use a serial connector before, the port on the back of the server will be either a 9-pin male D-type connector, or rarely a 25-pin male D-type connector. Be careful not to use the parallel port, which is a 25-pin female D-type connector.

The terminal may need its default communications settings modified. While performing the initial configuration, use conservative settings: 9600 bps, 8 bits, 1 stop bit, no parity, no flow control. How to do this depends on your terminal configuration, and is beyond this HOWTO; consult your terminal’s documentation.

Be sure to note which serial port you have connected to. If you have connected to the port which Windows would call COM1, you are on /dev/ttyS0; COM2, /dev/ttyS1; and so on. A quick way to test that you are connected to the right port (and that the terminal is correctly configured) is to run

for port in 0 1 2 3 4 5 6 7
do
    echo ttyS${port} > /dev/ttyS${port}
done

and then look for the name of the serial port device on your terminal’s screen. If nothing appears there, then your terminal is not yet able to speak with your server; ensure its settings are as listed above, and that it is connected with a null modem cable. Try a different serial port if necessary.

Once you know the name of the port, you can test the connection in the other direction by running

cat /dev/ttyS0

(replacing /dev/ttyS0 with the device file of your serial port) and typing into the terminal. The characters you type on the terminal should appear below the cat command once you press Enter on the terminal. (Press Control-C to exit cat.)

Configuring agetty

getty is a system program which listens on empty serial lines and virtual consoles and handles new logins. The getty that SME Server uses for its virtual consoles is mingetty, but that doesn’t support serial lines. Instead, you’ll use agetty, which happens to already be installed on your SME Server.

Before configuring a serial console on the server, you need to make the terminal one via which you can login. To do so, you will add a getty to init‘s configuration; this way, the standard virtual consoles will still be there if something goes wrong.

Make a custom template for /etc/inittab, expand the template, and have init reread inittab with the following commands, replacing “/dev/ttyS0” with your serial device:

mkdir -p /etc/e-smith/templates-custom/etc/inittab

cd /etc/e-smith/templates-custom/etc/inittab

echo “s0:123457:respawn:/sbin/agetty 9600 /dev/ttyS0″ > 90serial

/sbin/e-smith/expand-template /etc/inittab

/sbin/telinit q

You should now have a login prompt on your terminal. Try logging in as admin, to get the SME Server console.

In order to allow logins as root, you must tell the system that the new terminal is secure. Run the following commands to create a custom template for /etc/securetty, replacing “ttyS0” with the name of your serial device:

mkdir -p /etc/e-smith/templates-custom/etc/securetty

cd /etc/e-smith/templates-custom/etc/securetty

cp /etc/e-smith/templates/etc/securetty/template-begin .

echo ttyS0 >> template-begin

/sbin/e-smith/expand-template /etc/securetty

Now verify that you are able to login as root.

Configuring the console

At this point you should have a working terminal on which you can login and administer your SME Server. (If not, do not continue until the terminal is working for logins!) But the server’s boot process will still appear only on an attached monitor.

In order to have the boot process appear on the terminal once the BIOS hands control over to Linux, you must tell init that your serial-port terminal is also a console. Just like you left the virtual terminals untouched before, you’ll leave the default console untouched, so that if things go wrong you can still attach a monitor. The terminal will be an additional console.

To have the LILO bootloader to use your serial console, and to instruct LILO not to display the Mitel logo on boot, create three custom templates for /etc/lilo.conf (replacing the number following “serial=” with the number of your serial device — 0 for ttyS0, 1 for ttyS1, and so on, and replacing “ttyS0” with the name of your serial device):

mkdir -p /etc/e-smith/templates-custom/etc/lilo.conf

cd /etc/e-smith/templates-custom/etc/lilo.conf

echo ‘serial=0,9600n8′ > 35serial

echo ‘append=”console=tty0 console=ttyS0,9600″‘ > 36append

touch 60message    # creates empty file

/sbin/e-smith/expand-template /etc/lilo.conf

/sbin/lilo -v

The order of the console entries in the append directive is important; the output of the boot process after rc.sysinit starts (“Welcome to the Mitel Networks SME Server”) goes to the last declared console.

Lastly, since init caches its terminal settings, remove its cached data to force it to learn about the serial console next boot. Otherwise, it may assume that your serial console uses the same port speed as the virtual consoles, 38400 bps.

rm /etc/ioctl.save

You now have a serial console! Reboot your system, and watch the boot process on your terminal.

References

The following documents were used as source material for this HOWTO, or provide in-depth discussions of particular elements glossed over here: