PTY allocation request failed on channel 0

20/02/2009

Yesterday, I was trying to login to my machine and I got the following message:

PTY allocation request failed on channel 0

My prompt was stuck and I could not enter commands. This happened because -for some reason- the tty related devices(/dev/ptmx, /dev/pts) were not created or mounted on my machine. In order to get this problem resolved, I created and mounted the missing devices using the following commands:

rm -rf /dev/ptmx
mknod /dev/ptmx c 5 2
chmod 666 /dev/ptmx
umount /dev/pts
rm -rf /dev/pts
mkdir /dev/pts
mount /dev/pts

In order to be able to execute commands you will have to login to your machine(isn’t this supposed to be the original problem :) ).
This will do the trick:

ssh user@host "/bin/bash -i"

My VPS is built on openVZ but I have seen this problem occur also in XEN machines.
Leave me a comment if this works for you!

There are 18 comments in this article:

  1. 11/04/2009spott say:

    Thanks for tip. Its work to me also. I have the similar problem with my OpenVZ VPS today.

  2. 12/05/2009toto say:

    YEAH
    WOrked for me too.
    thank you very much !

  3. 14/05/2009Thomas Krichel say:

    Yes, have the same issue. I think I cleared pty or something like that last time it happened. But your bash -i gets me into the box!

  4. 1/06/2009Zerial say:

    mount /dev/pts: Can’t found /dev/pts on /etc/fstab or /etc/mstab

    Now, I don’t have tty.

  5. 1/06/2009Zerial say:

    I’ve solved it adding:

    none /dev/pts devpts defaults 0 0

    into /etc/fstab

    thanks

  6. 9/06/2009itsec say:

    I needed to install install package udev in domU to get it working.

  7. 21/06/2009Saravia say:

    Just what I was looking for. Thank you! Bookmark added for sure :D

  8. 24/06/2009Jason Liu say:

    Thanks for the post. This works on my CentOS machine too.

  9. 12/08/2009rc say:

    YOU SAVED MY LIFE!!! THANKS!!!

  10. 4/10/2009J. Piel say:

    user@host “/bin/bash -i” <– Freaking Brilliant!
    This got my ptmx created, but it was gone on the next reboot. No matter, I was able to get work done until my VPS provider fixed it.

    Thank you much for sharing the knowledge!

  11. 15/11/2009joo say:

    BRILLIANT. Thanks!!

  12. 12/12/2009Create Centos5 DomU on Debian Etch Dom0 » 月影鹏鹏 say:

    [...] Booted up ok then. More issues however with "PTY allocation request failed on channel 0". Reading http://www.asteriosk.gr/blog/2009/02/20/pty-allocation-request-failed-on-channel-0/ including the comments got that resolved. I could ssh in ok, but the xm console did not work. More [...]

  13. 21/01/2010Sebastian say:

    THX!

    Great!

    I had this Problem after changing the broken disk of a mdadm raid1 on a real system.

  14. 28/01/2010JamesGT say:

    This worked for me also, but I had to ad the line to the fstab file as indicated by Zerial. This was on a Slackware VPS with OpenVZ.

    This started when I upgraded Slackware 12 to 12.2 in OpenVZ via slackpkg. Looks to be good now.

    Thanks!

  15. 7/02/2010Craig Nakamoto say:

    Thanks, this worked for me too on an older server running CentOS 4.2.

  16. 18/02/2010dude say:

    thanks a bunch, my vps provider doesn’t support archlinux so I’m glad to have found this fix! cheers

  17. 20/02/2010Nepto say:

    Thank you. You just saved my ass ;-)

  18. 12/03/2010Dongsheng say:

    Thanks a lot!

    fixed my problem :-)

Write a comment: