petit article décrivant comment avoir accès au port série dans Leopard Server
utile dans bien des cas (router cisco, par exemple…)
in english pour une fois ;-)
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):
- Code:
-
/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:
- Code:
-
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:
- Code:
-
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:
- Code:
-
#! /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.
source