Bug 982317 - cannot open /dev/tty inside container
cannot open /dev/tty inside container
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: libvirt (Show other bugs)
19
x86_64 Linux
unspecified Severity high
: ---
: ---
Assigned To: Eric Blake
Fedora Extras Quality Assurance
: Reopened
: 993733 994280 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-07-08 12:15 EDT by Martin Jenner
Modified: 2013-08-07 04:59 EDT (History)
14 users (show)

See Also:
Fixed In Version: libvirt-1.0.5.5-1.fc19
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-08-06 19:35:19 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
This patch creates /dev/tty within a container. (1.02 KB, patch)
2013-07-08 14:17 EDT, Daniel Walsh
no flags Details | Diff

  None (edit)
Description Martin Jenner 2013-07-08 12:15:54 EDT
Description of problem:

A tty is not opened inside a container stopping the usex test program from running.

UNEXPECTED DIE CODE [20]: cannot open /dev/tty

Version-Release number of selected component (if applicable):
Running F19 RC1
libvirt-sandbox-0.2.0-1.fc19.x86_64
libvirt-1.0.5.1-1.fc19.x86_64
kernel-3.9.5-301.fc19.x86_64


How reproducible:
100%

Steps to Reproduce:
Confirm usex works outside container then test with virt-sandbox command, note the -T 3 switch sets the timeout too 3 minutes 

1. /usr/local/bin/usex -b -T 3 -C
2. virt-sandbox -c lxc:/// -n test -m host-bind:/tmp=/tmp/usex_tmp -- /usr/local/bin/usex -b -T 3 -C


Actual results:
UNEXPECTED DIE CODE [20]: cannot open /dev/tty

Expected results:
usex test program should run inside container as it does on bare metal.

Additional info:

Get usex from
  # curl http://people.redhat.com/anderson/usex/usex-1.9-34.tar.gz -o usex-1.9-34.tar.gz
  # tar xzvf usex-1.9-34.tar.gz
  # cd usex-1.9-34
  # yum install make gcc ncurses-devel
  # make
  # scp usex /usr/local/bin
Comment 1 Daniel Walsh 2013-07-08 14:17:20 EDT
Created attachment 770608 [details]
This patch creates /dev/tty within a container.

This is a libvirt bug not a libvirt-sandbox.
Comment 2 Daniel Berrange 2013-07-09 06:50:23 EDT
commit 9a0ac6d9c21b914f887d2a1e0051b5beffa81bd7
Author: Richard Weinberger <richard@nod.at>
Date:   Tue Jul 9 11:05:14 2013 +0100

    LXC: Create /dev/tty within a container
Comment 3 Fedora Update System 2013-07-11 20:44:26 EDT
libvirt-1.0.5.3-1.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/libvirt-1.0.5.3-1.fc19
Comment 4 Fedora Update System 2013-07-12 22:02:23 EDT
Package libvirt-1.0.5.3-1.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing libvirt-1.0.5.3-1.fc19'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-12938/libvirt-1.0.5.3-1.fc19
then log in and leave karma (feedback).
Comment 5 Cole Robinson 2013-07-23 10:33:47 EDT
1.0.5.4 is heading to stable now, which fixes this.
Comment 6 Geert Jansen 2013-07-29 15:33:50 EDT
Note that in version 1.0.5.4, for some reason the bug is not fixed correctly. This version creates a /tty, not a /dev/tty. The attached patch will properly fix it:

--- libvirt-1.0.5.4/src/lxc/lxc_container.c.orig	2013-07-29 21:10:08.138088891 +0200
+++ libvirt-1.0.5.4/src/lxc/lxc_container.c	2013-07-29 21:10:21.117815031 +0200
@@ -839,7 +839,7 @@
         { LXC_DEV_MAJ_MEMORY, LXC_DEV_MIN_FULL, 0666, "/dev/full" },
         { LXC_DEV_MAJ_MEMORY, LXC_DEV_MIN_RANDOM, 0666, "/dev/random" },
         { LXC_DEV_MAJ_MEMORY, LXC_DEV_MIN_URANDOM, 0666, "/dev/urandom" },
