Linux - SoftwareThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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*"
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* ?
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
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"
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:
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
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:
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.
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...
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.