Server Setup

The system has no more ptys? How to fix it.

by ,

We have by far the largest RPM repository with NGINX module packages and VMODs for Varnish. If you want to install NGINX, Varnish, and lots of useful performance/security software with smooth yum upgrades for production use, this is the repository for you.
Active subscription is required.

Maybe you’re like me and using an expect script that works in one machine and fails in another. Or maybe you’re doing something else but still getting this error:

Problem: The system has no more ptys. Ask your system administrator to create more.

Google search returns weird advices from Linux from Scratch followers. But we are using stock CentOS 7.

It comes out that things are related to mount options of devpts (which maybe different between different hosting providers). Try to run cat /proc/mounts.

In a machine with the problem, you would see something like this:

devpts /dev/pts devpts rw,relatime,mode=600,ptmxmode=000 0 0

Where as the same script will run fine on a machine with:

devpts /dev/pts devpts rw,seclabel,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0

So what you need is to ensure that devpts is mounted with mode 620 for things to work smoothly.
Fire up your favorite terminal editor and make sure that devpts entry is such:

devpts /dev/pts devpts defaults,gid=5,mode=620 0 0

You have to either change the existing one or add new entry, if it’s not present.

Apply the change with:

mount /dev/pts -o remount

Now back to writing scripts, you Linux hacker 🙂

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: