3

I've gotten a newly imaged Debian 6 32 bit VPS. While configuring I tried to test screen as a number of my scripts run using it.

Root has no problem running screen. But of course this is unacceptable.

The message I received is "No more PTY's. Sorry could not find a PTY"

I did a little googling and found it to be a common problem with permissions. I checked the permissions on /dev/ptmx and /dev/pts as well as the several /dev/ptyp* descriptors. They all had proper read/write permission

:~$ ls -l /dev/ptmx
crw-rw-rw- 1 root tty 5, 2 Jul 31 07:35 /dev/ptmx
:~$ ls -l /dev/pty*
crw-rw-rw- 1 root tty 2,  0 Jul 31 01:19 /dev/ptyp0
crw-rw-rw- 1 root tty 2,  1 Jul 31 01:19 /dev/ptyp1
crw-rw-rw- 1 root tty 2,  2 Jul 31 01:19 /dev/ptyp2

/dev/pts is mounted. From all the solutions it seems my non-root user should be able to run screen.

Is there anything else I can do?

edit:

root@:~# dpkg -l screen
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                                  Version                                                                    
ii  screen                                                4.0.3-14                                              terminal multiplexor with VT100/ANSI terminal emulation
root@:~# ls -l /usr/bin/screen
-rwxr-xr-x 1 root utmp 328508 Jul 28  2009 /usr/bin/screen
Jay
  • 149
  • 1
  • 9
  • 1
    One thing you can do would be make sure it is using `ptmx` and not those crusty old `ptyp*` devices. Since it works as root, run it as root and then run the `tty` command in the shell inside screen. It should give you an answer of `/dev/pts/`NUMBER. Also show us `dpkg -l screen` and `ls -l /usr/bin/screen` – Alan Curry Jul 31 '12 at 07:53
  • Root's tty is /dev/pts/4. – Jay Jul 31 '12 at 17:02
  • So that's one thing eliminated. Still waiting on `dpkg -l screen` and `ls -l /usr/bin/screen` and while you're at it, see if there is any other screen lurking in `/usr/local/bin` or some other place in the user's $PATH – Alan Curry Jul 31 '12 at 21:45
  • Sorry Alan for not replying. I asked my former colleague to check over the full vps config and he found an obscure permission on pt_chown which he immediately changed and remedied the situation. – Jay Aug 11 '12 at 19:57
  • 1
    I like to think I would have got that after a few more questions... – Alan Curry Aug 11 '12 at 22:50
  • 1
    I'm sure you would have and would have saved me the cost of lunch haha. – Jay Aug 13 '12 at 17:47

2 Answers2

3

After some investigation with my old colleague he pointed out that there was a problem with pt_chown permissions.

This is the solution for Centos 5/6 and Debian that may also incur this weird problem mostly on VPS images.

I didn't record the initial permissions of pt_chown but after changing them via this command my PTY issue has been solved.

chmod u=rwxs,g=rx,o=rx /usr/libexec/pt_chown; #/usr/lib/pt_chown on debian 6
chown root:root /usr/libexec/pt_chown; #/usr/lib/pt_chown on debian 6
Jay
  • 149
  • 1
  • 9
1

For me (vps on an openVz host) the following do the trick:

cd /dev
sudo MAKEDEV ptyp ptyq
sucotronic
  • 111
  • 6