[Lxc-users] help regarding lxc
hi Joerg Thnks 4 reply. I have executed the script now the error is gone but there is some problem. lxc-start -n guest lxc-start: No such file or directory - failed to exec /sbin/init lxc-start: invalid sequence number 1. expected 2 lxc-start: failed to spawn 'guest' lxc-start: Device or resource busy - failed to remove cgroup '/cgrouplxc/guest' Why it failed to exec /sbin/init? and what might be the solution to this. And i am not using any of the templates in creating the container. Regards, Nishant -- Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free Love Thy Logs t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev___ Lxc-users mailing list Lxc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-users
Re: [Lxc-users] help regarding lxc
do you have /sbin/init file in container's rootfs? e.g. /var/lib/lxc/guest/sbin/init On Tue, Aug 30, 2011 at 2:39 PM, nishant mungse nishantmun...@gmail.com wrote: hi Joerg Thnks 4 reply. I have executed the script now the error is gone but there is some problem. lxc-start -n guest lxc-start: No such file or directory - failed to exec /sbin/init lxc-start: invalid sequence number 1. expected 2 lxc-start: failed to spawn 'guest' lxc-start: Device or resource busy - failed to remove cgroup '/cgrouplxc/guest' Why it failed to exec /sbin/init? and what might be the solution to this. And i am not using any of the templates in creating the container. Regards, Nishant -- Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free Love Thy Logs t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev ___ Lxc-users mailing list Lxc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-users -- Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free Love Thy Logs t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev ___ Lxc-users mailing list Lxc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-users
Re: [Lxc-users] help regarding lxc
this file is needed. some form of bootstrap is need to setup these system files. On Tue, Aug 30, 2011 at 3:07 PM, nishant mungse nishantmun...@gmail.com wrote: hii Canhua No there is no such file. Regards, Nishant On Tue, Aug 30, 2011 at 12:20 PM, Canhua dreamerat...@gmail.com wrote: do you have /sbin/init file in container's rootfs? e.g. /var/lib/lxc/guest/sbin/init On Tue, Aug 30, 2011 at 2:39 PM, nishant mungse nishantmun...@gmail.com wrote: hi Joerg Thnks 4 reply. I have executed the script now the error is gone but there is some problem. lxc-start -n guest lxc-start: No such file or directory - failed to exec /sbin/init lxc-start: invalid sequence number 1. expected 2 lxc-start: failed to spawn 'guest' lxc-start: Device or resource busy - failed to remove cgroup '/cgrouplxc/guest' Why it failed to exec /sbin/init? and what might be the solution to this. And i am not using any of the templates in creating the container. Regards, Nishant -- Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free Love Thy Logs t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev ___ Lxc-users mailing list Lxc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-users -- Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free Love Thy Logs t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev ___ Lxc-users mailing list Lxc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-users
Re: [Lxc-users] [PATCH] multiple mods to lxc-clone
On Tue, Aug 30, 2011 at 1:08 AM, Serge Hallyn serge.hal...@canonical.com wrote: Thanks, Ramez. It looks good to me. My only comment would be that if the rootfs copy fails (either rsync or lvm clone), and you've frozen the original container, then you need to unfreeze the original container before erroring out. -serge good catch thanks resending in a bit Quoting Ramez Hanna (rha...@informatiq.org): * allow cloning of non-snapshot lvm devices * if no -s then create a copy of the lvm block device and copy data from the orig to the new container device * first take a snapshot, then use this snapshot to copy data, remove snapshot after done * if orig container is running freeze it while copying * in case lvm block device, the container is only frozen during creation of snapshot ~1 sec * use rsync -ax insted of cp -a * in case copying a live contrainer it won't copy runtine mounted files such as /proc, /sys and some /dev * new opts * fstype: type of fs for the newly created lvm device in case of non-snapshot lvm * lvprefix: prefix for new lvm device name. * do not delete the lines lxc.mount by default * check is fstab exists then copy it * only modify lines that contain lxc.mount =, debian template seems to not have that line but uses lxc.mount. lines which get screwed Signed-off-by: InformatiQ rha...@informatiq.org --- src/lxc/lxc-clone.in | 98 ++ 1 files changed, 75 insertions(+), 23 deletions(-) mode change 100644 = 100755 src/lxc/lxc-clone.in diff --git a/src/lxc/lxc-clone.in b/src/lxc/lxc-clone.in old mode 100644 new mode 100755 index 91944a0..d42160b --- a/src/lxc/lxc-clone.in +++ b/src/lxc/lxc-clone.in @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash # # lxc: linux Container library @@ -22,7 +22,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA usage() { - echo usage: lxc-clone -o orig -n new [-s] [-h] [-L fssize] [-v vgname] + echo usage: lxc-clone -o orig -n new [-s] [-h] [-L fssize] [-v vgname] [-p lxc_lv_prefix] [-t fstype] } help() { @@ -36,15 +36,19 @@ help() { echo -s : make the new rootfs a snapshot of the original echo fssize : size if creating a new fs. By default, 2G echo vgname : lvm volume group name, lxc by default + echo lvprefix : lvm volume name prefix, none by default, e.g. --lvprefix=lxc_ then new lxc lv name will be lxc_newname + echo fstype : new container file system type, ext3 by default (only works for non-snapshot lvm) } -shortoptions='ho:n:sL:v:' -longoptions='help,orig:,name:,snapshot,fssize,vgname' +shortoptions='ho:n:sL:v:p:t:' +longoptions='help,orig:,name:,snapshot,fssize:,vgname:,lvprefix:,fstype:' lxc_path=/var/lib/lxc bindir=/usr/bin snapshot=no lxc_size=2G lxc_vg=lxc +lxc_lv_prefix= +fstype=ext3 getopt=$(getopt -o $shortoptions --longoptions $longoptions -- $@) if [ $? != 0 ]; then @@ -63,6 +67,7 @@ while true; do -s|--snapshot) shift snapshot=yes + snapshot_opt=-s ;; -o|--orig) shift @@ -84,6 +89,11 @@ while true; do lxc_new=$1 shift ;; + -p|--lvprefix) + shift + lxc_lv_prefix=$1 + shift + ;; --) shift break;; @@ -141,50 +151,92 @@ trap ${bindir}/lxc-destroy -n $lxc_new; echo aborted; exit 1 SIGHUP SIGINT SIG mkdir -p $lxc_path/$lxc_new +hostname=$lxc_new + echo Tweaking configuration cp $lxc_path/$lxc_orig/config $lxc_path/$lxc_new/config sed -i '/lxc.utsname/d' $lxc_path/$lxc_new/config echo lxc.utsname = $hostname $lxc_path/$lxc_new/config -sed -i '/lxc.mount/d' $lxc_path/$lxc_new/config -echo lxc.mount = $lxc_path/$lxc_new/fstab $lxc_path/$lxc_new/config +grep lxc.mount = $lxc_path/$lxc_new/config /dev/null 21 { sed -i '/lxc.mount =/d' $lxc_path/$lxc_new/config; echo lxc.mount = $lxc_path/$lxc_new/fstab $lxc_path/$lxc_new/config; } -cp $lxc_path/$lxc_orig/fstab $lxc_path/$lxc_new/fstab -sed -i s@$lxc_path/$lxc_orig@$lxc_path/$lxc_new@ $lxc_path/$lxc_new/fstab +if [ -e $lxc_path/$lxc_orig/fstab ];then + cp $lxc_path/$lxc_orig/fstab $lxc_path/$lxc_new/fstab + sed -i s@$lxc_path/$lxc_orig@$lxc_path/$lxc_new@ $lxc_path/$lxc_new/fstab +fi echo Copying rootfs... rootfs=$lxc_path/$lxc_new/rootfs # First figure out if the old is a device. For now we only support # lvm devices. mounted=0 +#is container running +lxc-info -s -n $lxc_orig|grep RUNNING /dev/null 21 +if [ $? -ne 0 ]; then + container_running=True +fi sed -i '/lxc.rootfs/d' $lxc_path/$lxc_new/config oldroot=`grep lxc.rootfs $lxc_path/$lxc_orig/config | awk -F= '{ print $2 '}` if [ -b $oldroot ]; then # this is a device. If
[Lxc-users] [PATCH 2/3] *add the new opts to help() *set container_running=false
Signed-off-by: InformatiQ rha...@informatiq.org --- src/lxc/lxc-clone.in |6 -- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lxc/lxc-clone.in b/src/lxc/lxc-clone.in index d42160b..bc1af60 100755 --- a/src/lxc/lxc-clone.in +++ b/src/lxc/lxc-clone.in @@ -36,8 +36,8 @@ help() { echo -s : make the new rootfs a snapshot of the original echo fssize : size if creating a new fs. By default, 2G echo vgname : lvm volume group name, lxc by default -echo lvprefix : lvm volume name prefix, none by default, e.g. --lvprefix=lxc_ then new lxc lv name will be lxc_newname -echo fstype : new container file system type, ext3 by default (only works for non-snapshot lvm) +echo lvprefix: lvm volume name prefix, none by default, e.g. --lvprefix=lxc_ then new lxc lv name will be lxc_newname +echo fstype : new container file system type, ext3 by default (only works for non-snapshot lvm) } shortoptions='ho:n:sL:v:p:t:' @@ -174,6 +174,8 @@ mounted=0 lxc-info -s -n $lxc_orig|grep RUNNING /dev/null 21 if [ $? -ne 0 ]; then container_running=True +else +container_running=False fi sed -i '/lxc.rootfs/d' $lxc_path/$lxc_new/config oldroot=`grep lxc.rootfs $lxc_path/$lxc_orig/config | awk -F= '{ print $2 '}` -- 1.7.6 -- Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free Love Thy Logs t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev ___ Lxc-users mailing list Lxc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-users
Re: [Lxc-users] help regarding lxc
Hi Canhua I hv created a fedora container. commnd::lxc-start -n fedora Welcome to Fedora ... .. .. Setting hostname fedora: [ OK ] Checking filesystems [ OK ] mount: according to mtab, rootfs is already mounted on / Mounting local filesystems:[ OK ] Enabling local filesystem quotas: [ OK ] Enabling /etc/fstab swaps: [ OK ] hangs after this .. What should i do.?? i have deleted allthe contents form fstab also. What might be d problem??? plZ hlp me ASAP Regards, Nishant. On Tue, Aug 30, 2011 at 12:40 PM, Canhua dreamerat...@gmail.com wrote: this file is needed. some form of bootstrap is need to setup these system files. On Tue, Aug 30, 2011 at 3:07 PM, nishant mungse nishantmun...@gmail.com wrote: hii Canhua No there is no such file. Regards, Nishant On Tue, Aug 30, 2011 at 12:20 PM, Canhua dreamerat...@gmail.com wrote: do you have /sbin/init file in container's rootfs? e.g. /var/lib/lxc/guest/sbin/init On Tue, Aug 30, 2011 at 2:39 PM, nishant mungse nishantmun...@gmail.com wrote: hi Joerg Thnks 4 reply. I have executed the script now the error is gone but there is some problem. lxc-start -n guest lxc-start: No such file or directory - failed to exec /sbin/init lxc-start: invalid sequence number 1. expected 2 lxc-start: failed to spawn 'guest' lxc-start: Device or resource busy - failed to remove cgroup '/cgrouplxc/guest' Why it failed to exec /sbin/init? and what might be the solution to this. And i am not using any of the templates in creating the container. Regards, Nishant -- Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free Love Thy Logs t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev ___ Lxc-users mailing list Lxc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-users -- Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free Love Thy Logs t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev___ Lxc-users mailing list Lxc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-users
[Lxc-users] Fwd: help regarding lxc
-- Forwarded message -- From: Ramez Hanna rha...@informatiq.org Date: Tue, Aug 30, 2011 at 2:36 PM Subject: Re: [Lxc-users] help regarding lxc To: nishant mungse nishantmun...@gmail.com there is a lxc-fedora template which wors just fine for fedora releases prior to 15 lxc-create -n lxc -t fedora -- -R14 this will create a fedora 14 container that works for you I don't know about that tar file you downloaded, is it a fedora container? or just a fedora install tarred On Tue, Aug 30, 2011 at 2:25 PM, nishant mungse nishantmun...@gmail.com wrote: hiii 1.First i downloaded the fedora-11-x86.tar.gz into /home/nishant/fedora 2.tar -xvf fedora-11-x86.tar.gz in same folder 3.created fstab and conf file 4.lxc-create -n lxc -f /home/nishant/fedora.conf 5.lxc-start -n fedora. And after that what happened i have disp in prev thread. Regards, Nishant. On Tue, Aug 30, 2011 at 4:48 PM, Ramez Hanna rha...@informatiq.org wrote: On Tue, Aug 30, 2011 at 2:13 PM, nishant mungse nishantmun...@gmail.com wrote: Hi Canhua I hv created a fedora container. commnd::lxc-start -n fedora Welcome to Fedora ... .. .. Setting hostname fedora: [ OK ] Checking filesystems [ OK ] mount: according to mtab, rootfs is already mounted on / Mounting local filesystems: [ OK ] Enabling local filesystem quotas: [ OK ] Enabling /etc/fstab swaps: [ OK ] hangs after this .. What should i do.?? i have deleted allthe contents form fstab also. What might be d problem??? plZ hlp me ASAP Regards, Nishant. On Tue, Aug 30, 2011 at 12:40 PM, Canhua dreamerat...@gmail.com wrote: this file is needed. some form of bootstrap is need to setup these system files. On Tue, Aug 30, 2011 at 3:07 PM, nishant mungse nishantmun...@gmail.com wrote: hii Canhua No there is no such file. Regards, Nishant On Tue, Aug 30, 2011 at 12:20 PM, Canhua dreamerat...@gmail.com wrote: do you have /sbin/init file in container's rootfs? e.g. /var/lib/lxc/guest/sbin/init On Tue, Aug 30, 2011 at 2:39 PM, nishant mungse nishantmun...@gmail.com wrote: hi Joerg Thnks 4 reply. I have executed the script now the error is gone but there is some problem. lxc-start -n guest lxc-start: No such file or directory - failed to exec /sbin/init lxc-start: invalid sequence number 1. expected 2 lxc-start: failed to spawn 'guest' lxc-start: Device or resource busy - failed to remove cgroup '/cgrouplxc/guest' Why it failed to exec /sbin/init? and what might be the solution to this. And i am not using any of the templates in creating the container. Regards, Nishant -- Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free Love Thy Logs t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev ___ Lxc-users mailing list Lxc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-users -- Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free Love Thy Logs t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev ___ Lxc-users mailing list Lxc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-users how did you create the fedora container? -- -- BR RH -- -- BR RH -- Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free Love Thy Logs t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev ___ Lxc-users mailing list Lxc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-users
Re: [Lxc-users] Is it possible to create symbolic links between different containers
Quoting nishant mungse (nishantmun...@gmail.com): Hi all I want to create a sym link between different containers. Is it possible to create?and how? Hm. How about doing a bind mount instead? -- Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free Love Thy Logs t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev ___ Lxc-users mailing list Lxc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-users
Re: [Lxc-users] Is it possible to create symbolic links between different containers
You might be able to achieve this with mount bind - Original Message - From: nishant mungse nishantmun...@gmail.com To: lxc-users@lists.sourceforge.net, contain...@lists.linux-foundation.org Sent: Tuesday, August 30, 2011 7:38:07 AM Subject: [Lxc-users] Is it possible to create symbolic links between different containers Hi all I want to create a sym link between different containers. Is it possible to create?and how? Regards, Nishant. -- Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free Love Thy Logs t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev ___ Lxc-users mailing list Lxc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-users -- Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free Love Thy Logs t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev ___ Lxc-users mailing list Lxc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-users
Re: [Lxc-users] [PATCH 0/3] several mods to lxc-clone.in
On 08/30/2011 05:36 PM, Serge Hallyn wrote: Thanks. No objections to the patchset. (Other than, better to simply remove the code lines which you commented out - but no need for a new set for that). I haven't tested it, but it looks correct. Acked-by: Serge Hallyn serge.hal...@canonical.com Applied. -- Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free Love Thy Logs t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev ___ Lxc-users mailing list Lxc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-users
Re: [Lxc-users] [PATCH 2/2] lxc-fedora.in
On 08/28/2011 01:00 PM, Ramez Hanna wrote: * if not running on fedora host amd -R is not set, use fedora 14 as default * trap SIGHUP SIGINT SIGTERM, and cleanup before exiting Applied. -- Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free Love Thy Logs t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev ___ Lxc-users mailing list Lxc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-users