Bug 711175

Summary: mock ptys error
Product: [Fedora] Fedora EPEL Reporter: Levente Farkas <lfarkas>
Component: mockAssignee: Clark Williams <williams>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: el6CC: herrold, mebrown, williams
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-07-22 08:37:10 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 714137    
Attachments:
Description Flags
python test case for using pty's
none
Patch to comment out 'newinstance' mount modifier for devpts filesystem mount none

Description Levente Farkas 2011-06-06 17:58:47 UTC
binutils-2.20.51.0.2-5.20.el6 can't be rebuild on rhel-6.1 since during the test it seems there's another pty problem:
---------------------------------
                === gas tests ===
Schedule of variations:
    unix
Running target unix
Using /usr/share/dejagnu/baseboards/unix.exp as board description file for target.
Using /usr/share/dejagnu/config/unix.exp as generic interface file for target.
Using /builddir/build/BUILD/binutils-2.20.51.0.2/gas/testsuite/config/default.exp as tool-and-target-specific interface file.
Running /builddir/build/BUILD/binutils-2.20.51.0.2/gas/testsuite/gas/all/gas.exp ...
ERROR: tcl error sourcing /builddir/build/BUILD/binutils-2.20.51.0.2/gas/testsuite/gas/all/gas.exp.
ERROR: The system has no more ptys.  Ask your system administrator to create more.
    while executing
"spawn -noecho -nottycopy cat gas.out"
    (procedure "gas_start" line 13)
    invoked from within
"gas_start "comment.s" "-al""
    (procedure "do_comment" line 7)
    invoked from within
"do_comment"
    ("default" arm line 2)
    invoked from within
"case $target_triplet in {
    { m32c-*-* } { }
    default {
        do_comment
    }
}"
    (file "/builddir/build/BUILD/binutils-2.20.51.0.2/gas/testsuite/gas/all/gas.exp" line 151)
    invoked from within
"source /builddir/build/BUILD/binutils-2.20.51.0.2/gas/testsuite/gas/all/gas.exp"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 source /builddir/build/BUILD/binutils-2.20.51.0.2/gas/testsuite/gas/all/gas.exp"
    invoked from within
"catch "uplevel #0 source $test_file_name""
make[4]: Leaving directory `/builddir/build/BUILD/binutils-2.20.51.0.2/gas'
make[3]: Leaving directory `/builddir/build/BUILD/binutils-2.20.51.0.2/gas'
send: spawn id exp0 not open
    while executing
"send_user "$message\n""
    ("default" arm line 2)
    invoked from within
