Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Serial port access through Terminal in Leopard Server OS X Server
Having a pressing need to access a Cisco router via the console cable, and not having a PC with a serial port laying around anywhere, I decided to look into how to access the serial port on an Xserve that's running Leopard Server. Previous hints targeted at Tiger Server and below, however, do not work any more as the serial support files are no longer found in /System » Library » StartupItems/. Through some digging, I found the solution to the problem and can now access the router via the serial port at any time, even from my iPhone (through Terminal, of course)!

Leopard Server moved the SerialTerminalSupport shell script to /usr » libexec » serial. The syntax for launching it remains the same, though, just the location has changed. Thinking that was all it took, I stopped the SerialTerminalSupport service with this command (run all these commands as superuser):
/usr/libexec/serial/SerialTerminalSupport stop
And tried to launch the screen program to open a connection via the serial port with screen /dev/cu.serial. No luck. I see bits and pieces of the Cisco's console prompt in my Terminal window, but the screen session keeps sending garbage -- to the point where I'd have to close the Terminal window and issue a kill command to let go of /dev/cu.serial and the screen session.

It turns out that by default, OS X Server sets the baud rate of the serial port to 57600, which is too fast for the Cisco console port.

The magic file to change to fix this problem is /etc/gettytab. Open that file up in your favorite editor and do a search for Xserve. Comment out the three lines beginning with:
serial.57600|serial db9 port:
Save the file and reboot. To verify that the change was correct, you can check info on /dev/cu.serial with:
stty -f /dev/cu.serial
If the first line says speed 9600 baud;, you are good to go. Simply stop SerialTerminalSupport and launch screen with the above command. I wrote a simple shell script to correctly launch screen. For the sake of putting it all together, here it is:
#! /bin/sh

/usr/libexec/serial/SerialTerminalSupport stop
screen /dev/cu.serial
To quit cleanly out of screen, type Control-A followed by Control-. (period). You'll be prompted to quit; type y and you'll be back at your regular shell. Hope this hint helps someone out there, not that you need to use it every day, but it can be a lifesaver just that once. I know it worked for me.
    •    
  • Currently 3.09 / 5
  You rated: 4 / 5 (11 votes cast)
 
[120,547 views]  

Serial port access through Terminal in Leopard Server | 10 comments | Create New Account
Click here to return to the 'Serial port access through Terminal in Leopard Server' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Serial port access through Terminal in Leopard Server
Authored by: Cobalt Jacket on Feb 27, '08 07:54:33AM

Why not just use "cu"?



[ Reply to This | # ]
Serial port access through Terminal in Leopard Server
Authored by: mayo2ca on Feb 27, '08 08:51:46AM

My thoughts exactly!

Isn't `cu -s 19200 -l /dev/cuad0` just 1000 times simpler? And not to mention no need to change system settings.



[ Reply to This | # ]
Serial port access through Terminal in Leopard Server
Authored by: peterjhill on Feb 27, '08 11:13:56AM

If someone is looking for an easier way to connect to serial consoles from a mac, zterm and a usb to serial adapter work well. I use a keyspan high speed serial adapter and it works just fine.

zterm is fairly friendly. I have not found anything that comes close to tempting me away from using it...

using terminal.app is very hardcore :-)



[ Reply to This | # ]
Serial port access through Terminal in Leopard Server
Authored by: trowlfaz on Feb 27, '08 04:02:40PM

I have a Keyspan USB to serial adaptor. It is pretty easy via Terminal

screen /dev/tty.KeySerial1 9600

I use this all the time when troubleshooting and configuring our Cisco routers, switches, etc.



[ Reply to This | # ]
Serial port access through Terminal in Leopard Server
Authored by: mizraith on Feb 27, '08 04:59:52PM
I downloaded minicom and also use a Keyspan USB to Serial adapter. I gave up actually trying to use Terminal as a terminal (funny, huh?).

Incindentally, minicom (free) can be gotten through MacPorts (www.macports.org). I like it 'cause it's readily configured for baud rates and such.


[ Reply to This | # ]
Serial port access through Terminal in Leopard Server
Authored by: mizraith on Feb 27, '08 05:01:20PM
I downloaded minicom and also use a Keyspan USB to Serial adapter. I gave up actually trying to use Terminal as a terminal (funny, huh?).

Incindentally, minicom (free) can be gotten through MacPorts (www.macports.org). I like it 'cause it's readily configured for baud rates and such.


[ Reply to This | # ]
Serial port access through Terminal in Leopard Server
Authored by: djdawson on Feb 28, '08 09:41:45AM
I've found zterm to be a bit buggy in OSX, and minicomm to be a bit obtuse and ugly. I had been using a version of "tip" that I built from the BSD sources. Recently a coworker told me he just uses "kermit", which is also available via MacPorts, though it, like "screen", has an imposing looking man page that can make it seem unapproachable at first. One problem I had with my version of "tip" was that it wouldn't pass "control-a" characters, which made line editing on a Cisco device less useful. Kermit does not have that problem. Now that I know about "screen" however, I'll probably switch to that, since I prefer to use tools that are native to the platform instead of having to install them. I also use a Keyspan USB serial port adapter, and in case anyone's interested in a quick-start on a convenient way to use kermit to access Cisco console ports, here's the little shell script I use to start kermit with the appropriate settings:
#!/opt/local/bin/kermit +
set modem type none
set line /dev/tty.KeySerial1
set speed 9600
set serial 8N1
set flow none
set carrier-watch off
connect
I saved this script with the name "keyspan" so I can remember it, make it executable, then just use the command "./keyspan" to start kermit with the above settings. It works well, but given the above hint about screen it may not be quite as convenient to use, though it really comes down to personal preference.

[ Reply to This | # ]
Serial port access through Terminal in Leopard Server
Authored by: glusk on Mar 01, '08 10:09:36PM

I haven't tried this in server, but I use various USB-serial adaptors and Zterm is the easiest. Minicom will work but not terribly friendly (to me anyway.)

But since "screen" is around by default, I've always invoked it with:

screen /dev/tty.usb 9600




[ Reply to This | # ]
Serial port access through Terminal in Leopard Server
Authored by: h3rbz on Sep 03, '08 04:05:25AM

I just got a Aten UC-232A to use with my MacBook Pro for connecting to devices, such as network switches and power switches. The device is named /dev/tty.UC-232AC.

I'm using it with minicom and it works great. I have been using minicom on other platforms, so I had no trouble with operating it. For those who are new to minicom, basic setup is simple. Do:

$ sudo minicom -s

Folow the setup instructions and adjust the config for the device you plan on connecting to, save and exit. To use minicom, just do:

$ sudo minicom

Running as root may not be needed, but this is my first try and it does the job.

Just sharing this experience, so others may benefit from it.

H3rbz



[ Reply to This | # ]
Serial port access through Terminal in Leopard Server
Authored by: ipstacks on May 11, '10 06:59:44PM

I use a 3G modem on Windows 7 and OS X. I increased the port speed of the serial port the 3G modem is using (or literally is) in Windows 7 and I noticed the 3G modem is now faster. Windows 7 allows me to set the port speed to 921600. I would like to do the same sort of thing in OS X, but I don't see how. The 3G modem shows up as:
/dev/tty.JRDDeviceInterface00001XXX
/dev/tty.JRDMobileConnector000010XXX
When I do stty -f /dev/tty.JRDDeviceInterface00001XXX
I get 9600 baud.



[ Reply to This | # ]