Problem
SSH session to remote systems is hanging:
Jun 3 10:11:52 serv1 sshd[21086]: error: openpty: Not a typewriter
Jun 3 10:11:52 serv1 sshd[21086]: error: session_pty_req: session 0 alloc failed
Solution
There are too many sessions using PTYs:
# ps -ef | awk '{ print $6 }' | grep "pts" | wc -l
60
Where is the maximum supported PTYs is:
# kctune -v nstrpty
Tunable nstrpty
Description Maximum number of Streams-based pseudo-terminals
Module ptm
Current Value 60 [Default]
Value at Next Boot 60 [Default]
Value at Last Boot 60
Default Value 60
Can Change At Next Boot Only
# ls /dev/pts | egrep -i '^[0-9]' | wc -w
60
Background
There are actually three different types of ptys in HP-UX. You can see them all among the output of lsdev:
Character Block Driver Class
16 -1 ptym ptym
17 -1 ptys ptys
139 -1 telm strtelm
140 -1 tels strtels
156 -1 ptm strptym
157 -1 pts strptys
The telnet connection uses “telnet stream” ptys. The slave side of those appear as /dev/pts/t*
. The dtterm and hpterm terminals use “stream” ptys. The slave side of those appear as /dev/pts/[0-9]*
. The xterm terminal uses plain old ptys. The slave side of those appear as /dev/ttyp*
. Each type of pty has different kernel parameter limits and different device files. Check the kernel parameters and try recreating the device files with insf
. ( example: insf -en 120
)
Workaround
Create an SSH session without PTY:
$ ssh -T root@serv1 /bin/ksh -i
Leave a comment