Date: Mon, 2 Jul 2012 15:12:59 -0700 (PDT) From: "b. nyec" <bnyec@yahoo.com> To: freebsd-questions@freebsd.org Subject: 7.0-RELEASE tty/pty problems ? Message-ID: <1341267179.71915.YahooMailClassic@web161503.mail.bf1.yahoo.com>
next in thread | raw e-mail | index | archive | help
Hello, We've been experiencing problems with allocating tty/pty's on a few of our systems running FreeBSD 7.0-RELEASE. I could be way off, but it seems that the tty/pty's are not being made available after being used and/or are no longer valid or corrupted ?? I am aware that 8.x and up uses Unix98-style PTYS (/dev/ptmx). Unfortunately, upgrading is not an option at this time. Thanks for any Help. PS, Sorry if this is bad netiquette, but i've posted this on freebsd forums, (a tad bit more info http://forums.freebsd.org/showthread.php?t=33080) just figured I'd ask here as well. - B # uname -mv FreeBSD 7.0-RELEASE #0: Mon Apr 28 17:36:07 CDT 2008 root@:/usr/obj/usr/src/sys/COLONEL amd64 rancid running from crontab, log errors clogin error: Error: telnet failed: The system has no more ptys. Ask your system administrator to create more. ssh logins sometimes produce: Warning: no access to tty (Bad file descriptor). Thus no job control in this shell. sshd logs, sshd[68948]: debug1: Allocating pty. sshd[68948]: error: openpty: No such file or directory sshd[68948]: error: session_pty_req: session 0 alloc failed There appear to be plenty of tty/pty devices... # ls -la /dev/pty* | wc -l 512 # ls -la /dev/tty* | wc -l 534 Test program demonstrating the problem, # test_openpty.c /* gcc -Wall test_openpty.c -lutil */ int main() { int max = 10; /* number to try */ int i = 1; int masterfd, slavefd, status; char ptyname[256]; while(max--) { status = openpty(&masterfd, &slavefd, ptyname, NULL, NULL); if(status < 0) { fprintf(stderr, "openpty() failed: %s\n",strerror(errno)); exit(1); } printf("%d: openpty: %s\n",i,ptyname); revoke(ptyname) i++; } return 0; } # who | wc -l 6 # ./a.out 1: openpty: /dev/ttyOm 2: openpty: /dev/ttyOq 3: openpty: /dev/ttyOt 4: openpty: /dev/ttyOu openpty() failed: No such file or directory # Truss output... open("/dev/ttyOu",O_RDWR,00) = 10 (0xa) 4: openpty: /dev/ttyOu write(1,"4: openpty: /dev/ttyOu\n",23) = 23 (0x17) revoke(0x7fffffffea70,0x800a19000,0x0,0x17,0xffffffffb0644d40,0x7fffffffe0b8) = 0 (0x0) stat("/etc/nsswitch.conf",{mode=-rw-r--r-- ,inode=17145912,size=313,blksize=4096}) = 0 (0x0) open("/etc/group",O_RDONLY,0666) = 11 (0xb) fstat(11,{mode=-rw-r--r-- ,inode=17145897,size=565,blksize=4096}) = 0 (0x0) lseek(11,0x0,SEEK_CUR) = 0 (0x0) lseek(11,0x0,SEEK_SET) = 0 (0x0) read(11,"# $FreeBSD: src/etc/group,v 1.35"...,4096) = 565 (0x235) close(11) = 0 (0x0) open("/dev/ptyp0",O_RDWR,00) ERR#5 'Input/output error' open("/dev/ptyp1",O_RDWR,00) ERR#5 'Input/output error' open("/dev/ptyp2",O_RDWR,00) ERR#5 'Input/output error' open("/dev/ptyp3",O_RDWR,00) ERR#5 'Input/output error' [....] open("/dev/ptyOu",O_RDWR,00) ERR#5 'Input/output error' open("/dev/ptyOv",O_RDWR,00) ERR#5 'Input/output error' openpty() failed: No such file or directory write(2,"openpty() failed: No such file o"...,44) = 44 (0x2c) process exit, rval = 1 FWIW, "/etc/rc.d/devfs restart" and "kill -HUP 1" does not fix the problem. # df /dev Filesystem 1K-blocks Used Avail Capacity Mounted on devfs 1 1 0 100% /dev
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1341267179.71915.YahooMailClassic>