Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 672713 - mock chroot hangs when accessing /dev/tty
Summary: mock chroot hangs when accessing /dev/tty
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: mock
Version: 14
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
Assignee: Clark Williams
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-01-25 23:52 UTC by Carl Roth
Modified: 2013-01-10 06:25 UTC (History)
5 users (show)

Fixed In Version: mock-1.1.10-1.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-05-25 02:45:23 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Carl Roth 2011-01-25 23:52:09 UTC
Description of problem:

Mock builds that access /dev/tty no longer work, e.g. for reading gnupg pass phrases.

I think this is a regression introduced by BUG609201, and mock changeset d250bd4ea6dfd8b34be567bcf7a14603476dc961.

Version-Release number of selected component (if applicable):

mock-1.1.8

How reproducible:

Always

Steps to Reproduce:
1. set up a mock chroot
2. set up a gpg keyring inside the chroot
3. copy an RPM file into the chroot
4. try to sign it with something like

   > rpm --define '_gpg_name xxxxxx' --addsign *.rpm
  
Actual results:

The rpm command hangs; the "enter pass phrase" prompt is never shown.

Expected results:

Access to /dev/tty should work just like outside the chroot, and the RPM signing command should work.

Additional info:

This used to work for prior versions of mock.

I straced the command and I see that the rpm signing code is actually sending the "enter pass phrase" prompt, albeit to a FD that is not being monitored.

If I revert the aforementioned change in the chroot, with

  # /bin/rm /dev/tty
  # /bin/mknod /dev/tty c 5 0

then the rpm --addsign command works again.

Comment 1 Paul Howarth 2011-02-14 13:38:28 UTC
The failure of perl-Expect to build in the Fedora 15 mass rebuild also seems to be down to this problem:

http://koji.fedoraproject.org/koji/taskinfo?taskID=2794455
http://koji.fedoraproject.org/koji/getfile?taskID=2796099&name=build.log

A local mock build with 1.1.8 fails in the same way, but reverting the change d250bd4ea6dfd8b34be567bcf7a14603476dc961 results in a successful build as before.

Comment 2 Clark Williams 2011-02-14 15:28:43 UTC
Paul, 

After the revert, do you actually *have* /dev/tty in the chroot (and if so is it a special device file) or is it non-existant?

Comment 3 Paul Howarth 2011-02-14 15:48:02 UTC
It's a char special device:

$ ls -l /var/lib/mock/city-fan-rawhide-x86_64/root/dev
total 64
crw-------. 1 root root 5, 1 Feb 14 15:45 console
lrwxrwxrwx. 1 root root   13 Feb 14 15:45 fd -> /proc/self/fd
crw-rw-rw-. 1 root root 1, 7 Feb 14 15:45 full
crw-rw-rw-. 1 root root 1, 3 Feb 14 15:45 null
lrwxrwxrwx. 1 root root   13 Feb 14 15:45 ptmx -> /dev/pts/ptmx
drwxrwxr-x. 2 root root 4096 Feb 14 15:45 pts
crw-rw-rw-. 1 root root 1, 8 Feb 14 15:45 random
drwxrwxr-x. 2 root root 4096 Feb 14 15:45 shm
lrwxrwxrwx. 1 root root   15 Feb 14 15:45 stderr -> /proc/self/fd/2
lrwxrwxrwx. 1 root root   15 Feb 14 15:45 stdin -> /proc/self/fd/0
lrwxrwxrwx. 1 root root   15 Feb 14 15:45 stdout -> /proc/self/fd/1
crw-rw-rw-. 1 root root 5, 0 Feb 14 15:46 tty
cr--r--r--. 1 root root 1, 9 Feb 14 15:45 urandom
crw-rw-rw-. 1 root root 1, 5 Feb 14 15:45 zero

Comment 4 Clark Williams 2011-03-10 19:10:35 UTC
In mock-1.1.9, we reverted the logic to create /dev/tty and /dev/ptmx inside the chroot /dev. This seems to have sidestepped the issue on many of our build failures (e.g. bash). 

