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
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 🙂