Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm setting up a console server and I need to determine the correct baud rate of my port. I'd like to do this from the command line, if possible. Does anyone know how?

share|improve this question

3 Answers 3

up vote 3 down vote accepted

The program you're looking for is called "setserial".

http://linux.die.net/man/8/setserial

share|improve this answer
    
Thanks, that was exactly what I needed. –  thepocketwade Jun 23 '09 at 20:30

setserial is Linux-specific, but you can also use the stty command (available on any Unix) to check the speed and other characteristics of any tty. stty operates on its standard input, so stty < /dev/ttyXX will give you the information about that particular tty.

share|improve this answer
    
You may need to use stty -F /dev/ttyXX –  Mark Lakata Oct 25 '12 at 21:47

Since you mention a console server and this question is tagged with linux I will assume you are connecting to a linux server. The server must be configured to use a serial console so there are a couple of places to check.

The kernel setup involves adding the "console" parameter to the command line of your kernel. For example adding "console=ttyS0,9600" tells the kernel to send messages to the first serial port (/dev/ttyS0, COM1 in DOS/Windows terms) at 9600 baud. You can add this to the command line through your boot loader configuration. If using grub this will usually be a file called /boot/grub/grub.conf. Note that you can have multiple console parameters for traditional keyboard/video console (tty0) as well as serial (/dev/ttyS0). For exaxmple: "console=tty0 console=ttyS0,9600"

To provide a login prompt via serial you need to edit /etc/inittab and add/edit a line like the following. s0:12345:respawn:/sbin/agetty 9600 ttyS0 vt100 This line tells the agetty program to spawn a login prompt on /dev/ttyS0 at 9600 baud.

Note you will normally want to match the serial port and baud rate between the kernel and agetty setup. By checking the configurations above you should be able to determine the server baud rate.

share|improve this answer
    
Unless your Linux doesn't use inittab. My Fedora and Ubuntu systems use /etc/event.d/tty* and /etc/event.d/serial which are part of Upstart (en.wikipedia.org/wiki/Upstart). –  Dennis Williamson Jun 23 '09 at 22:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.