RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 607526 - [LXC] Can not connect to fedora guest in LXC
Summary: [LXC] Can not connect to fedora guest in LXC
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.0
Hardware: All
OS: Linux
low
medium
Target Milestone: rc
: ---
Assignee: Daniel Veillard
QA Contact: Virtualization Bugs
URL:
Whiteboard:
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:
Clone Of:
Environment:
Last Closed: 2011-12-06 10:46:38 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:1513 0 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'>
  <name>fedora-rawhide</name>
  <uuid>6222c8db-8764-9c54-8fed-2646b8c4ef78</uuid>
  <memory>32768</memory>
  <currentMemory>32768</currentMemory>
  <vcpu>1</vcpu>
  <os>
    <type arch='x86_64'>exe</type>
    <init>/sbin/init</init>
  </os>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/libexec/libvirt_lxc</emulator>
    <filesystem type='mount'>
      <source dir='/tmp/rawhide'/>
      <target dir='/'/>
    </filesystem>
    <interface type='network'>
      <mac address='52:54:00:73:6b:43'/>
      <source network='default'/>
      <target dev='veth1'/>
    </interface>
    <console type='pty'>
      <target port='0'/>
    </console>
  </devices>
</domain>

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
libvirt-client-0.8.1-10.el6.i686
libvirt-debuginfo-0.8.1-10.el6.i686
libvirt-0.8.1-10.el6.i686
libvirt-python-0.8.1-10.el6.i686
libvirt-devel-0.8.1-10.el6.i686

# uname -r
2.6.32-30.el6.i686

How reproducible:
100%

Comment 2 RHEL 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
inclusion.

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 Berrangé 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 Logcher 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 Berrangé 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>
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>
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>
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
    LXC
    
    * 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.

libvirt-0.9.2-1.el6.x86_64
qemu-kvm-0.12.1.2-2.165.el6.x86_64
kernel-2.6.32-156.el6.x86_64
virt-manager-0.8.6-4.el6

Test step :

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

<domain type='lxc'>
<name>vm1</name>
<uuid>47672025-eb2b-d58b-6441-c4703f5c683b</uuid>
<memory>500000</memory>
<currentMemory>500000</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='x86_64'>exe</type>
<init>/sbin/init</init>
</os>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/libexec/libvirt_lxc</emulator>
<filesystem type='mount' accessmode='passthrough'>
<source dir='/mnt/sda5/test-febootstrap/f14'/>
<target dir='/'/>
</filesystem>
<interface type='network'>
<mac address='52:54:00:96:95:3f'/>
<source network='default'/>
<target dev='veth0'/>
</interface>
<console type='pty'>
<target type='serial' port='0'/>
</console>
</devices>
</domain>

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.

http://rhn.redhat.com/errata/RHBA-2011-1513.html


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