LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 03-08-2005, 08:44 PM   #1
darcon3k
LQ Newbie
 
Registered: Aug 2003
Distribution: Gentoo
Posts: 18

Rep: Reputation: 0
screen error "no more PTYs"


I'm trying to run screen (version 4.0.2-i486-1) on my slackware box, it used to work fine before but now if I launch it as a user (works fine as root) I get these messages

no more PTYs
Sorry, could not find a PTY
[screen is terminating]

Last edited by darcon3k; 03-12-2005 at 04:01 PM.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 03-08-2005, 08:58 PM   #2
Matir
Moderator
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 117Reputation: 117
Apparently it's looking to allocate ptys. Most likely it's a question of permissions on the /dev/pty* devices. Most likely, they should be 666, I believe.
 
Old 03-08-2005, 09:38 PM   #3
darcon3k
LQ Newbie
 
Registered: Aug 2003
Distribution: Gentoo
Posts: 18

Original Poster
Rep: Reputation: 0
Thx for the help Matir, I just checked /dev and theres 257 entries for pty* is this normal? How could I have run out? lol
here's an excerpt of "ls -l /dev/pty*"
Code:
lrwxrwxrwx  1 root root 6 2005-03-08 10:17 /dev/ptya0 -> pty/m0
lrwxrwxrwx  1 root root 6 2005-03-08 10:17 /dev/ptya1 -> pty/m1
lrwxrwxrwx  1 root root 6 2005-03-08 10:17 /dev/ptya2 -> pty/m2
lrwxrwxrwx  1 root root 6 2005-03-08 10:17 /dev/ptya3 -> pty/m3
lrwxrwxrwx  1 root root 6 2005-03-08 10:17 /dev/ptya4 -> pty/m4
all of them have permission 777 so I don't think its a permissions issue, but at then end of the list there's a space and then this
Code:
/dev/pty:
total 0
crw-rw----  1 root root 2, 175 2005-03-08 10:17 m
crw-rw----  1 root root 2, 160 2005-03-08 10:17 m0
crw-rw----  1 root root 2, 161 2005-03-08 10:17 m1
crw-rw----  1 root root 2, 162 2005-03-08 10:17 m2
theres a total of 22 entries like those above with permission 660, but I'm not sure why entries named m, m0,m1,etc... are showing up when I typed pty* ?
 
Old 03-10-2005, 04:36 PM   #4
darcon3k
LQ Newbie
 
Registered: Aug 2003
Distribution: Gentoo
Posts: 18

Original Poster
Rep: Reputation: 0
Here's part of my /etc/udev/rules.d/udev.rules
Code:
# pty devices
KERNEL="ptmx",                  NAME="%k", GROUP="tty", MODE="0666"
KERNEL="pty[p-za-e][0-9a-f]*",  NAME="pty/m%n", SYMLINK="%k", GROUP="tty"
KERNEL="tty[p-za-e][0-9a-f]*",  NAME="pty/s%n", SYMLINK="%k", GROUP="tty"
So if I understand this right, all the pty devices should be set to 0666 by udev, but when I "ls -l /dev" it shows that they're all lrwxrwxrwx which is 777?

Also I tried adding myself to the tty group but that didn't help

Last edited by darcon3k; 03-10-2005 at 08:49 PM.
 
Old 03-13-2005, 04:09 PM   #5
darcon3k
LQ Newbie
 
Registered: Aug 2003
Distribution: Gentoo
Posts: 18

Original Poster
Rep: Reputation: 0
finally found the solution, just had to
Code:
chmod 666 /dev/ptmx
hopefully this helps someone else


Edit: next problem I had was after starting screen the only command that worked was cd, every other command resulted in "write error: Bad file descriptor"

the solution was
Code:
chmod 666 /dev/null

Last edited by darcon3k; 03-13-2005 at 04:56 PM.
 
Old 06-16-2008, 09:33 PM   #6
serg.kr
LQ Newbie
 
Registered: Jul 2007
Distribution: Debian
Posts: 15

Rep: Reputation: 2
Had a similar problem and found this on google. Unfortunately, changing the permissions did not help in my case. I was able to get screen working after running this command:

Code:
mount -t devpts /dev/ptmx /dev/pts
I'm not entirely sure how or why this worked for me. I surmised this solution after reading this page:

http://www.linuxfromscratch.org/pipe...ay/017234.html

Can anyone explain why this works?
 
3 members found this post helpful.
Old 06-23-2008, 06:27 AM   #7
Genotix
LQ Newbie
 
Registered: Jun 2008
Posts: 2

Rep: Reputation: 1
SCO 5 and PTY limitation in SCREEN

Running SCO 5 at work I discovered a limitation to the screen command.
Only 99 PTY's could be used; having over 250 users, this was an issue.

Note that this issue will probably also occur using BSD and other Unix variants

The reason I wanted this much screens is for a session reliability construction.
(Out remote locations had some problem with internet and the local power supplier)

I kept getting:

No more PTYs
followed by
Sorry, could not find a PTY.

Having browsed through the code I've found a strange piece of code for trying different pty's. The code can be found in the original pty.c file.

Below the diff file(s) to limit to number of PTY's through a setting in in the config.h

