Unable to get tty name: Bad file descriptor

Posted by admin     Category: VPS Management

You may receive an error as “Unable to get tty name: Bad file descriptor” while accessing a VPS from the host server. The problem occur when some files from /lib directory of the VPS goes missing. See example below:

root@hostserver:/# vzctl enter VEID
entered into CT VEID
Unable to get tty name:
Bad file descriptor
root@VEID:/#

In this case, you will either have to copy the /lib directory from a different VPS of the same template

# cp -R /vz/root/VEID1/libĀ  /vz/root/VEID/

(where, VEID1 is the VPS ID of a different VPS using the same OS template)

OR extract the respective OS template and copy the /lib directory from it:

# tar -zxf /vz/template/cache/os_template.tar.gz
# cp -R /vz/template/cache/lib /vz/root/VEID/

Reboot the VPS

# vzctl restart VEID