Linux Tips

  


Connecting to Serial Consoles from Linux

by Jeff Hunter, Sr. Database Administrator

Introduction

The following article documents some of the tips for connecting the serial port of a Linux server to the serial port (console) of a Sun Server. This is often helpful and even necessary when performing routine administrative tasks or initiating critical and/or long running processes. Access to the serial console for many Sun servers is the only way to perform administrative tasks given these servers do not come with a frame buffer (i.e. video card).

There are times when I need to initiate a long running job but cannot remain connected to the network for the duration of its execution. In cases like this, I can connect to the serial console of the Sun server, initiate the job and disconnect. The job will remain running even when I drop my connection to the serial port. I can, at a later time, reconnect to the serial console to determine the results.

For a more detailed article on Sun Serial/Console connections, click here.

Connect to a Sun Serial Console from Linux

Linux provides two methods (programs) that can be used to connect to a serial console of a Sun server.

Connecting Using minicom

The first application I'll talk about is "minicom". Most Linux distributions (i.e. Red Hat) already include minicom. If your particular distribution does not include minicom, you can download it from the following URL:

http://linux.softpedia.com/get/Communications/Telephony/minicom-753.shtml

Once you have Minicom installed, start it up with the command "minicom". Press "Ctrl-A Z" to get to the main menu. Press "o" to configure minicom. Go to "Serial port setup" and make sure that you are set to the correct "Serial Device" and that the speed on line E matches the speed of the serial console you are connecting to. (In most cases with Sun, this is 9600.) Here are the settings I made when using my Serial A / COM1 port on my Linux box:


+-----------------------------------------------------------------------+ | A - Serial Device : /dev/ttyS0 | | B - Lockfile Location : /var/lock | | C - Callin Program : | | D - Callout Program : | | E - Bps/Par/Bits : 9600 8N1 | | F - Hardware Flow Control : Yes | | G - Software Flow Control : No | | | | Change which setting? | +-----------------------------------------------------------------------+

After making all necessary changes, hit the ESC key to go back to the "configurations" menu. Now go to "Modem and dialing". Change the "Init string" to "~^M~". Save the settings (as dflt), and then restart Minicom. You should now see a login prompt.

Connecting Using UUCP

Another common application to use in Linux for connecting to a serial console is UUCP. Most Linux distributions include the UUCP application. Start UUCP with the command "cu -l [device] -s [speed]", where [device] is the serial port you are using, such as ttyS0 (COM1) or ttyS1 (COM2), and [speed] is the speed of the serial console that you are connecting to.

Here is an example:


# cu -l /dev/ttyS0 -s 9600

You may need to hit enter before you see the login prompt. If you see a bunch of weird characters, then you probably specified the wrong speed.

To exit, just type "~.".



Copyright (c) 1998-2014 Jeffrey M. Hunter. All rights reserved.

All articles, scripts and material located at the Internet address of http://www.idevelopment.info is the copyright of Jeffrey M. Hunter and is protected under copyright laws of the United States. This document may not be hosted on any other site without my express, prior, written permission. Application to host any of the material elsewhere can be made by contacting me at jhunter@idevelopment.info.

I have made every effort and taken great care in making sure that the material included on my web site is technically accurate, but I disclaim any and all responsibility for any loss, damage or destruction of data or any other property which may arise from relying on it. I will in no case be liable for any monetary damages arising from such loss, damage or destruction.

Last modified on
Friday, 29-Apr-2011 02:15:47 EDT
Page Count: 101887