Search code examples
linuxcentoscontainersfreezelxc

How to fix Centos lxc containers when random commands are hanging?


The host server is Centos 7.0.1406. I am creating lxc Centos 7.2.1511 containers using the following command:

lxc-create -n test-container -t /etc/lxc/templates/lxc-centos --lxcpath=/var/lib/lxc/ 

The lxc container is created and I can start it and attach to it like this:

lxc-create -n test-container -t /etc/lxc/templates/lxc-centos --lxcpath=/var/lib/lxc/ 

lxc-start -d -n test-container

lxc-attach -n test-container

Once I am inside test-container, I try to run random commands, such as adduser foo or yum install emacs and they will always hang like this:

$ adduser foobar

...

or like this:

Is this ok [y/N]: y Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : freetype-2.4.11-11.el7.x86_64
1/132 Installing : libICE-1.0.9-2.el7.x86_64
2/132 Installing : 2:libpng-1.5.13-7.el7_2.x86_64
3/132 Installing : libSM-1.2.2-2.el7.x86_64
4/132 Installing : libjpeg-turbo-1.2.90-5.el7.x86_64
5/132 Installing : atk-2.14.0-1.el7.x86_64
6/132 Installing : jasper-libs-1.900.1-29.el7.x86_64
7/132 Installing : 1:emacs-filesystem-24.3-18.el7.noarch
8/132 Installing : libthai-0.1.14-9.el7.x86_64
9/132 Installing : mesa-libglapi-10.6.5-3.20150824.el7.x86_64
10/132

...

At first, I thought it was a package problem, but even commands like adduser are hanging. I tried rebooting the container, creating the containers using salt lxc module, updating the kernel on the host, avoiding updating packages, cloning the container, and many others...

I ran out of ideas, I am about to switch to Debian containers, but I would like to know if anybody has encountered a similar problem before and knows how to fix it.


Solution

  • this appears to be a bug with the version of the lxc tools currently in centos: lxc-1.0.8-1.el7.x86_64.

    using different tools, such as libvirt, or upgrading lxc to the latest current version 1.1.5 solves the problem.