pty.c
Code:
< static char PtyProto[] = "/dev/ptypXY";
< static char TtyProto[] = "/dev/ttypXY";
---
> static char PtyProto[] = "/dev/ptyp";
> static char TtyProto[] = "/dev/ttyp";
341c356
<   register int f;
---
>   register int f, x;
342a358
>   // This style is used for our SCO unix environment
344,352c360,361
<   strcpy(PtyName, PtyProto);
344,352c360,361
<   strcpy(PtyName, PtyProto);
<   strcpy(TtyName, TtyProto);
<   for (p = PtyName; *p != 'X'; p++)
<     ;
<   for (q = TtyName; *q != 'X'; q++)
<     ;
<   for (l = PTYRANGE0; (*p = *l) != '\0'; l++)
<     {
<       for (d = PTYRANGE1; (p[1] = *d) != '\0'; d++)
---
> 
>    for (x = 1; x <= PTYMAX; x++)
354,369c363
<         debug1("OpenPTY tries '%s'\n", PtyName);
<         if ((f = open(PtyName, O_RDWR | O_NOCTTY)) == -1)
<           continue;
<         q[0] = *l;
<         q[1] = *d;
<         if (eff_uid && access(TtyName, R_OK | W_OK))
<           {
<             close(f);
<             continue;
<           }
< #if defined(sun) && defined(TIOCGPGRP) && !defined(SUNOS3)
<         /* Hack to ensure that the slave side of the pty is
<          * unused. May not work in anything other than SunOS4.1
<          */
<           {
<             int pgrp;
---
>                 debug1("OpenPTY tries '%s'\n", PtyName);
371,378c365,377
<             /* tcgetpgrp does not work (uses TIOCGETPGRP)! */
<             if (ioctl(f, TIOCGPGRP, (char *)&pgrp) != -1 || errno != EIO)
<               {
<                 close(f);
<                 continue;
<               }
<           }
< #endif
---
>                 sprintf(PtyName, "%s%d", PtyProto, x);
>                 sprintf(TtyName, "%s%d", TtyProto, x);
>                 
>                 if ((f = open(PtyName, O_RDWR | O_NOCTTY)) == -1)
>                   continue;
>                 Msg(0, "Got PTY '%s'\n", PtyName);
> 
>                 if (eff_uid && access(TtyName, R_OK | W_OK))
>            {
>                     close(f);
>                     continue;
>            }
> 
383,384d381
<     }
<   return -1;

In order to compile correctly I needed to change the os.h file too:
os.h
Code:
131c131
< # define ftruncate(fd, s) chsize(fd, s)
---
> //# define ftruncate(fd, s) chsize(fd, s)
After running configure I also needed to add the PTYMAX value to my generated config file
and I modified the MAXWIN value:

config.h
Code:
39c39
< # define MAXWIN 1800
---
> # define MAXWIN 40
664c664
< 
---
> #define PTYMAX 1800

Last edited by Genotix; 06-23-2008 at 06:55 AM.
 
Old 11-26-2008, 09:05 AM   #8
clustermagnet
LQ Newbie
 
Registered: Nov 2008
Posts: 4

Rep: Reputation: 0
Quote:
Originally Posted by serg.kr View Post
Had a similar problem and found this on google. Unfortunately, changing the permissions did not help in my case. I was able to get screen working after running this command:

Code:
mount -t devpts /dev/ptmx /dev/pts
I'm not entirely sure how or why this worked for me. I surmised this solution after reading this page:

http://www.linuxfromscratch.org/pipe...ay/017234.html

Can anyone explain why this works?
Guys, could someone explain? This actually only is the fix for non-root users. Root never had the issue in the first place.

Thanks!
 
Old 11-27-2008, 02:34 AM   #9
Genotix
LQ Newbie
 
Registered: Jun 2008
Posts: 2

Rep: Reputation: 1
Quote:
Originally Posted by clustermagnet View Post
Guys, could someone explain? This actually only is the fix for non-root users. Root never had the issue in the first place.

Thanks!
Seems to that this fix works when screen expects to
get it's pty's from another location.
By mounting the real location to the 'expected' location screen can appearantly retrieve it's pty's successfully.
 
1 members found this post helpful.
Old 01-28-2010, 11:55 AM   #10
Bamm
LQ Newbie
 
Registered: Jan 2010
Posts: 1

Rep: Reputation: 0
Talking Mac solution

When you google "sorry could not find pty" this is the first site that pops up. As I got this error in terminal on my Mac I thought I would post my simple solution, add sudo in front of your command and your good to go. Hope this helps someone...
 
Old 04-19-2011, 04:30 PM   #11
moggie
LQ Newbie
 
Registered: Apr 2011
Posts: 1

Rep: Reputation: 0
I run Debian (Lenny) and was having the same PTY issue. The solution in my situation was to use MAKEDEV to create a new PTY in /dev as root and thereby facilitate the creation of a new session by a non-root user:

Code:
cd /dev
MAKEDEV pty
Keep in mind you will only create one pty device each time you "MAKEDEV pty", so this is likely not a solution if the number of non-root sessions active at any one time cannot be known ahead of time.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fedora Core 2: Screen Resolution can not change from "800X600" to "1024X 768" suhaimi_sj Fedora - Installation 18 12-17-2009 03:29 AM
"there are no more ptys" error!..pls help!! chakkaradeepcc Linux From Scratch 3 05-07-2005 12:48 PM
xterm not spawning "not enough ptys" sohmc Linux - General 4 09-23-2004 07:42 PM
Error: ID "x" respawing too fast (Screen Flickers) pukhtoon101 Linux - Newbie 1 10-26-2003 02:32 PM
"fatal error: no screen found" WannaLearnLinux Mandriva 13 10-17-2003 07:44 PM


All times are GMT -5. The time now is 09:13 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration