LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-25-2009, 04:00 AM   #1
Spoof
LQ Newbie
 
Registered: Dec 2008
Location: Russia
Distribution: Debian
Posts: 3

Rep: Reputation: 0
Serial console hangs.


Hi.
Ubuntu Server 8.04 is working on server with USB and RS-232 bus. Need to work with some net devices via serial console. Some net devices are cisco router and ZyXEL switch. One device connected directly to RS-232 port and other - via RS-232 - USB converter to USB port. It is no problem in switch, router or cabels: they are working fine on other host with FreeBSD installed. Unlikely that problem is in hardware port on server with ubuntu: the same symptoms for both connections (USB and RS232).
When I try to connect with cu, it writes "Connected." and hangs.
Here is some console i/o:

root@ubuntu:~# uname -rvpio
2.6.24-19-server #1 SMP Wed Jun 18 14:44:47 UTC 2008 unknown unknown GNU/Linux

root@ubuntu:~# dmesg | grep -i serial
[ 80.843296] Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing enabled
[ 80.843404] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[297235.670539] usbcore: registered new interface driver usbserial
[297235.670552] /build/buildd/linux-2.6.24/drivers/usb/serial/usb-serial.c: USB Serial support registered for generic
[297235.670571] usbcore: registered new interface driver usbserial_generic
[297235.670572] /build/buildd/linux-2.6.24/drivers/usb/serial/usb-serial.c: USB Serial Driver core
[297235.671656] /build/buildd/linux-2.6.24/drivers/usb/serial/usb-serial.c: USB Serial support registered for pl2303
[297235.671768] /build/buildd/linux-2.6.24/drivers/usb/serial/pl2303.c: Prolific PL2303 USB to serial adaptor driver


root@ubuntu:~# ls -l /dev/tty{S,USB}0
crwxrwxrwx 1 root root 4, 64 2009-05-19 13:45 /dev/ttyS0
crwxrwxrwx 1 root dialout 188, 0 2009-05-25 12:01 /dev/ttyUSB0

root@ubuntu:~# stty -F /dev/ttyUSB0
speed 115200 baud; line = 0;
min = 1; time = 5;
ignbrk -brkint -icrnl -imaxbel
-opost -onlcr
-isig -icanon -iexten -echo -echoe -echok -echoctl -echoke


root@ubuntu:~# stty -F /dev/ttyS0
speed 9600 baud; line = 0;
min = 1; time = 5;
ignbrk -brkint -icrnl -imaxbel
-opost -onlcr
-isig -icanon -iexten -echo -echoe -echok -echoctl -echoke


root@ubuntu:~# setserial -a /dev/ttyS0
/dev/ttyS0, Line 0, UART: 16550A, Port: 0x03f8, IRQ: 4
Baud_base: 9600, close_delay: 50, divisor: 1
closing_wait: 3000
Flags: spd_normal skip_test


root@ubuntu:~# cu -s 115200 -l /dev/ttyUSB0
Connected.

It hangs on this step. No visible reaction on keyboard input.

root@ubuntu:~# strace cu -s 115200 -l /dev/ttyUSB0
.
.
.
close(1021) = -1 EBADF (Bad file descriptor)
close(1022) = -1 EBADF (Bad file descriptor)
close(1023) = -1 EBADF (Bad file descriptor)
fcntl(0, F_GETFD) = 0
fcntl(1, F_GETFD) = 0
fcntl(2, F_GETFD) = 0
uname({sys="Linux", node="ubuntu", ...}) = 0
umask(0) = 022
socket(PF_FILE, SOCK_STREAM, 0) = 3
fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0
connect(3, {sa_family=AF_FILE, path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
close(3) = 0
socket(PF_FILE, SOCK_STREAM, 0) = 3
fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0
connect(3, {sa_family=AF_FILE, path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
close(3) = 0
open("/etc/nsswitch.conf", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=475, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9a2a422000
read(3, "# /etc/nsswitch.conf\n#\n# Example"..., 4096) = 475
read(3, "", 4096) = 0
close(3) = 0
munmap(0x7f9a2a422000, 4096) = 0
open("/etc/ld.so.cache", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=11800, ...}) = 0
mmap(NULL, 11800, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f9a2a420000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/libnss_compat.so.2", O_RDONLY) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0@\23\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=35632, ...}) = 0
mmap(NULL, 2131184, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f9a29a85000
mprotect(0x7f9a29a8d000, 2093056, PROT_NONE) = 0
mmap(0x7f9a29c8c000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x7000) = 0x7f9a29c8c000
close(3) = 0
munmap(0x7f9a2a420000, 11800) = 0
open("/etc/ld.so.cache", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=11800, ...}) = 0
mmap(NULL, 11800, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f9a2a420000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/libnss_nis.so.2", O_RDONLY) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 \0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=43480, ...}) = 0
mmap(NULL, 2139352, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f9a2987a000
mprotect(0x7f9a29884000, 2093056, PROT_NONE) = 0
mmap(0x7f9a29a83000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x9000) = 0x7f9a29a83000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/libnss_files.so.2", O_RDONLY) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\360\37\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=47528, ...}) = 0
mmap(NULL, 2143528, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f9a2966e000
mprotect(0x7f9a29678000, 2097152, PROT_NONE) = 0
mmap(0x7f9a29878000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xa000) = 0x7f9a29878000
close(3) = 0
munmap(0x7f9a2a420000, 11800) = 0
open("/etc/passwd", O_RDONLY|0x80000 /* O_??? */) = 3
fcntl(3, F_GETFD) = 0x1 (flags FD_CLOEXEC)
lseek(3, 0, SEEK_CUR) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=1358, ...}) = 0
mmap(NULL, 1358, PROT_READ, MAP_SHARED, 3, 0) = 0x7f9a2a422000
lseek(3, 1358, SEEK_SET) = 1358
munmap(0x7f9a2a422000, 1358) = 0
close(3) = 0
getuid() = 0
geteuid() = 0
open("/etc/passwd", O_RDONLY|0x80000 /* O_??? */) = 3
lseek(3, 0, SEEK_CUR) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=1358, ...}) = 0
mmap(NULL, 1358, PROT_READ, MAP_SHARED, 3, 0) = 0x7f9a2a422000
lseek(3, 1358, SEEK_SET) = 1358
munmap(0x7f9a2a422000, 1358) = 0
close(3) = 0
setuid(10) = 0
rt_sigaction(SIGINT, NULL, {SIG_DFL}, 8) = 0
rt_sigaction(SIGINT, {0x40ea30, [], SA_RESTORER|SA_INTERRUPT, 0x7f9a29cc0100}, NULL, 8) = 0
rt_sigaction(SIGHUP, NULL, {SIG_DFL}, 8) = 0
rt_sigaction(SIGHUP, {0x40ea30, [], SA_RESTORER|SA_INTERRUPT, 0x7f9a29cc0100}, NULL, 8) = 0
rt_sigaction(SIGQUIT, NULL, {SIG_DFL}, 8) = 0
rt_sigaction(SIGQUIT, {0x40ea30, [], SA_RESTORER|SA_INTERRUPT, 0x7f9a29cc0100}, NULL, 8) = 0
rt_sigaction(SIGTERM, NULL, {SIG_DFL}, 8) = 0
rt_sigaction(SIGTERM, {0x40ea30, [], SA_RESTORER|SA_INTERRUPT, 0x7f9a29cc0100}, NULL, 8) = 0
rt_sigaction(SIGPIPE, NULL, {SIG_DFL}, 8) = 0
rt_sigaction(SIGPIPE, {0x40ea30, [], SA_RESTORER|SA_INTERRUPT, 0x7f9a29cc0100}, NULL, 8) = 0
open("/etc/uucp/port", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/etc/uucp/L-devices", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/etc/uucp/Devices", O_RDONLY) = -1 ENOENT (No such file or directory)
creat("/var/lock/TMP0000000b92", 0644) = 3
write(3, " 2962\n", 11) = 11
close(3) = 0
link("/var/lock/TMP0000000b92", "/var/lock/LCK..ttyUSB0") = 0
unlink("/var/lock/TMP0000000b92") = 0
geteuid() = 10
getuid() = 10
getegid() = 0
getgid() = 0
setregid(0, 0) = 0
setreuid(10, 10) = 0
open("/dev/ttyUSB0", O_RDWR|O_NONBLOCK) = 3
geteuid() = 10
getuid() = 10
getegid() = 0
getgid() = 0
setregid(0, 0) = 0
setreuid(10, 10) = 0
fcntl(3, F_GETFD) = 0
fcntl(3, F_SETFD, FD_CLOEXEC) = 0
access("/dev/ttyUSB0", R_OK|W_OK) = 0
fcntl(3, F_GETFL) = 0x8802 (flags O_RDWR|O_NONBLOCK|O_LARGEFILE)
fcntl(3, F_SETFL, O_RDWR|O_LARGEFILE) = 0
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, {B115200 -opost -isig -icanon -echo ...}) = 0
ioctl(3, TCFLSH, 0) = 0
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, {B115200 -opost -isig -icanon -echo ...}) = 0
ioctl(3, SNDCTL_TMR_START or TCSETS, {B115200 -opost -isig -icanon -echo ...}) = 0
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, {B115200 -opost -isig -icanon -echo ...}) = 0
ioctl(3, TIOCSCTTY) = -1 EPERM (Operation not permitted)
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, {B115200 -opost -isig -icanon -echo ...}) = 0
ioctl(3, SNDCTL_TMR_START or TCSETS, {B115200 -opost -isig -icanon -echo ...}) = 0
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, {B115200 -opost -isig -icanon -echo ...}) = 0
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, {B115200 -opost -isig -icanon -echo ...}) = 0
ioctl(3, SNDCTL_TMR_STOP or TCSETSW, {B115200 -opost -isig -icanon -echo ...}) = 0
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, {B115200 -opost -isig -icanon -echo ...}) = 0
access("/dev/ttyUSB0", R_OK|W_OK) = 0
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 1), ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9a2a422000
write(1, "\7Connected.\n", 12Connected.
) = 12
ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(0, SNDCTL_TMR_START or TCSETS, {B38400 -opost -isig -icanon -echo ...}) = 0
ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 -opost -isig -icanon -echo ...}) = 0
pipe([4, 5]) = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f9a2a41e770) = 2963
close(5) = 0
read(0, "\3", 1) = 1
write(3, "\3", 1) = 1
read(0, "\3", 1) = 1
write(3, "\3", 1) = 1
read(0, "\3", 1) = 1
write(3, "\3", 1) = 1
read(0,


Now I can see reaction on input:
read(0, "\r", 1) = 1
write(3, "\r", 1) = 1
read(0, "\33", 1) = 1
write(3, "\33", 1) = 1


But ^C (and other hotkeys) doesn't terminate session:
read(0, "\3", 1) = 1
write(3, "\3", 1) = 1


I've tried to use minicom and every possible parameters of setserial - same results.
If some additional information needed, I'll provide it.
Will be very gratefull for any help.
P.S. Sorry for my English :].
 
Old 05-26-2009, 01:44 PM   #2
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
If you are connecting directly from the serial port on the computer to the serial port on the router or switch you need to use a null modem cable. This is a cable that switches the rts and cts wires between the two ends.

If you have a null modem cable then there are a couple of other things that could cause exactly this kind of problem.
- baud rate
- handshake (hardware or software)
- 7 bit/8 bit

For example I see above that your ttyUSB0 is set to 115200 baud while ttyS0 is set to 9600 baud. What is the serial port on the router or switch baud rate set to?

I remember using VAX/VMS that I would set the serial ports to autobaud when connecting a TTY. If I connected a modem I would set the serial port to 9600 baud, 8 bits, No parity check, and 1 parity bit. I haven't played with serial ports much since modems ran at 9600 baud.

And don't worry about your English. I wish I could converse in ANY other language as well as you write English.

Last edited by stress_junkie; 05-26-2009 at 01:45 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
serial console pvpnguyen Red Hat 1 11-17-2007 01:42 PM
Serial console problem davide1 Linux - Hardware 0 03-15-2005 05:58 AM
Serial Console zaicheke Linux - Networking 4 11-14-2004 07:55 PM
serial terminal console Alfexy Slackware 4 10-22-2004 07:15 PM
serial console ixion Linux - Software 3 03-19-2003 12:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:02 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration