Using the serial port on an Apple Xserve

Some have found my posts on running Linux on the (EFI only) Xserves useful, and one such person is Eddie, who emailed me with some details on how he got the serial port working. Hopefully it will be useful to someone else, so with his permission, the following is what he sent me:

Believe it or not, Apple screwed up the pin-outs on the back of the DB-9 port for the Xserve (it might have been a logic board design error and perhaps they didn’t want to spend the money to re-design it). I made my own null modem cable and got it to work with OS X Server (taking the other end of the null modem cable over to a USB-to-DB9 adapter and then plugged it into my PC running Windows 7). As for how Ubuntu handles serial ports including on Xserves, I have some good news. Today, after much digging around, I found out how this works. First of all the GRUB load / configuration that you helped put together and document for the Xserve recognizes the built-in serial port (hurray!). This built in serial port is recognized as /dev/ttyS0. For example, from my Ubuntu 9.10 kern.log file:

$ cat /var/log/kern.log | grep ttyS
Nov 16 09:34:38 ubuntu kernel: [ 1.140244] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
Nov 16 09:34:38 ubuntu kernel: [ 1.140343] serial8250: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
Nov 16 09:34:38 ubuntu kernel: [ 1.140720] 00:09: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A

I’m not sure, however, what ttyS1 is on the Xserve (as you can see in the output above).

Another way to look at this:

root@ubuntu:~# dmesg | grep serial
[ 1.140244] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[ 1.140343] serial8250: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A

Ubuntu specifically made changes to how one goes about configuring from one major version to another (so this is going to also probably differ among Linux distros such as Red Hat) but for what its worth, under 9.10 you have to set up a ttyS0 file and place it in /etc/init/ and the contents should be the following:

# ttyS0 - getty
#
# This service maintains a getty on ttyS0 from the point the system is
# started until it is shut down again.
start on stopped rc RUNLEVEL=[2345]
stop on runlevel [!2345]
respawn
exec /sbin/getty -L 115200 ttyS0 vt102

Once this /dev/ttyS0 file has been created and in place, you can load it like this:

# start ttyS0

which, if successful, should output a line like this:

ttyS0 start/running, process 4478

You can also read the device like this:

# stty -F /dev/ttyS0 -a

and expect output as follows:

speed 115200 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = ; eol2 = ; swtch = ; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -iuclc -ixany -imaxbel -iutf8
-opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop -echoprt -echoctl -echoke

I had no problem firing up PuTTY on a laptop running Windows 7 and connecting to the Xserve running Ubuntu. I could log in just as I would be able to at any console whether via KVM or SSH.

Great stuff! Another option to keep our Xserves going into perpetuity especially since Apple is dropping them in a few months!

2 thoughts on “Using the serial port on an Apple Xserve

Leave a Reply

Your email address will not be published. Required fields are marked *