-        { LXC_DEV_MAJ_TTY, LXC_DEV_MIN_TTY, 0666, "/tty" },
+        { LXC_DEV_MAJ_TTY, LXC_DEV_MIN_TTY, 0666, "/dev/tty" },
     };
     const struct {
         const char *src;
Comment 7 Eric Blake 2013-07-29 15:41:23 EDT
(In reply to Geert Jansen from comment #6)
> Note that in version 1.0.5.4, for some reason the bug is not fixed
> correctly. This version creates a /tty, not a /dev/tty. The attached patch
> will properly fix it:
> 
> --- libvirt-1.0.5.4/src/lxc/lxc_container.c.orig	2013-07-29
> 21:10:08.138088891 +0200
> +++ libvirt-1.0.5.4/src/lxc/lxc_container.c	2013-07-29 21:10:21.117815031
> +0200
> @@ -839,7 +839,7 @@
>          { LXC_DEV_MAJ_MEMORY, LXC_DEV_MIN_FULL, 0666, "/dev/full" },
>          { LXC_DEV_MAJ_MEMORY, LXC_DEV_MIN_RANDOM, 0666, "/dev/random" },
>          { LXC_DEV_MAJ_MEMORY, LXC_DEV_MIN_URANDOM, 0666, "/dev/urandom" },
> -        { LXC_DEV_MAJ_TTY, LXC_DEV_MIN_TTY, 0666, "/tty" },
> +        { LXC_DEV_MAJ_TTY, LXC_DEV_MIN_TTY, 0666, "/dev/tty" },
>      };
>      const struct {
>          const char *src;

Can you also post this to libvir-list@redhat.com? It would be nice to get this fixed in the 1.1.1 release.
Comment 8 Geert Jansen 2013-07-29 15:51:33 EDT
(In reply to Eric Blake from comment #7)

> Can you also post this to libvir-list@redhat.com? It would be nice to get
> this fixed in the 1.1.1 release.

Upstream has already fixed htis. Device creation moved to lxc_controller.c and and table entries now have the "/dev" prefixes got removed.
Comment 9 Eric Blake 2013-07-29 16:04:21 EDT
Good to know - that just means we botched things when backporting to v1.0.5-maint.  I'll take a look at fixing it.
Comment 10 Eric Blake 2013-07-29 17:51:27 EDT
Cole's next release on the 1.0.5.x maint series will include this:

commit a10d077ef202d35b62d586e2356ce507e4ca6135
Author: Eric Blake <eblake@redhat.com>
Date:   Mon Jul 29 15:45:25 2013 -0600

    lxc: correctly backport /dev/tty fix
    
    https://bugzilla.redhat.com/show_bug.cgi?id=982317
    
    maint-only patch; reported by Geert Jansen
    
    Commit 17cdc298 tried to backport upstream 90a0c6d, but in
    resolving conflicts, failed to account that upstream commit
    e1d32bb refactored code to leave off a leading /dev.
    
    * src/lxc/lxc_container.c (lxcContainerPopulateDevices): Use
    correct device name.
    
    Signed-off-by: Eric Blake <eblake@redhat.com>
Comment 11 Fedora Update System 2013-08-01 19:49:37 EDT
libvirt-1.0.5.5-1.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/libvirt-1.0.5.5-1.fc19
Comment 12 Fedora Update System 2013-08-02 18:03:36 EDT
Package libvirt-1.0.5.5-1.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing libvirt-1.0.5.5-1.fc19'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-14127/libvirt-1.0.5.5-1.fc19
then log in and leave karma (feedback).
Comment 13 Geert Jansen 2013-08-03 04:13:29 EDT
Works for me. I have added Karma to the update. Thanks for the quick fix!
Comment 14 Daniel Berrange 2013-08-06 09:04:20 EDT
*** Bug 993733 has been marked as a duplicate of this bug. ***
Comment 15 Tomasz Sterna 2013-08-06 16:21:22 EDT
libvirt-1.0.5.5-1.fc19 fixed bug 993733 for me. Thanks.
Comment 16 Fedora Update System 2013-08-06 19:35:19 EDT
libvirt-1.0.5.5-1.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 17 Daniel Berrange 2013-08-07 04:59:54 EDT
*** Bug 994280 has been marked as a duplicate of this bug. ***

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