LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (http://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   expect -c "spawn ls" The system has no more ptys (http://www.linuxquestions.org/questions/linux-from-scratch-13/expect-c-spawn-ls-the-system-has-no-more-ptys-504853/)

status1 11-25-2006 06:12 PM

expect -c "spawn ls" The system has no more ptys
 
Hello,
I am building LFS for the first time using the book and the Livecd 6.0
I finally got through installing glibc at chapter 6 after
a few tries and retries and now I have a problem at installing binutils in chapter 6.13.1
At the expect -c "spawn ls" command I get the error that is in the book "the system has no more ptys"
I looked at some of the posts here but I did not find a solution that I can apply to my case
The book says that the chroot environment is not set up for proper PTY operation.
Can someone expand on that to point me in the right direction.
Is it a certain part of the environment ?
Is there a way to check how many ptys the system needs or has ?

Daws 11-25-2006 07:47 PM

Hello,

I believe this is what you are looking for:

http://www.linuxfromscratch.org//lfs/faq.html#no-ptys

The worst case scenario is recompiling the host system's kernel which isn't too bad.

Cheers

***EDIT***

Hang on a sec you're using the live cd ... that's odd the live cd should be set up properly.
Well you cant recompile the live cd so if the "mknod" instructions don't work then you may want to try the latest version of the live cd (6.2 I believe)

***EDIT***

druuna 11-26-2006 05:18 AM

Hi,

This is a /dev related problem (the 'skipping' of populating dev, as stated in a previous post).

Daws is correct, this message should not happen when you use the liveCD as base. You could try Daws link, but I wonder what else will show up.

status1 11-26-2006 09:03 AM

Hello,
It seems a little bit confusing to me at the moment.

In the book at chapter 5.13.1 Re-innstallation of GCC when the expect command is used for the first time it says that if I get that message "the system has no more ptys" it says that the HOST does not have it's ptys set up properly.

I did not get that message at that time so I am assuming that the host has
enough ptys or it has the ptys set up properly

So now that I am running the expect command in the chroot environment
at chapter 6.13.1 and I get that message the book says that " the CHROOT environment is not set up for proper pty operation"

What does pty need for proper operation ?
Is there a way to look at the host to see how the pty is set up just for me to get an idea of what a proper pty should look like ?


So from that I am assuming that the host pty is ok or it's not even checking
it although there is no way to tell where it is looking for the ptys.

So I am just guessing here but that link is for the first use of expect

I mean if it was fixed once in chapter 5 why would it happen again or if
it happens now why would I need to fix the host ptys if it worked before ?

So it seems that it has something to do with the chroot environment and not the host I just don't know where or what to look for.

Daws 11-26-2006 09:52 AM

Quote:

This is a /dev related problem (the 'skipping' of populating dev, as stated in a previous post).
Well if this is the case then entering (as per the book)

Code:

mount --bind /dev $LFS/dev
before entering the chroot environment should fix it

status1 11-26-2006 01:34 PM

Hello,
I tried that command but it has no effect.
I still have the same error

Just wanted to add that the command is not in the book (v6.0)
Not that it makes any difference

Daws 11-26-2006 01:56 PM

Sorry my fault that particular command is in versions 6.2 and later, I forgot you were following 6.0.

Well according to the instructions you need /dev/ptmx and a directory called /dev/pts so from inside chroot

Code:

mknod /dev/ptmx c 5 2 &&
chmod 666 /dev/ptmx &&
mkdir /dev/pts &&
chmod 755 /dev/pts

then remount the devpts filesystem

Code:

mount -t devpts -o gid=4,mode=620 none /dev/pts
This assumes you have gone through all the necessary steps to enter the chroot environment, in particular fake mounting devpts.

If this doesn't work then something else v weird is going on or you made a typo somewhere.

status1 11-26-2006 02:42 PM

Hello,
Actually something did happen after entering the "mount --bind /dev $LFS/dev"
command.
I have a lot of ttys (about 63) and a bunch of other files none of which I had before
Is that normal ?
Also the ptmx was created which I did not have before.

"Well according to the instructions" Is this from 6.2 also ? I don't hav that in 6.0
I just want to make sure I understand your instructions.
So after entering chroot are those the only commands I should enter or are those in addition to what I am supposed to enter according to 6.0 ?

If this is in addition to the commands in 6.0 this may or may not be important but do I enter those commands before or after the
"mount -n -t ramfs none /dev" command ?
Because it tends to hide the mknod files if I enter it before.

status1 11-26-2006 03:15 PM

Hello,
Well those last instructions seem to have worked.
I put in only those commands an tried it and it worked but if I add the rest of the commands it doesn't work again just as I suspected because everything is hidden by the "mount -n -t ramfs none /dev" command

So I am not sure if I need the rest of the commands from the book or maybe just a few.

Daws 11-26-2006 05:15 PM

Hello again,

Quote:

"Well according to the instructions" Is this from 6.2 also
Sorry I guess my post was a bit ambiguous, to clarify, these were from the lfs FAQ, not the book, it's the link I gave when I first replied.

Quote:

Originally Posted by me
This assumes you have gone through all the necessary steps to enter the chroot environment, in particular fake mounting devpts

.

Again sorry, I could have been more specific.

There are certain commands to run EVERYTIME you want to enter the chroot environment.

This is direct from the 6.0 version:

Before chrooting:

Code:

mount -t proc proc $LFS/proc
mount -t sysfs sysfs $LFS/sys
mount -f -t ramfs ramfs $LFS/dev
mount -f -t tmpfs tmpfs $LFS/dev/shm
mount -f -t devpts -o gid=4,mode=620 devpts $LFS/dev/pts (This is the fake mounting of devpts)

After chrooting go through 6.8.1 and 6.8.2 again to populate dev properly

Quote:

If this is in addition to the commands in 6.0 this may or may not be important but do I enter those commands before or after the
"mount -n -t ramfs none /dev" command ?
You would want to do it after that (after doing section 6.8.2 in fact)

Hope you get it sorted.

ps. congrats on 100 posts

status1 11-27-2006 06:40 PM

Hello,
Yes it was clear up to the point of entering chroot . I do those EVERYTIME

It's at 6.8.1 and 6.8.2 that I wanted to make sure I put it in the right order
So I understand that I would have to enter those commands EVERYTIME also ?

"(after doing section 6.8.2 in fact)"
Ammm... I already have a "mount -t devpts -o gid=4,mode=620 none /dev/pts"
as part of 6.8.2.
Should I just skip over that line and place it at the end ?
I imagine I would have to skip over "mkdir /dev/pts" also .

PhillipHuang 02-27-2008 09:06 PM

Hello,

I have the same problem in LFS6.3.
(http://www.linuxfromscratch.org/lfs/.../binutils.html).

Later I fix it with the following steps.

1. In original Linux system, log on as root,and check the mount list. for example:
Code:

[root@lfstest local]# mount
/dev/hda1 on / type ext3 (rw)
none on /proc type proc (rw)
none on /sys type sysfs (rw)
none on /dev/pts type devpts (rw,gid=5,mode=620)
none on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
/dev/hda3 on /mnt/lfs type ext3 (rw)

Obviously, no directory on $LFS(which is /mnt/lfs in my system) has been mounted. Now you should to double check if all virtual kernel file system on $LFS have been mounted. If not,

Code:

mount -v --bind /dev $LFS/dev
mount -vt devpts devpts $LFS/dev/pts
mount -vt tmpfs shm $LFS/dev/shm
mount -vt proc proc $LFS/proc
mount -vt sysfs sysfs $LFS/sys

Now, check again:
Code:

[root@lfstest local]# mount
/dev/hda1 on / type ext3 (rw)
none on /proc type proc (rw)
none on /sys type sysfs (rw)
none on /dev/pts type devpts (rw,gid=5,mode=620)
none on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
/dev/hda3 on /mnt/lfs type ext3 (rw)
/dev on /mnt/lfs/dev type none (rw,bind)
devpts on /mnt/lfs/dev/pts type devpts (rw)
shm on /mnt/lfs/dev/shm type tmpfs (rw)
proc on /mnt/lfs/proc type proc (rw)
sysfs on /mnt/lfs/sys type sysfs (rw)

2. Chroot operation,
Code:

[root@lfstest local]# chroot "$LFS" /tools/bin/env -i \
>    HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
>    PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
>    /tools/bin/bash --login +h

3. In the new root, it is fixed the "PTY" problem.
Code:

root:/# expect -c "spawn ls"
spawn ls


Hope it helpful.

Phillip

MannyNix 03-29-2008 08:51 PM

Hi, I had the same problem in LFS6.3
When i saw:
Code:

expect -c "spawn ls"
The system has no more ptys.
Ask your system administrator to create more.

I just rebooted and continued from:
From section 6.2. Mounting Virtual Kernel File Systems to section 6.8.Populating /dev on: http://www.linuxfromscratch.org/hint...and-resume.txt

Seems it did the trick, hope it helps too :)


All times are GMT -5. The time now is 04:53 PM.