Bug 607526 - [LXC] Can not connect to fedora guest in LXC
Summary: [LXC] Can not connect to fedora guest in LXC
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt   
(Show other bugs)
Version: 6.0
Hardware: All Linux
Target Milestone: rc
: ---
Assignee: Daniel Veillard
QA Contact: Virtualization Bugs
Depends On:
Blocks: Rhel6.1LibvirtTier1
TreeView+ depends on / blocked
Reported: 2010-06-24 10:03 UTC by LiZhang Li
Modified: 2011-12-06 10:46 UTC (History)
13 users (show)

Fixed In Version: libvirt-0.9.2-1.el6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2011-12-06 10:46:38 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:1513 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2011-12-06 01:23:30 UTC

Description LiZhang Li 2010-06-24 10:03:36 UTC
Description of problem:

Define a fedora guest
<domain type='lxc' id='30013'>
    <type arch='x86_64'>exe</type>
  <clock offset='utc'/>
    <filesystem type='mount'>
      <source dir='/tmp/rawhide'/>
      <target dir='/'/>
    <interface type='network'>
      <mac address='52:54:00:73:6b:43'/>
      <source network='default'/>
      <target dev='veth1'/>
    <console type='pty'>
      <target port='0'/>

start the guest and console connect to it
the operation just hang there like this:
virsh # console fedora-rawhide
Connected to domain fedora-rawhide
Escape character is ^]

sometimes it complains about the wrong /dev/pts like this:
error : vshRunConsole:77 : unable to open tty /dev/pts/10: No such file or directory 

Version-Release number of selected component (if applicable):
# rpm -qa | grep libvirt

# uname -r

How reproducible:

Comment 2 RHEL Product and Program Management 2010-06-24 10:33:01 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux major release.  Product Management has requested further
review of this request by Red Hat Engineering, for potential inclusion in a Red
Hat Enterprise Linux Major release.  This request is not yet committed for

Comment 3 Hugh Brock 2010-06-28 16:05:15 UTC
We believe this is a misconfiguration, but in any case there's no time to fix it for 6.1.

Comment 4 Ryota Ozaki 2010-08-05 11:54:24 UTC
Replacing "/sbin/init" with "/bin/sh" would solve the problem. In may case, that helped me.

Anyway, lxc driver should support /sbin/init in the future.

Comment 6 Daniel Berrange 2010-11-04 17:48:55 UTC
There's several issues at play here. 

 - Your Fedora container install needs to be manually configured to run a mingetty on the right device
 - /dev/console is incorrectly setup in the container.
 - A bug in libvirt_lxc means that it often quits prematurely resulting in
error : vshRunConsole:77 : unable to open tty /dev/pts/10: No such file or

2 & 3 are easily fixed in libvirt. 1 is a documentation problem, and/or a reason to provide a 'virt-bootstrap' tool for LXC with common distros

Comment 8 Suzanne Yeghiayan 2011-03-28 21:09:42 UTC
Since RHEL 6.1 External Beta has begun, and this bug remains 
unresolved, it has been rejected as it is not proposed as an 
exception or blocker.

Red Hat invites you to ask your support representative to 
propose this request, if appropriate and relevant, in the 
next release of Red Hat Enterprise Linux.

Comment 11 Daniel Berrange 2011-06-21 09:12:42 UTC
Problems 2 & 3 described in comment #6 are fixed upstream by these commits:

commit 2fbec002031934c0e5ad660c6af6e34a2647ed3d
Author: Daniel P. Berrange <dan@berrange.com>
Date:   Fri Nov 5 13:27:34 2010 +0000

    Fix LXC container console device setup
    The /dev/console device inside the container must NOT map
    to the real /dev/console device node, since this allows the
    container control over the current host console. A fun side
    effect of this is that starting a container containing a
    real Fedora OS will kill off your X server.
    Remove the /dev/console node, and replace it with a symlink
    to the primary console TTY

commit 08fb2a9ce855c6ed1042e451fb4dfc6664a77d64
Author: Daniel P. Berrange <berrange@redhat.com>
Date:   Tue Feb 22 14:06:09 2011 +0000

    Fix group/mode for /dev/pts inside LXC container
    Normal practice for /dev/pts is to have it mode=620,gid=5
    but LXC was leaving mode=000,gid=0 preventing unprivilegd
    users in the guest use of PTYs
    * src/lxc/lxc_controller.c: Fix /dev/pts setup

commit 4e3117ae50efc0fcbd5ce485cd610dfab7f5c625
Author: Daniel P. Berrange <berrange@redhat.com>
Date:   Tue Feb 22 17:35:06 2011 +0000

    Make LXC container startup/shutdown/I/O more robust
    The current LXC I/O controller looks for HUP to detect
    when a guest has quit. This isn't reliable as during
    initial bootup it is possible that 'init' will close
    the console and let mingetty re-open it. The shutdown
    of containers was also flakey because it only killed
    the libvirt I/O controller and expected container
    processes to gracefully follow.
    Change the I/O controller such that when it see HUP
    or an I/O error, it uses kill($PID, 0) to see if the
    process has really quit.
    Change the container shutdown sequence to use the
    virCgroupKillPainfully function to ensure every
    really goes away
    This change makes the use of the 'cpu', 'devices'
    and 'memory' cgroups controllers compulsory with
    * docs/drvlxc.html.in: Document that certain cgroups
      controllers are now mandatory
    * src/lxc/lxc_controller.c: Check if PID is still
      alive before quitting on I/O error/HUP
    * src/lxc/lxc_driver.c: Use virCgroupKillPainfully

Comment 14 Huang Wenlong 2011-07-06 02:42:03 UTC
this bug verified , but can not init system successfully.


Test step :

1) febootstrap --group-install="base" fedora-14 /mnt/sda5/test-febootstrap/f14
2) virsh -c lxc:/// define vm1.xml

<domain type='lxc'>
<type arch='x86_64'>exe</type>
<clock offset='utc'/>
<filesystem type='mount' accessmode='passthrough'>
<source dir='/mnt/sda5/test-febootstrap/f14'/>
<target dir='/'/>
<interface type='network'>
<mac address='52:54:00:96:95:3f'/>
<source network='default'/>
<target dev='veth0'/>
<console type='pty'>
<target type='serial' port='0'/>

3) #virsh -c lxc:/// start vm1

Domain vm1 started

4) # virsh -c lxc:/// console vm1
Connected to domain vm1
Escape character is ^]
/etc/init.d/functions: line 51: /dev/stderr: No such file or directory
/etc/init.d/functions: line 51: /dev/stderr: No such file or directory
Welcome to Fedora 
init: readahead-collector main process (5) terminated with status 1
/etc/init.d/functions: line 51: /dev/stderr: No such file or directory
Starting udev: udevd33: matchpathcon(/dev/.udev) failed

udevd[33]: matchpathcon(/dev/.udev/rules.d) failed
udevd[34]: matchpathcon(/dev/core) failed
can not init system successfully .

Comment 16 Rita Wu 2011-07-11 11:18:30 UTC
Set it as VERIFIED per comment14

Comment 17 errata-xmlrpc 2011-12-06 10:46:38 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


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