expect: The system has no more ptys

if executing command below yields: The system has no more ptys.

1
expect -c "spawn passwd root"

we can check whether /dev/ptmx exists, if not, just create it:

1
2
mknod /dev/ptmx c 5 2
chmod 666 /dev/ptmx

refer to:
https://www.linuxfromscratch.org/lfs/faq.html#no-ptys