From owner-freebsd-questions@FreeBSD.ORG Mon Jul 2 22:13:00 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9CB8A106566C for ; Mon, 2 Jul 2012 22:13:00 +0000 (UTC) (envelope-from bnyec@yahoo.com) Received: from nm1.bullet.mail.bf1.yahoo.com (nm1.bullet.mail.bf1.yahoo.com [98.139.212.160]) by mx1.freebsd.org (Postfix) with SMTP id 54A958FC0A for ; Mon, 2 Jul 2012 22:13:00 +0000 (UTC) Received: from [98.139.212.151] by nm1.bullet.mail.bf1.yahoo.com with NNFMP; 02 Jul 2012 22:13:00 -0000 Received: from [98.139.212.251] by tm8.bullet.mail.bf1.yahoo.com with NNFMP; 02 Jul 2012 22:13:00 -0000 Received: from [127.0.0.1] by omp1060.mail.bf1.yahoo.com with NNFMP; 02 Jul 2012 22:13:00 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 12803.86362.bm@omp1060.mail.bf1.yahoo.com Received: (qmail 75328 invoked by uid 60001); 2 Jul 2012 22:12:59 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1341267179; bh=W3EmQnwbSwz74ybQokVqw60hUm6WIoAYjEk3dWnpFKU=; h=X-YMail-OSG:Received:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type; b=lcCxK7OlMWAMXoO4fAdHYFbanHlLrpuIa7DVMWsz+ox2rs2AXCJ/HrjMY5pD992TpMag7NmQmkZtQKuRnThJ1wy1CHJ/gEb9i9L/5qzuPv+oEFhDx3IZX8zJCQAI1zLGW7SvX5JpFzwaUZraBAhWquYzNEokZEVJPSAbclfh4+4= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type; b=kztXwc6dD3wV0JwB8gUjK+yIoq+nLCu5Mx4OV+05+KN8Tx8w9W/a3q4XlY12Eh7JEMrWcxaq1tw4UwAdRh2eoe3Q8TQVIP4T+t6JKel4eWsGNb3S7Pv6vuwp0D3AxqUUVfeywuw6vGUAX/47AADgEtDNNHlsWccFuc6FpSErYdU=; X-YMail-OSG: kmvgZZQVM1k1BdKld4ivLUfawbl6HWsHy7lcLD78EvJqkby X1Jpr5sh.BJQ1XVxkh2lV1Igx.GWVG3S9oNuXeBCz_hCeRuafmBWzLGZhdza 9f3.86mtyLWeASf3hwh.zsjQZd.7zeF79__ZwltFX5wFbTp4eRhzRuh56U9g xocU1Lsiipsbtq8vszjxCLdP7_E8BVSJjWpcOD3G7lDP6.Qv6wolbrTyFTT2 XyVNjUJJm7Axk5wtRQ8_WUKZ.LQ97ivnb_TOW8lwYkC4ju_HTuJmtkEA6BL0 1qpl8n4wKarqBAzuhlKNKS_5AADFuPjYPWKFoMiHCxbA92y.Lupqk96kfOup J6BJyqZ0zZRk7AU9mUji45fU2b9OnhPB_biNzRimXiNyd9LbYHw_9D1kY1F0 J8ZarZhjG1h6P6XYFYQnuoAMA6MbrVC9d94_1jE_UTC_FRl0omlSC_zwgUGP UXBKGipSjWj2s6143dZ2ULOdmMLZgQMwUsvGb11bvD0sNuy5DWjxSOcBjFPJ YvP.bpe8SrnkKKe2n06zjpAKNwTbwtovyOtA8cZZps0Pqx9ruEKfXXyKLCUA - Received: from [173.192.118.68] by web161503.mail.bf1.yahoo.com via HTTP; Mon, 02 Jul 2012 15:12:59 PDT X-Mailer: YahooMailClassic/15.0.8 YahooMailWebService/0.8.120.356233 Message-ID: <1341267179.71915.YahooMailClassic@web161503.mail.bf1.yahoo.com> Date: Mon, 2 Jul 2012 15:12:59 -0700 (PDT) From: "b. nyec" To: freebsd-questions@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: 7.0-RELEASE tty/pty problems ? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: bnyec@yahoo.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2012 22:13:00 -0000 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