I have been using this box ubuntu 16.04 box hosted in vSphere every workday for last half a year. I'm connecting to it from Windows with putty/kitty. Today, I was greeted by the message similar to one in this question.
I'm not sure what caused it. Here is the message:
Authenticating with public key "imported-openssh-key"
Server refused to allocate pty
Welcome to Ubuntu 16.04.4 LTS (GNU/Linux 4.4.0-116-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
0 packages can be updated.
0 updates are security updates.
I preserved the formatting as it was printed out.
This answer resolves the problem, but then I have to enter the command given every reboot:
mount devpts /dev/pts -t devpts
Adding an fstab line as shown at the link also given in one of the original question answers does not seem to change anything.
To be honest I have no idea why I did not need to mount this device up until now and then suddenly it stopped working and I need this mount.
What is the proper way to fix this issue for me so that I do not need to mount this after every reboot manually? Happy to provide logs or other diagnostics you might request.
Update
So In initially I dealt with the problem by rebuilding the box, but now it happened again and it started happening to other machines I manage too.
To follow Filipe's answer.
Running gzip -dc /boot/initrd.img-$(uname -r) | cpio -i --quiet --to-stdout init | grep devpts gives
mount -t devpts -o noexec,nosuid,gid=5,mode=0620 devpts /dev/pts || true
Running gzip -dc /boot/initrd.img-$(uname -r) | cpio -i --quiet --to-stdout scripts/init-bottom/udev | grep move gives
# move the /dev tmpfs to the rootfs
mount -n -o move /dev ${rootmnt}/dev
Running with "debug" switch gives this output.
Anything else I can do to find the root cause of the issue?
Regenerating with sudo update-initramfs -c -k $(uname -r) did not produce any visible changes after reboot.
This is what I can see in mtab before and after mounting devpts manually:
>sudo cat /etc/mtab | grep devpts
devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=666 0 0
>sudo mount devpts /dev/pts -t devpts
>sudo cat /etc/mtab | grep devpts
devpts /dev/pts devpts rw,nosuid,noexec,relatime,mode=600,ptmxmode=000 0 0
devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=666 0 0
devpts /dev/pts devpts rw,relatime,mode=600,ptmxmode=000 0 0