[lxc-devel] lxc-start and lucid container
nted '/lxc-oldrootfs-E19bcw/proc' lxc-start 1274106225.226 DEBUGlxc_conf - umounted '/lxc-oldrootfs-E19bcw/var/run' lxc-start 1274106225.243 DEBUGlxc_conf - umounted '/lxc-oldrootfs-E19bcw/var/lock' lxc-start 1274106225.258 DEBUGlxc_conf - umounted '/lxc-oldrootfs-E19bcw/lib/init/rw' lxc-start 1274106225.274 DEBUGlxc_conf - umounted '/lxc-oldrootfs-E19bcw/boot' lxc-start 1274106225.290 DEBUGlxc_conf - umounted '/lxc-oldrootfs-E19bcw/lxc-cgroup' lxc-start 1274106225.310 DEBUGlxc_conf - umounted '/lxc-oldrootfs-E19bcw/var/lib/lxc/lucid/rootfs/dev/console' lxc-start 1274106225.327 DEBUGlxc_conf - umounted '/lxc-oldrootfs-E19bcw/var/lib/lxc/lucid/rootfs/dev/tty1' lxc-start 1274106225.342 DEBUGlxc_conf - umounted '/lxc-oldrootfs-E19bcw/var/lib/lxc/lucid/rootfs/dev/tty2' lxc-start 1274106225.359 DEBUGlxc_conf - umounted '/lxc-oldrootfs-E19bcw/var/lib/lxc/lucid/rootfs/dev/tty3' lxc-start 1274106225.374 DEBUGlxc_conf - umounted '/lxc-oldrootfs-E19bcw/var/lib/lxc/lucid/rootfs/dev/tty4' lxc-start 1274106225.390 DEBUGlxc_conf - umounted '/lxc-oldrootfs-E19bcw/dev' lxc-start 1274106225.406 DEBUGlxc_conf - umounted '/lxc-oldrootfs-E19bcw/sys' lxc-start 1274106225.423 DEBUGlxc_conf - umounted '/lxc-oldrootfs-E19bcw' lxc-start 1274106225.424 INFO lxc_conf - pivoted to '/tmp/lxc-rNhQTX7' lxc-start 1274106225.424 INFO lxc_conf - created new pts instance lxc-start 1274106225.424 DEBUGlxc_conf - capabilities has been setup lxc-start 1274106225.424 NOTICE lxc_conf - 'lucid' is setup. lxc-start 1274106225.424 NOTICE lxc_start - exec'ing '/sbin/init' lxc-start 1274106225.425 NOTICE lxc_start - '/sbin/init' started with pid '20474' lxc-start 1274106225.425 DEBUGlxc_utils - closing fd '1' lxc-start 1274106225.425 DEBUGlxc_utils - closing fd '0' lxc-start 1274106225.425 DEBUGlxc_utils - closed all inherited file descriptors init: Handling startup event init: tty1 goal changed from stop to start init: tty1 state changed from waiting to starting init: Handling starting event init: tty1 state changed from starting to pre-start init: tty1 state changed from pre-start to spawned init: tty1 main process (2) init: tty1 state changed from spawned to post-start init: tty1 state changed from post-start to running init: Handling started event and the processes inside the container are: r...@ubuntu01:~# lxc-ps --lxc aux CONTAINER USER PID %CPU %MEMVSZ RSS TTY STAT START TIME COMMAND lucid root 20474 0.0 0.2 2260 640 ?Ss 16:23 0:00 /sbin/init lucid root 20487 0.0 0.1 1720 492 pts/3Ss+ 16:23 0:00 /sbin/getty -8 38400 tty1 r...@ubuntu01:~# (well, I disabled all upstart services but tty1) Any hints? -- Wilhelm -- ___ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel
Re: [lxc-devel] [Lxc-users] lxc-start and lucid container
Am 17.05.2010 14:59, schrieb zitta.fr: > Hi, > > try this : > > cat > /path_to_lucid_root/etc/init/console.conf > # console - getty > # > # This service maintains a getty on stdin from the point the system is > # started until it is shut down again. > > start on stopped rc RUNLEVEL=[2345] > stop on runlevel [!2345] > > respawn > exec /sbin/getty -8 38400 console > this is exactly the contents of /etc/init/tty1.conf but it doesn't work > Regards, > > Guillaume ZITTA > > Le 17/05/2010 16:31, Wilhelm a écrit : >> Hi all, >> >> I have a slight problem using a lucid container (on a lucid host): if I >> start the container via lxc-start, no console login starts up. I have to >> use lxc-console from a differnet terminal. If I use a lenny container, >> lxc-start shows the start up log messages and finally the getty/login. >> >> I'm using the lxc-packages from lucid: >> >> r...@ubuntu01:~# dpkg -l lxc >> Gewünscht=Unbekannt/Installieren/R=Entfernen/P=Vollständig Löschen/Halten >> | Status=Nicht/Installiert/Config/U=Entpackt/Fehlgeschl. Konfiguration/ >>Halb installiert/Trigger erWartet/Trigger anhängig >> |/ Fehler?=(kein)/R=Neuinstallation notwendig (Status, Fehler: >> GROSS=schlecht) >> ||/ Name >> VersionBeschreibung >> +++-==-==- >> ii lxc >> 0.6.5-1Linux containers userspace tools >> >> >> The start trace is: >> >> r...@ubuntu01:/var/lib/lxc/lucid# lxc-start -n lucid >> --logfile=/dev/stderr --logpriority=TRACE -- /sbin/init --verbose >> lxc-start 1274106224.666 INFO lxc_conf - tty's configured >> lxc-start 1274106224.669 DEBUGlxc_start - sigchild handler set >> lxc-start 1274106224.669 INFO lxc_start - 'lucid' is initialized >> lxc-start 1274106224.681 DEBUGlxc_conf - instanciated macvlan >> 'mcwEvnvl', index is '8' and mode '0' >> lxc-start 1274106224.699 DEBUGlxc_cgroup - using cgroup >> mounted at '/lxc-cgroup' >> lxc-start 1274106224.699 DEBUGlxc_cgroup - >> '/lxc-cgroup/20474' renamed to '/lxc-cgroup/lucid' >> lxc-start 1274106224.711 DEBUGlxc_conf - move 'eth1' to '20474' >> lxc-start 1274106224.711 INFO lxc_conf - 'lucid' hostname has >> been setup >> lxc-start 1274106224.713 DEBUGlxc_conf - mac address >> '4a:49:43:49:79:bd' on 'eth0' has been setup >> lxc-start 1274106224.714 DEBUGlxc_conf - 'eth0' has been setup >> lxc-start 1274106224.714 INFO lxc_conf - network has been setup >> lxc-start 1274106224.715 DEBUGlxc_cgroup - using cgroup >> mounted at '/lxc-cgroup' >> lxc-start 1274106224.716 DEBUGlxc_conf - cgroup >> 'devices.deny' set to 'a' >> lxc-start 1274106224.716 DEBUGlxc_conf - cgroup >> 'devices.allow' set to 'c 1:3 rwm' >> lxc-start 1274106224.716 DEBUGlxc_conf - cgroup >> 'devices.allow' set to 'c 1:5 rwm' >> lxc-start 1274106224.716 DEBUGlxc_conf - cgroup >> 'devices.allow' set to 'c 5:1 rwm' >> lxc-start 1274106224.716 DEBUGlxc_conf - cgroup >> 'devices.allow' set to 'c 5:0 rwm' >> lxc-start 1274106224.716 DEBUGlxc_conf - cgroup >> 'devices.allow' set to 'c 4:0 rwm' >> lxc-start 1274106224.716 DEBUGlxc_conf - cgroup >> 'devices.allow' set to 'c 4:1 rwm' >> lxc-start 1274106224.716 DEBUGlxc_conf - cgroup >> 'devices.allow' set to 'c 1:9 rwm' >> lxc-start 1274106224.716 DEBUGlxc_conf - cgroup >> 'devices.allow' set to 'c 1:8 rwm' >> lxc-start 1274106224.716 DEBUGlxc_conf - cgroup >> 'devices.allow' set to 'c 136:* rwm' >> lxc-start 1274106224.716 DEBUGlxc_conf - cgroup >> 'devices.allow' set to 'c 5:2 rwm' >> lxc-start 1274106224.716 DEBUGlxc_conf - cgroup >> 'devices.allow' set to 'c 254:0 rwm' >> lxc-start 1274106224.716 INFO lxc_conf - cgroup has been setup
Re: [lxc-devel] [Lxc-users] lxc-start and lucid container
Am 17.05.2010 16:53, schrieb l...@zitta.fr: > Le 17/05/2010 18:09, Wilhelm a écrit : > >> Am 17.05.2010 14:59, schrieb zitta.fr: >> >>> Hi, >>> >>> try this : >>> >>> cat> /path_to_lucid_root/etc/init/console.conf >>> # console - getty >>> # >>> # This service maintains a getty on stdin from the point the >>> system is >>> # started until it is shut down again. >>> >>> start on stopped rc RUNLEVEL=[2345] >>> stop on runlevel [!2345] >>> >>> respawn >>> exec /sbin/getty -8 38400 console >>> >>> >> this is exactly the contents of /etc/init/tty1.conf >> > Sorry, I did let a comment that could makes you think it is tty1.conf > But no, it is not. > Look at this diff : > > --- tty1.conf2010-04-02 02:13:25.0 +0200 > +++ console.conf2010-05-17 16:59:53.770083492 +0200 > @@ -1,4 +1,4 @@ > -# tty1 - getty > +# console - getty > # > # This service maintains a getty on tty1 from the point the system is > # started until it is shut down again. > @@ -7,4 +7,4 @@ > stop on runlevel [!2345] > > respawn > -exec /sbin/getty -8 38400 tty1 > +exec /sbin/getty -8 38400 console > >> but it doesn't work >> > did you even try? > oh yes, overlooked that. Ok, works fine! Thanks! >> >>> Regards, >>> >>> Guillaume ZITTA >>> >>> Le 17/05/2010 16:31, Wilhelm a écrit : >>> >>>> Hi all, >>>> >>>> I have a slight problem using a lucid container (on a lucid host): if I >>>> start the container via lxc-start, no console login starts up. I >>>> have to >>>> use lxc-console from a differnet terminal. If I use a lenny container, >>>> lxc-start shows the start up log messages and finally the getty/login. >>>> >>>> I'm using the lxc-packages from lucid: >>>> >>>> r...@ubuntu01:~# dpkg -l lxc >>>> Gewünscht=Unbekannt/Installieren/R=Entfernen/P=Vollständig >>>> Löschen/Halten >>>> | Status=Nicht/Installiert/Config/U=Entpackt/Fehlgeschl. Konfiguration/ >>>> Halb installiert/Trigger erWartet/Trigger anhängig >>>> |/ Fehler?=(kein)/R=Neuinstallation notwendig (Status, Fehler: >>>> GROSS=schlecht) >>>> ||/ Name >>>> VersionBeschreibung >>>> +++-==-==- >>>> >>>> ii lxc >>>> 0.6.5-1Linux containers userspace tools >>>> >>>> >>>> The start trace is: >>>> >>>> r...@ubuntu01:/var/lib/lxc/lucid# lxc-start -n lucid >>>> --logfile=/dev/stderr --logpriority=TRACE -- /sbin/init --verbose >>>> lxc-start 1274106224.666 INFO lxc_conf - tty's configured >>>> lxc-start 1274106224.669 DEBUGlxc_start - sigchild >>>> handler set >>>> lxc-start 1274106224.669 INFO lxc_start - 'lucid' is >>>> initialized >>>> lxc-start 1274106224.681 DEBUGlxc_conf - instanciated >>>> macvlan >>>> 'mcwEvnvl', index is '8' and mode '0' >>>> lxc-start 1274106224.699 DEBUGlxc_cgroup - using cgroup >>>> mounted at '/lxc-cgroup' >>>> lxc-start 1274106224.699 DEBUGlxc_cgroup - >>>> '/lxc-cgroup/20474' renamed to '/lxc-cgroup/lucid' >>>> lxc-start 1274106224.711 DEBUGlxc_conf - move 'eth1' to >>>> '20474' >>>> lxc-start 1274106224.711 INFO lxc_conf - 'lucid' >>>> hostname has >>>> been setup >>>> lxc-start 1274106224.713 DEBUGlxc_conf - mac address >>>> '4a:49:43:49:79:bd' on 'eth0' has been setup >>>> lxc-start 1274106224.714 DEBUGlxc_conf - 'eth0' has been >>>> setup >>>> lxc-start 1274106224.714 INFO lxc_conf - network has >>>> been setup >>>> lxc-start 1274106224.715 DEBUGlxc_cgroup - using cgroup >>>> mounted at '/lxc-cgroup' >>>>
[lxc-devel] Using initctl inside a container with upstart?
Hi all, is it safe to use initctl in a container using upstart (as ubuntu lucid)? Especially, upstart-init uses an abstract unix-socket: connect(3, {sa_family=AF_FILE, path=@"/com/ubuntu/upstart"}, 22) = 0 Is this socket separated from the parent (host) namespace, so the container can't affect the host-system? -- Wilhelm -- ___ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel
[lxc-devel] template-script for ubuntu [lucid] containers
Hi, for all interested: attached you'll find a template script for ubuntu containers. -- Wilhelm #!/bin/bash # # lxc: linux Container library configure_ubuntu() { rootfs=$1 hostname=$2 # disable selinux in ubuntu mkdir -p $rootfs/selinux echo 0 > $rootfs/selinux/enforce # configure the network using the dhcp cat < $rootfs/etc/network/interfaces auto lo iface lo inet loopback auto eth0 iface eth0 inet dhcp EOF # set the hostname cat < $rootfs/etc/hostname $hostname EOF # set minimal hosts cat < $rootfs/etc/hosts 127.0.0.1 localhost $hostname EOF # provide the lxc service cat < $rootfs/etc/init/lxc.conf # fake some events needed for correct startup other services description "Container Upstart" start on startup script rm -rf /var/run/* /sbin/initctl emit stopped JOB=udevtrigger /sbin/initctl emit started JOB=udev end script EOF cat < $rootfs/lib/init/fstab # /lib/init/fstab: lxc system fstab none/spu spufs gid=spu,optional 0 0 none/tmp nonedefaults 0 0 none/var/run tmpfs mode=0755,nosuid,showthrough 0 0 none/var/lock tmpfs nodev,noexec,nosuid,showthrough 0 0 none/lib/init/rw tmpfs mode=0755,nosuid,optional 0 0 EOF # reconfigure some services chroot $rootfs locale-gen de_DE.UTF-8 # remove pointless services in a container chroot $rootfs /usr/sbin/update-rc.d -f ondemand remove chroot $rootfs /bin/bash -c 'cd /etc/init; for f in $(ls u*.conf); do echo $f; mv $f $f.orig; done' chroot $rootfs /bin/bash -c 'cd /etc/init; for f in $(ls tty[2-9].conf); do echo $f; mv $f $f.orig; done' chroot $rootfs /bin/bash -c 'cd /etc/init; for f in $(ls plymouth*.conf); do echo $f; mv $f $f.orig; done' chroot $rootfs /bin/bash -c 'cd /etc/init; for f in $(ls hwclock*.conf); do echo $f; mv $f $f.orig; done' chroot $rootfs /bin/bash -c 'cd /etc/init; for f in $(ls module*.conf); do echo $f; mv $f $f.orig; done' echo "Please change root-password !" echo "root:root" | chroot /usr/local/var/lib/lxc/test/rootfs chpasswd } download_ubuntu() { packages=dialog,apt,resolvconf,iproute,inetutils-ping,vim,dhcp3-client,ssh,lsb-release cache=$1 arch=$2 # check the mini ubuntu was not already downloaded mkdir -p "$cache/partial-$arch" if [ $? -ne 0 ]; then echo "Failed to create '$cache/partial-$arch' directory" return 1 fi # download a mini ubuntu into a cache echo "Downloading ubuntu minimal ..." debootstrap --verbose --variant=minbase --components=main,universe --arch=$arch --include=$packages lucid $cache/partial-$arch if [ $? -ne 0 ]; then echo "Failed to download the rootfs, aborting." return 1 fi mv "$1/partial-$arch" "$1/rootfs-$arch" echo "Download complete." return 0 } copy_ubuntu() { cache=$1 arch=$2 rootfs=$3 # make a local copy of the miniubuntu echo -n "Copying rootfs to $rootfs ..." cp -a $cache/rootfs-$arch $rootfs || return 1 return 0 } install_ubuntu() { cache="/var/cache/lxc/ubuntu" rootfs=$1 mkdir -p /var/lock/subsys/ ( flock -n -x 200 if [ $? -ne 0 ]; then echo "Cache repository is busy." return 1 fi arch=$(arch) if [ "$arch" == "x86_64" ]; then arch=amd64 fi if [ "$arch" == "i686" ]; then arch=i386 fi echo "Checking cache download in $cache/rootfs-$arch ... " if [ ! -e "$cache/rootfs-$arch" ]; then download_ubuntu $cache $arch if [ $? -ne 0 ]; then echo "Failed to download 'ubuntu base'" return 1 fi fi echo "Copy $cache/rootfs-$arch to $rootfs ... " copy_ubuntu $cache $arch $rootfs if [ $? -ne 0 ]; then echo "Failed to copy rootfs" return 1 fi return 0 ) 200>/var/lock/subsys/lxc return $? } copy_configuration() { path=$1 rootfs=$2 name=$3 cat < $path/config # Container with network virtualized using the macvlan device driver lxc.utsname = $name lxc.network.type = macvlan lxc.network.flags = up lxc.network.link = eth1 lxc.network.hwaddr = 4a:49:43:49:79:03 lxc.network.macvlan.mode = vepa lxc.tty = 4 lxc.pts = 1024 lxc.rootfs = $rootfs lxc.mount =
Re: [lxc-devel] template-script for ubuntu [lucid] containers
Am 30.05.2010 20:19, schrieb Michel Normand: On 30/05/2010 19:07, Wilhelm wrote: Hi, for all interested: attached you'll find a template script for ubuntu containers. interesting attachment. could we take it in lxc as a new template exemple in scripts/lxc-ubuntu.in ? Sure! Attached I have the polished version with GPL, author and based-on ... Please feel free to include it into LXC. It will need few adaptations using some "@xxx@" but easy to change. ok. -- Wilhelm #!/bin/bash # # template script for generating ubuntu/lucid container for LXC # # This script is based on lxc-debian (Daniel Lezcano ) # # Copyright © 2010 Wilhelm Meier # Author: Wilhelm Meier # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2, as # published by the Free Software Foundation. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # configure_ubuntu() { rootfs=$1 hostname=$2 # disable selinux in ubuntu mkdir -p $rootfs/selinux echo 0 > $rootfs/selinux/enforce # configure the network using the dhcp cat < $rootfs/etc/network/interfaces auto lo iface lo inet loopback auto eth0 iface eth0 inet dhcp EOF # set the hostname cat < $rootfs/etc/hostname $hostname EOF # set minimal hosts cat < $rootfs/etc/hosts 127.0.0.1 localhost $hostname EOF # provide the lxc service cat < $rootfs/etc/init/lxc.conf # fake some events needed for correct startup other services description "Container Upstart" start on startup script rm -rf /var/run/* /sbin/initctl emit stopped JOB=udevtrigger /sbin/initctl emit started JOB=udev end script EOF cat < $rootfs/lib/init/fstab # /lib/init/fstab: lxc system fstab none/spu spufs gid=spu,optional 0 0 none/tmp nonedefaults 0 0 none/var/run tmpfs mode=0755,nosuid,showthrough 0 0 none/var/lock tmpfs nodev,noexec,nosuid,showthrough 0 0 none/lib/init/rw tmpfs mode=0755,nosuid,optional 0 0 EOF # reconfigure some services chroot $rootfs locale-gen de_DE.UTF-8 # remove pointless services in a container chroot $rootfs /usr/sbin/update-rc.d -f ondemand remove chroot $rootfs /bin/bash -c 'cd /etc/init; for f in $(ls u*.conf); do echo $f; mv $f $f.orig; done' chroot $rootfs /bin/bash -c 'cd /etc/init; for f in $(ls tty[2-9].conf); do echo $f; mv $f $f.orig; done' chroot $rootfs /bin/bash -c 'cd /etc/init; for f in $(ls plymouth*.conf); do echo $f; mv $f $f.orig; done' chroot $rootfs /bin/bash -c 'cd /etc/init; for f in $(ls hwclock*.conf); do echo $f; mv $f $f.orig; done' chroot $rootfs /bin/bash -c 'cd /etc/init; for f in $(ls module*.conf); do echo $f; mv $f $f.orig; done' echo "Please change root-password !" echo "root:root" | chroot /usr/local/var/lib/lxc/test/rootfs chpasswd } download_ubuntu() { packages=dialog,apt,resolvconf,iproute,inetutils-ping,vim,dhcp3-client,ssh,lsb-release cache=$1 arch=$2 # check the mini ubuntu was not already downloaded mkdir -p "$cache/partial-$arch" if [ $? -ne 0 ]; then echo "Failed to create '$cache/partial-$arch' directory" return 1 fi # download a mini ubuntu into a cache echo "Downloading ubuntu minimal ..." debootstrap --verbose --variant=minbase --components=main,universe --arch=$arch --include=$packages lucid $cache/partial-$arch if [ $? -ne 0 ]; then echo "Failed to download the rootfs, aborting." return 1 fi mv "$1/partial-$arch" "$1/rootfs-$arch" echo "Download complete." return 0 } copy_ubuntu() { cache=$1 arch=$2 rootfs=$3 # make a local copy of the miniubuntu echo -n "Copying rootfs to $rootfs ..." cp -a $cache/rootfs-$arch $rootfs || return 1 return 0 } install_ubuntu() { cache="/var/cache/lxc/ubuntu" rootfs=$1 mkdir -p /var/lock/subsys/ ( flock -n -x 200 if [ $? -ne 0 ]; then echo "Cache repository is busy." return 1 fi arch=$(arch) if [ "
Re: [lxc-devel] template-script for ubuntu [lucid] containers
Am 01.06.2010 16:06, schrieb Daniel Lezcano: On 06/01/2010 06:04 PM, Daniel Lezcano wrote: On 05/30/2010 07:07 PM, Wilhelm wrote: Hi, for all interested: attached you'll find a template script for ubuntu containers. Hi Willem, thanks a lot for the script, I fixed some nasty things but I was happy to play with it :) Do you mind to modify the script in order to have '/var/tmp' not being sorry, I meant '/var/run' ok, changed it in the attached script (and added the patches you posted and some other tweaks) mounted as a tmpfs, so the mechanism within lxc can 'shutdown' / 'reboot' properly ? but a "halt" from inside the container isn't handled properly: the init-process still remains ... Any ideas? Thanks -- Daniel -- Wilhelm #!/bin/bash # # template script for generating ubuntu/lucid container for LXC # # This script is based on lxc-debian (Daniel Lezcano ) # # Copyright © 2010 Wilhelm Meier # Author: Wilhelm Meier # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2, as # published by the Free Software Foundation. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # configure_ubuntu() { rootfs=$1 hostname=$2 # disable selinux in ubuntu mkdir -p $rootfs/selinux echo 0 > $rootfs/selinux/enforce # configure the network using the dhcp cat < $rootfs/etc/network/interfaces auto lo iface lo inet loopback auto eth0 iface eth0 inet dhcp EOF # set the hostname cat < $rootfs/etc/hostname $hostname EOF # set minimal hosts cat < $rootfs/etc/hosts 127.0.0.1 localhost $hostname EOF # provide the lxc service cat < $rootfs/etc/init/lxc.conf # fake some events needed for correct startup other services description "Container Upstart" start on startup script rm -rf /var/run/*.pid rm -rf /var/run/network/* /sbin/initctl emit stopped JOB=udevtrigger --no-wait /sbin/initctl emit started JOB=udev --no-wait end script EOF cat < $rootfs/lib/init/fstab # /lib/init/fstab: lxc system fstab none/spu spufs gid=spu,optional 0 0 none/tmp nonedefaults 0 0 #none/var/run tmpfs mode=0755,nosuid,showthrough 0 0 none/var/lock tmpfs nodev,noexec,nosuid,showthrough 0 0 none/lib/init/rw tmpfs mode=0755,nosuid,optional 0 0 EOF # reconfigure some services if [ -z "$LANG" ]; then chroot $rootfs locale-gen en_US.UTF-8 chroot $rootfs update-locale LANG=en_US.UTF-8 else chroot $rootfs locale-gen $LANG chroot $rootfs update-locale LANG=$LANG fi # remove pointless services in a container chroot $rootfs /usr/sbin/update-rc.d -f ondemand remove chroot $rootfs /bin/bash -c 'cd /etc/init; for f in $(ls u*.conf); do mv $f $f.orig; done' chroot $rootfs /bin/bash -c 'cd /etc/init; for f in $(ls tty[2-9].conf); do mv $f $f.orig; done' chroot $rootfs /bin/bash -c 'cd /etc/init; for f in $(ls plymouth*.conf); do mv $f $f.orig; done' chroot $rootfs /bin/bash -c 'cd /etc/init; for f in $(ls hwclock*.conf); do mv $f $f.orig; done' chroot $rootfs /bin/bash -c 'cd /etc/init; for f in $(ls module*.conf); do mv $f $f.orig; done' echo "Please change root-password !" echo "root:root" | chroot $rootfs chpasswd return 0 } download_ubuntu() { packages=dialog,apt,apt-utils,resolvconf,iproute,inetutils-ping,vim,dhcp3-client,ssh,lsb-release cache=$1 arch=$2 # check the mini ubuntu was not already downloaded mkdir -p "$cache/partial-$arch" if [ $? -ne 0 ]; then echo "Failed to create '$cache/partial-$arch' directory" return 1 fi # download a mini ubuntu into a cache echo "Downloading ubuntu minimal ..." debootstrap --verbose --variant=minbase --components=main,universe --arch=$arch --include=$packages lucid $cache/partial-$arch if [ $? -ne 0 ]; then echo "Failed to download the rootfs, aborting." return 1 fi mv "$1/partial-$arch" "$1/rootfs-$arch" echo "Download complet
Re: [lxc-devel] template-script for ubuntu [lucid] containers
Am 01.06.2010 20:05, schrieb Daniel Lezcano: > On 06/01/2010 09:50 PM, Wilhelm wrote: >> Am 01.06.2010 16:06, schrieb Daniel Lezcano: >>> On 06/01/2010 06:04 PM, Daniel Lezcano wrote: >>>> On 05/30/2010 07:07 PM, Wilhelm wrote: >>>>> Hi, >>>>> >>>>> for all interested: attached you'll find a template script for ubuntu >>>>> containers. >>>>> >>>> Hi Willem, >>>> >>>> thanks a lot for the script, I fixed some nasty things but I was happy >>>> to play with it :) >>>> >>>> Do you mind to modify the script in order to have '/var/tmp' not being >>> >>> sorry, I meant '/var/run' >> >> ok, changed it in the attached script (and added the patches you >> posted and some other tweaks) >>> >>> >>>> mounted as a tmpfs, so the mechanism within lxc can 'shutdown' / >>>> 'reboot' properly ? >> but a "halt" from inside the container isn't handled properly: the >> init-process still remains ... >> Any ideas? > > I added a mechanism to watch the utmp file in the container's rootfs > in lxc. > This is not available for lxc 0.6.5, do you have this version ? > No, I used latest git. -- Wilhelm -- ___ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel
Re: [lxc-devel] template-script for ubuntu [lucid] containers
Am 01.06.2010 20:05, schrieb Daniel Lezcano: > On 06/01/2010 09:50 PM, Wilhelm wrote: >> Am 01.06.2010 16:06, schrieb Daniel Lezcano: >>> On 06/01/2010 06:04 PM, Daniel Lezcano wrote: >>>> On 05/30/2010 07:07 PM, Wilhelm wrote: >>>>> Hi, >>>>> >>>>> for all interested: attached you'll find a template script for ubuntu >>>>> containers. >>>>> >>>> Hi Willem, >>>> >>>> thanks a lot for the script, I fixed some nasty things but I was happy >>>> to play with it :) >>>> >>>> Do you mind to modify the script in order to have '/var/tmp' not being >>> >>> sorry, I meant '/var/run' >> >> ok, changed it in the attached script (and added the patches you >> posted and some other tweaks) >>> >>> >>>> mounted as a tmpfs, so the mechanism within lxc can 'shutdown' / >>>> 'reboot' properly ? >> but a "halt" from inside the container isn't handled properly: the >> init-process still remains ... >> Any ideas? > > I added a mechanism to watch the utmp file in the container's rootfs > in lxc. > This is not available for lxc 0.6.5, do you have this version ? > latest git and here ist the log with issuing halt insige the container: r...@ubuntu01:~# lxc-start -n test2 --logfile=/dev/stderr --logpriority=TRACE lxc-start 1275423291.064 DEBUGlxc_conf - allocated pty '/dev/pts/1' (4/5) lxc-start 1275423291.065 DEBUGlxc_conf - allocated pty '/dev/pts/2' (6/7) lxc-start 1275423291.065 DEBUGlxc_conf - allocated pty '/dev/pts/3' (8/9) lxc-start 1275423291.065 DEBUGlxc_conf - allocated pty '/dev/pts/4' (10/11) lxc-start 1275423291.065 INFO lxc_conf - tty's configured lxc-start 1275423291.066 DEBUGlxc_start - sigchild handler set lxc-start 1275423291.066 INFO lxc_start - 'test2' is initialized lxc-start 1275423291.076 DEBUGlxc_conf - instanciated macvlan 'mcPR3qjD', index is '8' and mode '2' lxc-start 1275423291.089 DEBUGlxc_cgroup - using cgroup mounted at '/lxc-cgroup' lxc-start 1275423291.089 DEBUGlxc_cgroup - '/lxc-cgroup/4052' renamed to '/lxc-cgroup/test2' lxc-start 1275423291.092 DEBUGlxc_conf - move 'eth0' to '4052' lxc-start 1275423291.092 INFO lxc_conf - 'test2' hostname has been setup lxc-start 1275423291.094 DEBUGlxc_conf - mac address '4a:49:43:49:79:03' on 'eth0' has been setup lxc-start 1275423291.095 DEBUGlxc_conf - 'eth0' has been setup lxc-start 1275423291.095 INFO lxc_conf - network has been setup lxc-start 1275423291.099 DEBUGlxc_cgroup - using cgroup mounted at '/lxc-cgroup' lxc-start 1275423291.105 DEBUGlxc_conf - cgroup 'devices.deny' set to 'a' lxc-start 1275423291.105 DEBUGlxc_conf - cgroup 'devices.allow' set to 'c 1:3 rwm' lxc-start 1275423291.105 DEBUGlxc_conf - cgroup 'devices.allow' set to 'c 1:5 rwm' lxc-start 1275423291.105 DEBUGlxc_conf - cgroup 'devices.allow' set to 'c 5:1 rwm' lxc-start 1275423291.105 DEBUGlxc_conf - cgroup 'devices.allow' set to 'c 5:0 rwm' lxc-start 1275423291.105 DEBUGlxc_conf - cgroup 'devices.allow' set to 'c 4:0 rwm' lxc-start 1275423291.105 DEBUGlxc_conf - cgroup 'devices.allow' set to 'c 4:1 rwm' lxc-start 1275423291.105 DEBUGlxc_conf - cgroup 'devices.allow' set to 'c 1:9 rwm' lxc-start 1275423291.105 DEBUGlxc_conf - cgroup 'devices.allow' set to 'c 1:8 rwm' lxc-start 1275423291.105 DEBUGlxc_conf - cgroup 'devices.allow' set to 'c 136:* rwm' lxc-start 1275423291.105 DEBUGlxc_conf - cgroup 'devices.allow' set to 'c 5:2 rwm' lxc-start 1275423291.105 DEBUGlxc_conf - cgroup 'devices.allow' set to 'c 254:0 rwm' lxc-start 1275423291.105 INFO lxc_conf - cgroup has been setup lxc-start 1275423291.106 DEBUGlxc_conf - mounted proc on /usr/local/var/lib/lxc/test2/rootfs/proc, type proc lxc-start 1275423291.106 DEBUGlxc_conf - mounted devpts on /usr/local/var/lib/lxc/test2/rootfs/dev/pts, type devpts lxc-start 1275423291.107 DEBUGlxc_conf - mounted sysfs on /usr/local/var/lib/lxc/test2/rootfs/sys, type sysfs lxc-start 1275423291.107
[lxc-devel] Question using macvlan
Hi, I think this is a frequently asked question, but I can't find the answer ... The host machine has 2 NIC, eth0 and eth1. eth0 is used a an internal and eth1 is used as an external interface. The lxc-container is setup using a macvlan interface in bridge mode on eth0 with a static ip address. I can't figure out how the container can communicate with the host! I found an advice to create a macvlan for the host either: I tried that but without luck. It would be nice if someone could me direct to the right direction here. Thanks! -- Wilhelm -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel