[Lxc-users] Installing Centos6 lxc guests under CentOS6 hosts

carlopmart carlopmart at gmail.com
Sat Mar 10 15:11:03 UTC 2012


On 03/10/2012 01:16 PM, Fajar A. Nugraha wrote:
> On Sat, Mar 10, 2012 at 6:57 PM, carlopmart<carlopmart at gmail.com>  wrote:
>> Hi all,
>>
>>    I am trying to install a centos 6.2 container under centos 6.2 host
>> using libvirt and virt-manager. I have selected "OS Container" option,
>> but when I try to launch this guest virt-manager returns me this error:
>>
>> PATH=/sbin:/usr/sbin:/bin:/usr/bin LIBVIRT_DEBUG=3
>> LIBVIRT_LOG_OUTPUTS=3:stderr /usr/libexec/libvirt_lxc --name mysqlsrv
>> --console 20 --handshake 23 --background --veth veth1 PATH=/bin:/sbin
>> TERM=linux LIBVIRT_LXC_UUID=41bfb51b-294e-1ba9-16c9-fc2e3a345ff6
>> LIBVIRT_LXC_NAME=mysqlsrv /sbin/init
>> 16:39:23.115: 1: info : libvirt version: 0.9.4, package: 23.el6_2.6
>> 16:39:23.115: 1: error : lxcContainerChild:896 : cannot find init path
>> '/sbin/init' relative to container root: No such file or directory
>
> Where is the container root? Do you have /sbin/init there?
>
>>
>>   I have followed these instructions: http://libvirt.org/drvlxc.html
>> and
>> http://berrange.com/posts/2011/09/27/getting-started-with-lxc-using-libvirt/
>>
>>   I have tried to do the same using rhel6.2 instead of centos 6.2 and
>> results are the same ...
>>
>>   What am I doing wrong?? Do I need to copy all host files to this
>> guest??
>
> At minimum, the guest should have /sbin/init under its own root. On
> the last link you gave, see "A private root filesystem with busybox"
> for a very-simplified example.
>
> If you want a full-blown installation, then yes, you need to have a
> working OS installation in the guest. This can be created with yum, or
> copying from existing system, or using templates.
>
>> If yes, then, how can I apply security updates to lxc guests??
>
> The way you do on normal system: yum update. ON THE GUEST.
>
> FWIW, the upcoming Ubuntu 12.04 will have excellent lxc support for
> both host and guest, with lxc command line tools (lxc-create,
> lxc-start, lxc-console, etc). Other systems might require more effort
> to get a fully working container. And to be honest, I'm not sure how
> good Centos 6.2 would function as a host do to somewhat-old 2.6.32
> kernel.
>
> I have a short howto on how to create Centos5 guest:
> http://wiki.1tux.org/wiki/Lxc/Installation/Guest/Centos/5 . Haven't
> had time to create one for Centos6 guest yet, but at least the above
> should give an idea of how to install a guest manually. You might also
> want to look at templates/lxc-fedora from the lattest userspace tools
> tarball (http://lxc.sourceforge.net/download/lxc/)
>

Many thanks Fajar. I am trying to build a new CentOS 6 image, but when I 
try to launch my lxc guest via virt-manager stops in "Enabling 
/etc/swaps:     [OK]" ... and no go.

My lxc guest fstab is:

rootfs		/		tmpfs	defaults		0 0
devpts		/dev/pts	devpts	gid=5,mode=620		0 0
sysfs		/sys		sysfs	defaults		0 0
proc		/proc		proc	nodev,noexec,nosuid	0 0
tmpfs		/dev/shm	tmpfs	defaults		0 0






-- 
CL Martinez
carlopmart {at} gmail {d0t} com




More information about the lxc-users mailing list