Would you please try mock-1.1.9 and see if this change allows your build to complete?

In the meantime I continue my research into what what we should have inside the chroot's /dev...

Comment 5 Paul Howarth 2011-03-10 22:32:53 UTC
perl-TermReadKey builds OK but skips all tests due to missing /dev/tty.

perl-Expect fails its test suite:

Executing(%check): /bin/sh -e /var/tmp/rpm-tmp.OxFueA
+ umask 022
+ cd /builddir/build/BUILD
+ cd Expect-1.21
+ unset DISPLAY
+ /usr/bin/make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-Iblib/lib" "-Iblib/arch" test.pl
pty_allocate(nonfatal): posix_openpt(): No such file or directory at /usr/lib/perl5/vendor_perl/IO/Pty.pm line 24.
pty_allocate(nonfatal): getpt(): No such file or directory at /usr/lib/perl5/vendor_perl/IO/Pty.pm line 24.
pty_allocate(nonfatal): openpty(): No such file or directory at /usr/lib/perl5/vendor_perl/IO/Pty.pm line 24.
pty_allocate(nonfatal): open(/dev/ptmx): No such file or directory at /usr/lib/perl5/vendor_perl/IO/Pty.pm line 24.
Cannot open a pty at test.pl line 34
1..42
Basic tests...
make: *** [test_dynamic] Error 2
RPM build errors:
error: Bad exit status from /var/tmp/rpm-tmp.OxFueA (%check)
    Bad exit status from /var/tmp/rpm-tmp.OxFueA (%check)
Child returncode was: 1

This is with mock-1.1.9-1.fc14.

Comment 6 Fedora Admin XMLRPC Client 2011-03-11 18:10:32 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 7 Paul Howarth 2011-04-06 08:40:32 UTC
Another package that is now failing its test suite with mock 1.1.9 is libssh2:

Executing(%check): /bin/sh -e /var/tmp/rpm-tmp.7sOoya
+ umask 022
+ cd /builddir/build/BUILD
+ cd libssh2-1.2.7
+ unset DISPLAY
+ cd tests
+ make check
make  simple
make[1]: Entering directory `/builddir/build/BUILD/libssh2-1.2.7/tests'
gcc -DHAVE_CONFIG_H -I. -I. -I../src -I../example  -I../src -I../include -I../src   -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c simple.c
/bin/sh ../libtool --tag=CC --mode=link gcc  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic   -o simple  simple.o ../src/libssh2.la
libtool: link: gcc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -o .libs/simple simple.o  ../src/.libs/libssh2.so -Wl,-rpath -Wl,/usr/lib64
make[1]: Leaving directory `/builddir/build/BUILD/libssh2-1.2.7/tests'
make  check-TESTS
make[1]: Entering directory `/builddir/build/BUILD/libssh2-1.2.7/tests'
PASS: simple
Failed requesting pty
Fingerprint: 86 AD B2 21 33 60 65 3D 9A 29 86 DE 22 99 DA 18 CC BA D3 AC
Authentication methods: publickey,password,keyboard-interactive
        Authentication by public key succeeded.
FAIL: ssh2.sh
===========================================
1 of 2 tests failed
Please report to libssh2-devel.se
===========================================
make[1]: Leaving directory `/builddir/build/BUILD/libssh2-1.2.7/tests'
make[1]: *** [check-TESTS] Error 1
make: *** [check-am] Error 2

"Failed requesting pty" points the finger at mock I think.

Comment 8 Clark Williams 2011-04-06 13:37:21 UTC
Yes, I agree. I've been poking at it a bit, looking at the perl-TermReadKey failure and when I attached gdb to a hung perl instance, it was stuck in tcsetattr().  So we've got something going wrong with our controlling tty setup. 

