Bug 861564

Summary: fail to start lxc os container
Product: Red Hat Enterprise Linux 6 Reporter: zhenfeng wang <zhwang>
Component: libvirtAssignee: Michal Privoznik <mprivozn>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 6.4CC: acathrow, ajia, dallan, dyasny, dyuan, gsun, mzhan, rwu
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-0.10.2-2.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-21 07:25:31 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description zhenfeng wang 2012-09-29 07:59:48 UTC
Description of problem:
fail to start lxc os container

Version-Release number of selected component (if applicable):
libvirt-0.10.2-1.el6.x86_64
qemu-kvm-0.12.1.2-2.316.el6.x86_64
kernel-2.6.32-309.el6.x86_64

How reproducible:
100%

Steps to Reproduce
1.  create a root filesytem with febootstrap
#febootstrap --groupinstall="base" "Fedora 15" /tmp/fe15 http://download.englab.nay.redhat.com/pub/fedora/linux/releases/15/Fedora/i386/os/

2.  define a OS container with following xml:
# virsh -c lxc:/// dumpxml fedora-rawhide
<domain type='lxc'>
  <name>fedora-rawhide</name>
  <uuid>6222c8db-8764-9c54-8fed-2646b8c4ef78</uuid>
  <memory unit='KiB'>524288</memory>
  <currentMemory unit='KiB'>524288</currentMemory>
  <vcpu placement='static'>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='/tmp/fe15'/>
      <target dir='/'/>
    </filesystem>
    <interface type='network'>
      <mac address='52:54:00:f0:1e:4c'/>
      <source network='default'/>
    </interface>
    <console type='pty'>
      <target type='lxc' port='0'/>
    </console>
  </devices>
</domain>
# virsh -c lxc:/// define fedora-rawhide.xml
Domain toy defined from toy.xml

3. start container
# virsh -c lxc:/// start fedora-rawhide
error: Failed to start domain fedora-rawhide
error: internal error guest failed to start: PATH=/bin:/sbin TERM=linux container=lxc-libvirt container_uuid=6222c8db-8764-9c54-8fed-2646b8c4ef78 LIBVIRT_LXC_UUID=6222c8db-8764-9c54-8fed-2646b8c4ef78 LIBVIRT_LXC_NAME=fedora-rawhide /sbin/init
2012-09-29 07:42:38.899+0000: 1: info : libvirt version: 0.10.2, package: 1.el6 (Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>, 2012-09-24-04:06:26, x86-009.build.bos.redhat.com)
2012-09-29 07:42:38.899+0000: 1: error : lxcContainerGetSubtree:1199 : Failed to read /proc/mounts: No such file or directory
2012-09-29 07:42:38.914+0000: 24656: info : libvirt version: 0.10.2, package: 1.el6 (Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>, 2012-09-24-04:06:26, x86-009.build.bos.redhat.com)
2012-09-29 07:42:38.914+0000: 24656: error : virLXCControllerRun:1412 : Unable to send container continue message: Broken pipe

Actual results:
Fail to start

Expected results:
the lxc os container should start successfully and no reporting error
Additional info
libvirtd.log

2012-09-29 07:42:38.927+0000: 23361: error : virNetSocketReadWire:1176 : Cannot recv data: Connection reset by peer
2012-09-29 07:42:39.027+0000: 23364: error : virLXCProcessStart:1145 : internal error guest failed to start: PATH=/bin:/sbin TERM=linux container=lxc-libvirt container_uuid=6222c8db-8764-9c54-8fed-2646b8c4ef78 LIBVIRT_LXC_UUID=6222c8db-8764-9c54-8fed-2646b8c4ef78 LIBVIRT_LXC_NAME=fedora-rawhide /sbin/init
2012-09-29 07:42:38.899+0000: 1: info : libvirt version: 0.10.2, package: 1.el6 (Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>, 2012-09-24-04:06:26, x86-009.build.bos.redhat.com)
2012-09-29 07:42:38.899+0000: 1: error : lxcContainerGetSubtree:1199 : Failed to read /proc/mounts: No such file or directory
2012-09-29 07:42:38.914+0000: 24656: info : libvirt version: 0.10.2, package: 1.el6 (Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>, 2012-09-24-04:06:26, x86-009.build.bos.redhat.com)
2012-09-29 07:42:38.914+0000: 24656: error : virLXCControllerRun:1412 : Unable to send container continue message: Broken pipe

2012-09-29 07:42:39.031+0000: 23364: error : virNetDevSetOnline:536 : Cannot get interface flags on 'veth0': No such device
2012-09-29 07:42:39.099+0000: 23361: error : virLXCProcessStop:701 : internal error Invalid PID -1 for container
2012-09-29 07:42:39.099+0000: 23361: error : virLXCProcessStop:701 : internal error Invalid PID -1 for container

Comment 2 zhenfeng wang 2012-09-29 08:39:59 UTC
This issue is only exsited on the lxc os container ,but not in the lxc application  container, the lxc application container  can start successfully now ,you can reference the bug 857341

Comment 3 Daniel Berrangé 2012-10-01 07:57:27 UTC
We need this fix from upstream:

commit 1532bd498a879494bb1e4757a54fce796eab368c
Author: Daniel P. Berrange <berrange>
Date:   Tue Sep 25 16:24:10 2012 +0100

    Fix start of containers with custom root filesystem
    
    A prefix change to unmount the SELinux filesystem broke starting
    of LXC containers with a custom root filesystem

Comment 4 zhenfeng wang 2012-10-08 03:32:46 UTC
As it works on libvirt-0.9.10-21.el6.x86_64, so mark this bug a regression bug.

Comment 8 Wayne Sun 2012-10-09 08:00:28 UTC
pkgs:
libvirt-0.10.2-2.el6.x86_64
kernel-2.6.32-306.el6.x86_64

steps
following exact steps as in description
# virsh -c lxc:/// list --all
 Id    Name                           State
----------------------------------------------------
 -     fedora-rawhide                 shut off

# virsh -c lxc:/// dumpxml fedora-rawhide
<domain type='lxc'>
  <name>fedora-rawhide</name>
  <uuid>6222c8db-8764-9c54-8fed-2646b8c4ef78</uuid>
  <memory unit='KiB'>524288</memory>
  <currentMemory unit='KiB'>524288</currentMemory>
  <vcpu placement='static'>1</vcpu>
  <os>
    <type arch='i686'>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='/tmp/fe15'/>
      <target dir='/'/>
    </filesystem>
    <interface type='network'>
      <mac address='52:54:00:f0:1e:4c'/>
      <source network='default'/>
    </interface>
    <console type='pty'>
      <target type='lxc' port='0'/>
    </console>
  </devices>
</domain>

# virsh -c lxc:/// start fedora-rawhide
Domain fedora-rawhide started

# virsh -c lxc:/// list --all
 Id    Name                           State
----------------------------------------------------
 22330 fedora-rawhide                 running

This is working now.

Comment 9 errata-xmlrpc 2013-02-21 07:25:31 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/RHSA-2013-0276.html