January 10, 2021

Server refused to allocate pty (NetBSD PV guest but probably related to PV Linuxes as well)

Server refused to allocate pty (NetBSD PV guest but probably related to PV Linuxes as well)

If you faced this kind of error on your terminal

login as: ****
Keyboard-interactive authentication prompts from server:
| Password for ****@hostname.tld:
End of keyboard-interactive prompts from server
Server refused to allocate pty

especially often in PV guest of XEN this means that there are no available terminals you can be attached to.

Fix is easy, and for NetBSD is just one command

mount_ptyfs ptyfs /dev/pts

This creates pseudo filesystem mounted on /dev/pts

$ df -h
Filesystem         Size       Used      Avail %Cap Mounted on
/dev/xbd0a         8.9G       118M       8.3G   1% /
/dev/xbd2a         148G        90M       140G   0% /var
/dev/xbd1a          58G       5.4G        50G   9% /usr
kernfs             1.0K       1.0K         0B 100% /kern
procfs             4.0K       4.0K         0B 100% /proc
tmpfs              4.0G       4.0K       4.0G   0% /var/shm
ptyfs              1.0K       1.0K         0B 100% /dev/pts
PTYFS on last line is our pseudo filesystem

Every next login when "normal" terminal - tty is not available you will be redirected to /dev/pts

$ w
 2:30PM  up  2:33, 3 users, load averages: 0.10, 0.18, 0.08
USER     TTY     FROM              LOGIN@  IDLE WHAT
login   pts/2   172.19.100.107    2:30PM     0 w
login   ttyp0   172.19.100.107    2:24PM     0 ksh
login   ttyp1   tmux(40).%0      11:56AM     5 cvs -d:ext:anoncvs@anoncvs.NetBSD.org:/cvsroot -q update -d -P -rne
After using both ttyp terminal next login is on pts