"case "$firstword" in {
        {"PASS:" "XFAIL:" "KFAIL:" "UNRESOLVED:" "UNSUPPORTED:" "UNTESTED:"} {
            if $all_flag {
                send_user "$message\n"
                return "..."
    (procedure "clone_output" line 10)
    invoked from within
"clone_output "Running $test_file_name ...""
    (procedure "runtest" line 9)
    invoked from within
"runtest $test_name"
    ("foreach" body line 42)
    invoked from within
---------------------------------

Comment 1 Levente Farkas 2011-06-06 18:03:30 UTC
the same happened with perl-IO-Tty-1.08-4.el6 with different error:


Checking for appropriate ioctls: TIOCNOTTY TIOCSCTTY
Checking that returned fd's don't clash with stdin/out/err...
trying posix_openpt()...
trying grantpt()...
IO::Tty::pty_allocate(nonfatal): grantpt(): No such file or directory at /builddir/build/BUILD/IO-Tty-1.08/blib/lib/IO/Pty.pm line 24.
trying unlockpt()...
trying ptsname_r()...
IO::Tty::open_slave(nonfatal): ptsname_r(): No such file or directory at /builddir/build/BUILD/IO-Tty-1.08/blib/lib/IO/Pty.pm line 24.
trying to open /dev/pts/1...
IO::Tty::open_slave(nonfatal): open(/dev/pts/1): No such file or directory at /builddir/build/BUILD/IO-Tty-1.08/blib/lib/IO/Pty.pm line 24.
pty_allocate(nonfatal): posix_openpt(): No such file or directory at /builddir/build/BUILD/IO-Tty-1.08/blib/lib/IO/Pty.pm line 24.
trying getpt()...
trying grantpt()...
IO::Tty::pty_allocate(nonfatal): grantpt(): No such file or directory at /builddir/build/BUILD/IO-Tty-1.08/blib/lib/IO/Pty.pm line 24.
trying unlockpt()...
trying to open /dev/pts/1...
IO::Tty::open_slave(nonfatal): open(/dev/pts/1): No such file or directory at /builddir/build/BUILD/IO-Tty-1.08/blib/lib/IO/Pty.pm line 24.
pty_allocate(nonfatal): getpt(): No such file or directory at /builddir/build/BUILD/IO-Tty-1.08/blib/lib/IO/Pty.pm line 24.
trying openpty()...
pty_allocate(nonfatal): openpty(): No such file or directory at /builddir/build/BUILD/IO-Tty-1.08/blib/lib/IO/Pty.pm line 24.
trying /dev/ptmx...
trying grantpt()...
IO::Tty::pty_allocate(nonfatal): grantpt(): No such file or directory at /builddir/build/BUILD/IO-Tty-1.08/blib/lib/IO/Pty.pm line 24.
trying unlockpt()...
trying to open /dev/pts/1...

Comment 2 Clark Williams 2011-06-17 14:01:34 UTC
I'm experimenting with using pty's as the communications device between the chroot application and mock (currently using pipe's to grab the output of the program's running in the chroot). I'm hoping that setting up the chroot with a pty as stdin/stdout/stderr will help somewhat.

It's *possible* that this will fix some of the errors seen by applications trying to access a pty, but I don't think it will fix everything. Any suggestions are welcome.

Comment 3 Levente Farkas 2011-06-17 20:00:02 UTC
the only thing i don't understand how these packages build for fedora? why not the same pty error occur during koji build?

Comment 4 Clark Williams 2011-06-22 14:36:52 UTC
It's quite likely that this is host-system dependent behavior. On what host OS are you building and seeing failures? (My guess is that the builders are running older Fedora and may not be running into this).

Comment 5 Levente Farkas 2011-06-22 15:33:51 UTC
i try to rebuild it on rhel-6.0 host with rhel-6.1 mock-1.1.10 and the error happened...

Comment 6 Clark Williams 2011-06-22 15:49:52 UTC
Created attachment 506046 [details]
python test case for using pty's

This is a small python script that calls os.openpty() and then uses the resulting pseudo-terminals to get information from an 'ls' program.  Currently fails to run inside mock due to ENODEV error when opening ptys.

Comment 7 Clark Williams 2011-06-22 15:52:25 UTC
I have been trying the script attached in #c6 both interactively with --shell and in batch mode with --chroot. Not sure why openpty is returning ENODEV, but looking at pty_open() in the kernel, it seems like the only reason would be if the tty device was invalid. Not sure what would cause that though. It looks like mock has the devpts filesystem mounted inside the chroot on /dev/pts. 

Hmmm, I wonder if devpts allows multiple mount instances?

Comment 8 Clark Williams 2011-06-22 16:08:43 UTC
Created attachment 506053 [details]
Patch to comment out 'newinstance' mount modifier for devpts filesystem mount

During interactive testing, I tried mounting the devpts filesystem *without* using the 'newinstance' mount modifier and got my pty-test.py program to run. 

This patch comments out the logic in backend.py which detects kernels >= 2.6.29 and adds the 'newinstance' modifier to the devpts mount command.

Comment 9 Clark Williams 2011-06-22 16:23:28 UTC
Levente, any chance you can try the above patch?

Comment 10 Levente Farkas 2011-06-22 16:31:30 UTC
perl-IO-Tty-1.08-4.el6 build:-) and the biggest problem was nss and zsh, but it takes longer to build...
imho if all working then this patch worth for a new mock release!:-)

Comment 11 Clark Williams 2011-06-22 16:38:07 UTC
Agreed. 

Re-reading the kernel notes about "newinstance" I suspect that it only makes sense when you mount it for private purposes, not for general use (like inside the chroot). 

I've got a couple of minor fixes queued up, but if this cleans up our PTY issues I'll push it into 1.1.11 as quick as I can. :)

Comment 12 Clark Williams 2011-06-22 16:48:20 UTC
oh, and a 1.0.18 for epel-5

Comment 13 Levente Farkas 2011-06-22 19:10:14 UTC
both nss and zsh compile:-)
go ahead with a new release!

Comment 14 Clark Williams 2011-06-22 19:56:32 UTC
added to my work branch and starting the release process now.

Comment 15 Clark Williams 2011-06-23 00:41:43 UTC
I've just built mock 1.1.11 which removes the 'newinstance' mount modifier for
the devpts filesystem inside the chroot. I believe this is what was causing pty
failures inside the chroot.

Comment 16 Petr Pisar 2011-06-23 06:24:43 UTC
*** Bug 714137 has been marked as a duplicate of this bug. ***