"No more PTYs" when trying to start screen

Solution 1:

Having zero ptys is unusual, as the very SSH connection you are using has a pty allocated.

Make sure you have devpts mounted:

$ grep /dev/pts /proc/mounts
devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620 0 0

If it is not:

# mount devpts /dev/pts -t devpts -o mode=620

Solution 2:

I had a similar issue, but my problem arised when I started an LXC container within my system (and stopping it didn't help). It turned out that when screen (in my base system) was trying to open a new PTY, it was opening one that was already existing, and couldn't change its ownership.

It was very strange, but the most obvious place was the /dev/pts mountpoint, so I simply remounted it:

# mount -o remount /dev/pts

and the problems went away. I didn't "lose" any PTY devices from /dev/pts after remounting, so it seems a pretty safe operation.