Your actual problem looks due to missing /dev/tty
what is the output of
ls -l /dev/tty
Are you running this from the terminal on the RPI. How did you install ? Did you start from the minimal Jessie image or the full image ? Have you customised the set up in any way ?