April 1, 2020

Server refused to allocate pty (NetBSD DOMU case)

Server refused to allocate pty (NetBSD DOMU case)

When using NetBSD as DomU PV guest you can stumble upon this message when trying to connect via ssh:

login as: root
Keyboard-interactive authentication prompts from server:
Password for root@server:
End of keyboard-interactive prompts from server
Server refused to allocate pty

This is because of no more available terminals that can user be attached to.

Fortunately, there is easy fix to this, and is built in in base system.

First you have to somehow login to the server either on console, or close other terminals and wait for session to time out.

Then you need to use mount_ptys as below:

mount_ptyfs ptyfs /dev/pts

Then login couple more times to see if it's working. Session handled by ptyfs will be marked on TTY field as pts instead of ttyp

USER     TTY     FROM                LOGIN@  IDLE WHAT
root     console -                  31Dec19 67days -ksh
root   pts/2   *****.***.pl  4:06PM     0 w
root   ttyp0   *****.***.pl 12:39PM    11 ksh

If all works, you can put that into /etc/fstab to be permanent after reboot.

ptyfs /dev/pts ptyfs rw 0 0