I'll post an email to the fedora-buildsys-list with a summary and my appeal for help in figuring out how we should setup /dev/tty and /dev/ptmx for all our supported build hosts.

Comment 9 Clark Williams 2011-05-06 20:18:06 UTC
I've made a set of changes to my local mock that I think will help this out. Basically I've changed how we enter the chroot. Previously we were calling os.setpgrp() before exec'ing rpmbuild. I've changed this to be a call to os.setsid() which means we start a new session and nuke the controlling tty. So rather than hanging, an open of /dev/tty should fail, since we have no controlling tty. 

I've successfully built perl-TermReadKey() and some others that were experiencing difficulties. Unless more problems come to light, I'll create a 1.1.10/1.0.17 build next week and push them up for testing.

Comment 10 Fedora Update System 2011-05-13 20:31:49 UTC
mock-1.1.10-1.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/mock-1.1.10-1.fc15

Comment 11 Fedora Update System 2011-05-13 20:36:58 UTC
mock-1.1.10-1.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/mock-1.1.10-1.fc14

Comment 12 Fedora Update System 2011-05-13 20:41:10 UTC
mock-1.0.17-1.el5 has been submitted as an update for Fedora EPEL 5.
https://admin.fedoraproject.org/updates/mock-1.0.17-1.el5

Comment 13 Fedora Update System 2011-05-13 20:45:22 UTC
mock-1.1.10-1.fc13 has been submitted as an update for Fedora 13.
https://admin.fedoraproject.org/updates/mock-1.1.10-1.fc13

Comment 14 Fedora Update System 2011-05-13 20:49:37 UTC
mock-1.1.10-1.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/mock-1.1.10-1.el6

Comment 15 Fedora Update System 2011-05-14 00:01:49 UTC
Package mock-1.1.10-1.el6:
* should fix your issue,
* was pushed to the Fedora EPEL 6 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=epel-testing mock-1.1.10-1.el6'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/mock-1.1.10-1.el6
then log in and leave karma (feedback).

Comment 16 Fedora Update System 2011-05-19 04:33:19 UTC
mock-1.1.10-1.fc15 has been pushed to the Fedora 15 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 17 Paul Howarth 2011-05-19 08:53:47 UTC
perl-Expect still fails its test suite with 1.1.10 due to failure to open tty:

Executing(%check): /bin/sh -e /var/tmp/rpm-tmp.DaLElE
+ umask 022
+ cd /builddir/build/BUILD
+ cd Expect-1.21
+ unset DISPLAY
+ /usr/bin/make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-Iblib/lib" "-Iblib/arch" test.pl
IO::Tty::pty_allocate(nonfatal): grantpt(): No such file or directory at /usr/lib64/perl5/vendor_perl/IO/Pty.pm line 24.
IO::Tty::open_slave(nonfatal): ptsname_r(): No such file or directory at /usr/lib64/perl5/vendor_perl/IO/Pty.pm line 24.
IO::Tty::open_slave(nonfatal): open(/dev/pts/9): No such file or directory at /usr/lib64/perl5/vendor_perl/IO/Pty.pm line 24.
pty_allocate(nonfatal): posix_openpt(): No such file or directory at /usr/lib64/perl5/vendor_perl/IO/Pty.pm line 24.
IO::Tty::pty_allocate(nonfatal): grantpt(): No such file or directory at /usr/lib64/perl5/vendor_perl/IO/Pty.pm line 24.
IO::Tty::open_slave(nonfatal): open(/dev/pts/9): No such file or directory at /usr/lib64/perl5/vendor_perl/IO/Pty.pm line 24.
pty_allocate(nonfatal): getpt(): No such file or directory at /usr/lib64/perl5/vendor_perl/IO/Pty.pm line 24.
pty_allocate(nonfatal): openpty(): No such file or directory at /usr/lib64/perl5/vendor_perl/IO/Pty.pm line 24.
IO::Tty::pty_allocate(nonfatal): grantpt(): No such file or directory at /usr/lib64/perl5/vendor_perl/IO/Pty.pm line 24.
IO::Tty::open_slave(nonfatal): open(/dev/pts/9): No such file or directory at /usr/lib64/perl5/vendor_perl/IO/Pty.pm line 24.
pty_allocate(nonfatal): open(/dev/ptmx): No such file or directory at /usr/lib64/perl5/vendor_perl/IO/Pty.pm line 24.
Cannot open a pty at test.pl line 34
1..42
Basic tests...
make: *** [test_dynamic] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.DaLElE (%check)

