Bug 782038 - Libvirt/LXC failed to start container
Summary: Libvirt/LXC failed to start container
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Libvirt Maintainers
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-01-16 11:46 UTC by Samuel Hassine
Modified: 2016-03-23 21:06 UTC (History)
4 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2016-03-23 21:06:04 UTC
Embargoed:


Attachments (Terms of Use)
Trace of strace -o libvirt.log -f -ff -s 1000 /usr/sbin/libvirtd (2.69 MB, application/x-gzip)
2012-01-17 11:46 UTC, Samuel Hassine
no flags Details

Description Samuel Hassine 2012-01-16 11:46:39 UTC
Description of problem:

When I tried to start a new LXC container after successfully installed and configured libvirt, I have the following errors:

root@PAR-SRV-01-003:/etc/libvirt/lxc# virsh --connect lxc:/// start instance-00000010
    error: Failed to start domain instance-00000010
    error: internal error guest failed to start: 2012-01-16 10:46:47.717+0000: 2343: info : libvirt version: 0.9.8
    2012-01-16 10:46:47.717+0000: 2343: warning : lxcCapsInit:77 : Failed to get host power management capabilities
    PATH=/bin:/sbin TERM=linux LIBVIRT_LXC_UUID=bc6f23e6-193e-c4db-87c3-52b27bc7fe6d LIBVIRT_LXC_NAME=instance-00000010 /sbin/init
    2012-01-16 10:46:47.739+0000: 1: info : libvirt version: 0.9.8
    2012-01-16 10:46:47.739+0000: 1: error : lxcContainerMountDevFS:518 : Failed to mount /dev/pts in container: No such file or directory
    2012-01-16 10:46:47.739+0000: 2344: info : libvirt version: 0.9.8
    2012-01-16 10:46:47.739+0000: 2344: error : lxcControllerRun:1445 : error receiving signal from container: Input/output error

Version number:

root@PAR-SRV-01-001:~# dpkg -l | grep libvirt
ii  libvirt-bin                        0.9.8-2                    programs for the libvirt library
ii  libvirt0                           0.9.8-2                    library for interfacing with different virtualization systems
ii  python-libvirt                     0.9.8-2                    libvirt Python bindings

root@PAR-SRV-01-001:/# uname -a
Linux PAR-SRV-01-001 3.1.0-1-amd64 #1 SMP Tue Jan 10 05:01:58 UTC 2012 x86_64 GNU/Linux

Steps to Reproduce:
1. Install LXC
2. Install libvirt
3. Create a new XML configuration (default)
4. Trying to start container
  
Actual results:

2012-01-16 10:46:47.739+0000: 1: error : lxcContainerMountDevFS:518 : Failed to mount /dev/pts in container: No such file or directory

Expected results:

Starting container...

Comment 1 Samuel Hassine 2012-01-17 10:51:41 UTC
Hi,

I confirmed again the result of this experience with a minimal rootfs container built with busybox.

# mkdir /rootfs
# cd /rootfs
# mkdir bin var sbin etc root usr
# cd bin
# cp /bin/busybox busybox
# cd /
# for i in ls cat rm find ps echo date kill sleep \
         true false test pwd sh which grep head wget
do
  ln -s busybox /rootfs/bin/$i
done

And add:

<filesystem type='mount'>
  <source dir='/rootfs'/>
  <target dir='/'/>
</filesystem>

To the XML file.

We have "Failed to mount /dev/pts in container: No such file or directory" error in Debian testing.

Best regards.
Sam

Comment 2 Samuel Hassine 2012-01-17 11:46:07 UTC
Created attachment 555734 [details]
Trace of strace -o libvirt.log -f -ff -s 1000 /usr/sbin/libvirtd

This is the complete trace files generated by the command:

strace -o libvirt.log -f -ff -s 1000 /usr/sbin/libvirtd

when the error occured.

Comment 3 Samuel Hassine 2012-01-17 15:09:54 UTC
Hi,

I GOT IT! After one week of debug, finally, I successfully deal with this error!

Maybe a small "warning" about that should be added to the documentation:

It was a problem of symbolic link in the path of the filesystem set in the XML file.

Explaination:

/lxc/test/rootfs contain a full rootfs
/var/lib/lxc => /lxc (symlink)

If you put /var/lib/lxc/test/rootfs in your XML file, you will get the error I described above
If you put /lxc/test/rootfs directly in the XML, no error at all, container successfully start.

Best regards.
Sam

Comment 4 Samuel Hassine 2012-01-17 15:10:53 UTC
PS : You can easily workaround this by mount --bind of your partition.

Comment 5 Philipp Hahn 2012-01-17 15:20:24 UTC
I had exactly the same problem and came to the same solution:
Installing the "lxc" user space tools on Debian do ask you for the preferred location (/other/) for your containers and then created a symlink at /var/lib/lxc pointing there.
Using /var/lib/lxc/$NAME as the root for your container from libvirt will fail, while using /other/$NAME succeeds.

Comment 6 Cole Robinson 2016-03-23 21:06:04 UTC
I just tried booting an lxc container with /tmp/rootlink -> /, and it worked (this is Fedora 23 host with libvirt 1.2.18), so it appears this is fixed. Sorry this didn't receive a timely response


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