hello, i am new to lxc, i have created a lxc container on fedora 19 i created a container rootfs of fedora 19 by using yum --installroot=/containers/test1 --releasever=19 install openssh test1.xml file for container test1 <domain type="lxc"> <name>test1</name> <vcpu placement="static">1</vcpu> <cputune> <shares>1024</shares> <period>1000000</period> </cputune> <memtune> <hard_limit unit="M">1024</hard_limit> <soft_limit unit="M">128</soft_limit> <min_guarantee unit="M">64</min_guarantee> </memtune> <blkiotune> <weight>800</weight> </blkiotune> <memory unit="KiB">102400</memory> <os> <type>exe</type> <init>/bin/bash</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 accessmode="passthrough" type="mount"> <source dir="/containers/test1/"/> <target dir="/"/> </filesystem> <filesystem accessmode="passthrough" type="mount"> <source dir="/containers/test1/var"/> <target dir="/var"/> </filesystem> <filesystem accessmode="passthrough" type="mount"> <source dir="/containers/test1/dev"/> <target dir="/dev"/> </filesystem> <filesystem accessmode="passthrough" type="mount"> <source dir="/containers/test1/root"/> <target dir="/root"/> </filesystem> <filesystem accessmode="passthrough" type="mount"> <source dir="/containers/test1/home"/> <target dir="/home"/> </filesystem> <filesystem accessmode="passthrough" type="mount"> <source dir="/containers/test1/opt"/> <target dir="/opt"/> </filesystem> <filesystem accessmode="passthrough" type="mount"> <source dir="/containers/test1/media"/> <target dir="/media"/> </filesystem> <filesystem accessmode="passthrough" type="mount"> <source dir="/containers/test1/bin"/> <target dir="/bin"/> </filesystem> <filesystem accessmode="passthrough" type="mount"> <source dir="/containers/test1/lib64"/> <target dir="/lib64"/> </filesystem> <filesystem accessmode="passthrough" type="mount"> <source dir="/containers/test1/etc"/> <target dir="/etc"/> </filesystem> <filesystem accessmode="passthrough" type="mount"> <source dir="/containers/test1/lib"/> <target dir="/lib"/> </filesystem> <filesystem accessmode="passthrough" type="mount"> <source dir="/containers/test1/run"/> <target dir="/run"/> </filesystem> <filesystem accessmode="passthrough" type="mount"> <source dir="/containers/test1/srv"/> <target dir="/srv"/> </filesystem> <filesystem accessmode="passthrough" type="mount"> <source dir="/containers/test1/sys"/> <target dir="/sys"/> </filesystem> <filesystem accessmode="passthrough" type="mount"> <source dir="/containers/test1/tmp"/> <target dir="/tmp"/> </filesystem> <filesystem accessmode="passthrough" type="mount"> <source dir="/containers/test1/boot"/> <target dir="/boot"/> </filesystem> <filesystem accessmode="passthrough" type="mount"> <source dir="/containers/test1/usr"/> <target dir="/usr"/> </filesystem> <filesystem accessmode="passthrough" type="mount"> <source dir="/containers/test1/mnt"/> <target dir="/mnt"/> </filesystem> <filesystem accessmode="passthrough" type="mount"> <source dir="/containers/test1/sbin"/> <target dir="/sbin"/> </filesystem> <interface type="bridge"> <source bridge="br0"/> </interface> <console port="0" type="pty"/> </devices> </domain> the host network files: /etc/sysconfig/network-script/ifcfg-br0 DEVICE="br0" TYPE="Bridge" USERCTL="no" BOOTPROTO="dhcp" ONBOOT="yes" NM_CONTROLLED="no" /etc/sysconfig/network-script/ifcfg-p2p1 DEVICE="p2p1" BOOTPROTO="dhcp" BRIDGE="br0" NM_CONTROLLED="no" ONBOOT="yes" TYPE="Ethernet" the fstab of host # # /etc/fstab # Created by anaconda on Fri Jul 26 05:26:08 2013 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # UUID=b49ce5dc-afb7-4c8e-9487-c1ed101d9166 / ext4 defaults 1 1 UUID=3dfa07fd-a06b-4a1a-a3fd-4e2f5e0d0e6a /boot ext4 defaults 1 2 UUID=3d1cb255-721a-48d2-b2e9-86f52b5fbec6 swap swap defaults 0 0 none /sys/fs/cgroup cgroup defaults 0 0 when i try to start the container using virsh i get error virsh --connect lxc:// virsh # define /containers/test1/test1.xml Domain test1 defined from /containers/test1/test1.xml virsh # start test1 error: Failed to start domain test1 error: internal error guest failed to start: PATH=/bin:/sbin TERM=linux container=lxc-libvirt container_uuid=05a7239d-f610-4ae9-ad47-4bf47f2f9b54 LIBVIRT_LXC_UUID=05a7239d-f610-4ae9-ad47-4bf47f2f9b54 LIBVIRT_LXC_NAME=test1 /bin/lxc_defaultinit.sh Unable to send container continue message: Broken pipe has anyone face the same problem with fedora 19. can anyone guide me.. Thanks, Aarti Sawant
Daniel P. Berrange
2013-Jul-31 09:33 UTC
Re: [libvirt-users] start lxc container on fedora 19
On Wed, Jul 31, 2013 at 12:46:58PM +0530, Aarti Sawant wrote:> hello, > > i am new to lxc, i have created a lxc container on fedora 19 > i created a container rootfs of fedora 19 by using > yum --installroot=/containers/test1 --releasever=19 install openssh > > test1.xml file for container test1 > <domain type="lxc"> > <name>test1</name> > <vcpu placement="static">1</vcpu> > <cputune> > <shares>1024</shares> > <period>1000000</period> > </cputune> > <memtune> > <hard_limit unit="M">1024</hard_limit> > <soft_limit unit="M">128</soft_limit> > <min_guarantee unit="M">64</min_guarantee> > </memtune> > <blkiotune> > <weight>800</weight> > </blkiotune> > <memory unit="KiB">102400</memory> > <os> > <type>exe</type> > <init>/bin/bash</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 accessmode="passthrough" type="mount"> > <source dir="/containers/test1/"/> > <target dir="/"/> > </filesystem>> <filesystem accessmode="passthrough" type="mount"> > <source dir="/containers/test1/var"/> > <target dir="/var"/> > </filesystem>....snip more <filesystem> elements... Why are you adding all these sub-mounts for /var, /dev, etc, etc? You installed the entire OS tree into /containers/test1, so it should be sufficient to just have that first <filesystem> entry for '/'. You'd only want to add extra mounts for /var, etc if the directory on the host came from somewhere outside the /containers/test1 location. NB, also libvirt sets up /dev - you shouldn't try to override it, or you'll loose access to the pre-populate device nodes, which is probably what's causing your failure.> <interface type="bridge"> > <source bridge="br0"/> > </interface> > <console port="0" type="pty"/> > </devices> > </domain>Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
Thanks Daniel for suggestion, i have made changes in my xml script. I am able to set up lxc container on fedora 18 i created a container using yum yum --installroot=/containers/cont1 --releasever=18 install -y httpd openssh, bridge-utils, dhclient cont1.xml <domain type="lxc"> <name>cont1</name> <vcpu placement="static">1</vcpu> <cputune> <shares>1024</shares> <period>1000000</period> </cputune> <memtune> <hard_limit unit="M">256</hard_limit> <soft_limit unit="M">32</soft_limit> <min_guarantee unit="M">64</min_guarantee> </memtune> <blkiotune> <weight>800</weight> </blkiotune> <memory unit="KiB">102400</memory> <os> <type>exe</type> <init>/bin/lxc_defaultinit.sh</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 accessmode="passthrough" type="mount"> <source dir="/containers/cont1/"/> <target dir="/"/> </filesystem> <interface type="bridge"> <source bridge="br0"/> </interface> <console port="0" type="pty"/> </devices> </domain> Network setting at host /etc/sysconfig/network-script/ifcfg-p2p1 TYPE="Ethernet" DEVICE="p2p1" BOOTPROTO="dhcp" ONBOOT="yes" BRIDGE="br0" NM_CONTROLLED="no" /etc/sysconfig/network-script/ifcfg-br0 DEVICE="br0" TYPE="Bridge" USERCTL="no" ONBOOT="yes" BOOTPROTO="dhcp" NM_CONTROLLED="no" Network setting at Guest /containers/cont1/etc/sysconfig/network-script/ifcfg-eth0 TYPE="Ethernet" DEVICE="eth0" BOOTPROTO="static" ONBOOT="yes" GATEWAY=172.26.126.254 IPADDR=172.26.126.204 at host /etc/fstab tmpfs /dev/shm tmpfs defaults 0 0 devpts /dev/pts devpts defaults 0 0 sysfs /sys sysfs defaults 0 0 proc /proc proc defaults 0 0 none /sys/fs/cgroup cgroup defaults 0 0 at guest /containers/bin/lxc-defaultinit.sh #!/bin/bash export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/lib export PS1="[\u@\h \W]\$ " export HOME="/root" mount -t devtmpfs none /dev mount -t devpts none /dev/pts mount -t tmpfs none /dev/shm mount -t sysfs none /sys /etc/init.d/network start exec /bin/bash On Wed, Jul 31, 2013 at 3:03 PM, Daniel P. Berrange <berrange@redhat.com>wrote:> On Wed, Jul 31, 2013 at 12:46:58PM +0530, Aarti Sawant wrote: > > hello, > > > > i am new to lxc, i have created a lxc container on fedora 19 > > i created a container rootfs of fedora 19 by using > > yum --installroot=/containers/test1 --releasever=19 install openssh > > > > test1.xml file for container test1 > > <domain type="lxc"> > > <name>test1</name> > > <vcpu placement="static">1</vcpu> > > <cputune> > > <shares>1024</shares> > > <period>1000000</period> > > </cputune> > > <memtune> > > <hard_limit unit="M">1024</hard_limit> > > <soft_limit unit="M">128</soft_limit> > > <min_guarantee unit="M">64</min_guarantee> > > </memtune> > > <blkiotune> > > <weight>800</weight> > > </blkiotune> > > <memory unit="KiB">102400</memory> > > <os> > > <type>exe</type> > > <init>/bin/bash</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 accessmode="passthrough" type="mount"> > > <source dir="/containers/test1/"/> > > <target dir="/"/> > > </filesystem> > > > <filesystem accessmode="passthrough" type="mount"> > > <source dir="/containers/test1/var"/> > > <target dir="/var"/> > > </filesystem> > ....snip more <filesystem> elements... > > Why are you adding all these sub-mounts for /var, /dev, etc, etc? > > You installed the entire OS tree into /containers/test1, so it > should be sufficient to just have that first <filesystem> > entry for '/'. You'd only want to add extra mounts for > /var, etc if the directory on the host came from somewhere > outside the /containers/test1 location. > > NB, also libvirt sets up /dev - you shouldn't try to > override it, or you'll loose access to the pre-populate > device nodes, which is probably what's causing your > failure. > > > <interface type="bridge"> > > <source bridge="br0"/> > > </interface> > > <console port="0" type="pty"/> > > </devices> > > </domain> > > Daniel > -- > |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/:| > |: http://libvirt.org -o- http://virt-manager.org:| > |: http://autobuild.org -o- http://search.cpan.org/~danberr/:| > |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc:| >
Apparently Analagous Threads
- start lxc container on fedora 19
- Re: cgroups inside LXC containers losts memory limits after some time
- Re: Centos 7.1.1503 + libvirt 1.2.14 = broken direct network mode
- Centos 7.1.1503 + libvirt 1.2.14 = broken direct network mode
- 1.2.7 and 1.2.8 fail to start container: libvirt_lxc[4904]: segfault at 0 ip ...error 4 in libc-2.17.so[