$ ls -l /var/lib/mock/city-fan-rawhide-x86_64/root/dev
total 64
crw-------. 1 root root 5, 1 May 19 09:42 console
lrwxrwxrwx. 1 root root   13 May 19 09:42 fd -> /proc/self/fd
crw-rw-rw-. 1 root root 1, 7 May 19 09:42 full
crw-rw-rw-. 1 root root 1, 3 May 19 09:42 null
crw-rw-rw-. 1 root tty  5, 2 May 19 09:42 ptmx
drwxrwxr-x. 2 root root 4096 May 19 09:42 pts
crw-rw-rw-. 1 root root 1, 8 May 19 09:42 random
drwxrwxr-x. 2 root root 4096 May 19 09:42 shm
lrwxrwxrwx. 1 root root   15 May 19 09:42 stderr -> /proc/self/fd/2
lrwxrwxrwx. 1 root root   15 May 19 09:42 stdin -> /proc/self/fd/0
lrwxrwxrwx. 1 root root   15 May 19 09:42 stdout -> /proc/self/fd/1
crw-rw-rw-. 1 root tty  5, 0 May 19 09:42 tty
cr--r--r--. 1 root root 1, 9 May 19 09:42 urandom
crw-rw-rw-. 1 root root 1, 5 May 19 09:42 zero

The libssh2 test suite fails as in Comment #7 and my previous workaround of disabling the failing test if /dev/tty was not present or not a character special device no longer works :-(

Comment 18 Fedora Update System 2011-05-25 02:40:38 UTC
mock-1.1.10-1.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 19 Fedora Update System 2011-05-25 03:15:09 UTC
mock-1.1.10-1.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 20 Paul Howarth 2011-05-26 20:21:25 UTC
Is this really considered fixed now or is there any prospect of having a working /dev/tty in mock again? Should I open a new bug regarding the test failures for perl-Expect and libssh2?

Comment 21 Clark Williams 2011-05-26 20:40:07 UTC
It's fixed in the regard that it no longer hangs builds when trying to access /dev/tty (since there is no longer a controlling terminal in the chroot). 

If you consider having a controlling terminal available in the build system environment, then I guess we need a new bz.

Comment 22 Paul Howarth 2011-05-27 08:54:38 UTC
I'm not sure whether it's the absence of a controlling terminal or something else that causes these packages' test suites to fail. If you're sure that's what it is then I'll open another bug.

Comment 23 Fedora Update System 2011-06-02 19:04:49 UTC
mock-1.0.17-1.el5 has been pushed to the Fedora EPEL 5 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 24 Fedora Update System 2011-06-02 19:14:54 UTC
mock-1.1.10-1.el6 has been pushed to the Fedora EPEL 6 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 25 Paul Howarth 2011-06-23 12:16:54 UTC
(In reply to comment #21)
> It's fixed in the regard that it no longer hangs builds when trying to access
> /dev/tty (since there is no longer a controlling terminal in the chroot). 
> 
> If you consider having a controlling terminal available in the build system
> environment, then I guess we need a new bz.

I'm pleased to say that with mock 1.1.11, both perl-Expect and libssh complete their test suites successfully. perl-Term-ReadKey also passes though it claims /dev/tty is absent and thus skips most of the tests. Everything's buildable though so I'm happy :-)


Note You need to log in before you can comment on or make changes to this bug.