Server refused to allocate pty
Posted by danielMar 12
Server refused to allocate pty : pseudoterminal in use reached maximum allowed limit.
You are unlikely to encounter this error in most cases, as the default maximum number of pseudoterminal(pty) in a Linux environment is large enough for typical use cases. The error might occur though under either an admin lowering the pty limit or unusual high number of connections to the system, using ssh or GUI terminal. Under those circumstances, you will see the below error during ssh interaction –
$ssh daniel@192.168.10.103 daniel@192.168.10.103's password: Server refused to allocate pty
GUI terminal error –
There was an error creating the child process for this terminal
getpt failed: No such file or directory
Per the man page –
” The Linux kernel imposes a limit on the number of available UNIX 98
pseudoterminals. In kernels up to and including 2.6.3, this limit is
configured at kernel compilation time (CONFIG_UNIX98_PTYS), and the
permitted number of pseudoterminals can be up to 2048, with a default
setting of 256. Since kernel 2.6.4, the limit is dynamically
adjustable via /proc/sys/kernel/pty/max, and a corresponding file,
/proc/sys/kernel/pty/nr, indicates how many pseudoterminals are
currently in use.
”
To resolve this, get a count of pty currently allocated using either of the below commands –
[root@kauai tmp]# sysctl kernel.pty.nr kernel.pty.nr = 10 [root@kauai tmp]# cat /proc/sys/kernel/pty/nr 10
You can list the allocated pts names –
# ps aux |grep -o -P '\s+pts/\d+\s+' |sort -u pts/0 pts/1 pts/2 pts/3 pts/4 pts/5 pts/6 pts/8 pts/9
If the currently allocated count is closer or less than to the limit, which you can find using
/proc/sys/kernel/pty/max
, go ahead increase the max limit as follows, say to 4096 in this example –
sysctl -w kernel.pty.max=4096
References –
116 comments
You must be logged in to post a comment.