[lxc-devel] Beta: LXC template for gentoo

lxc at zitta.fr lxc at zitta.fr
Sun Dec 29 09:28:50 UTC 2013


Le 29/12/2013 07:44, Alvaro Miranda Aguilera a écrit :
> Hi There.
>
Hi
> Out of the box on Oracle Linux 6.5, fails
>
:-(
> howeverm i think are just 2 small issues on printf and the output of
> the array assignment on line 151.
>
> [root at vagrant-oracle65 ~]# mv lxc-gentoo
> /usr/share/lxc/templates/lxc-gentoo
> [root at vagrant-oracle65 ~]# lxc-create -n mygentoo -t gentoo -- --autologin
>
> lxc-create: No config file specified, using the default config
> /etc/lxc/default.conf
> ### set_default_arch: default arch/variant autodetect...
>  => Got: arch=amd64 variant=amd64
> Attempting to obtain an exclusive lock (timeout: 30 min) named
> "cache-amd64-amd64"...
> /usr/share/lxc/templates/lxc-gentoo: line 41: printf: `(': invalid
> format character
> /usr/share/lxc/templates/lxc-gentoo: line 48: printf: `(': invalid
> format character
> /usr/share/lxc/templates/lxc-gentoo: line 48: - : syntax error:
> operand expected (error token is "                                    
>                                  - ")
> lxc-create: failed to execute template 'gentoo'
> Delete subvolume '/container/mygentoo/rootfs'
> lxc-create: aborted
> [root at vagrant-oracle65 ~]#
>
OK, it's a bash version issue, I used bash 4.2
Oracle use 4.1, and its printf don't support %(fmt)T

tryed to fix :
https://github.com/gza/lxc-gentoo-template/commit/570ba53b69b1a320c6d115d1b13f2ceb7ac6aa7b

>
> If I remove /comment those those printf, on 41 and 48, It moves.
>
> then, I get this error:
>
> [root at vagrant-oracle65 ~]# lxc-create -n mygentoo -t gentoo -- --autologin
>
> lxc-create: No config file specified, using the default config
> /etc/lxc/default.conf
> ### set_default_arch: default arch/variant autodetect...
>  => Got: arch=amd64 variant=amd64
> Attempting to obtain an exclusive lock (timeout: 30 min) named
> "cache-amd64-amd64"...
> 48
>  => Executing "do_all"
> ###### cache_setup(): doing cache preparation
> ### cache_precheck(): doing some pre-start checks ...
> ### cache_stage3(): stage3 cache deployment...
> Determining path to latest Gentoo amd64 (amd64) stage3 archive...
>  => downloading and processing
> http://distfiles.gentoo.org/releases/amd64/autobuilds/latest-stage3-amd64.txt
> /usr/share/lxc/templates/lxc-gentoo: line 151: stage3_pointer_data:
> bad array subscript
>  => Got:
> Downloading/untarring the actual stage3 tarball...
> --2013-12-29 19:00:18--
>  http://distfiles.gentoo.org/releases/amd64/autobuilds/
> Resolving distfiles.gentoo.org... 64.50.233.100, 216.165.129.135,
> 156.56.247.195, ...
> Connecting to distfiles.gentoo.org
> <http://distfiles.gentoo.org>|64.50.233.100|:80... connected.
> HTTP request sent, awaiting response... 200 OK
> Length: unspecified [text/html]
> Saving to: “STDOUT”
>
>     [<=>                                                              
>                                                              ] 0      
>     --.-K/s              bzip2: (stdin) is not a bzip2 file.
>     [ <=>                                                            
>                                                               ] 6,713
>       --.-K/s   in 0.06s
>
> 2013-12-29 19:00:24 (106 KB/s) - written to stdout [6713]
>
> tar: Child returned status 2
> tar: Error is not recoverable: exiting now
>
> [the last exit code leading to this death was: 2 ]
> Error: unable to fetch or untar
> lxc-create: failed to execute template 'gentoo'
> Delete subvolume '/container/mygentoo/rootfs'
> lxc-create: aborted
> [root at vagrant-oracle65 ~]#
>
>
> fails here:
>
> + local -a stage3_pointer_data
> + stage3_pointer_data=($(wget -q -O - "${stage3_pointer}"))
> ++ wget -q -O -
> http://distfiles.gentoo.org/releases/amd64/autobuilds/latest-stage3-amd64.txt
> /usr/share/lxc/templates/lxc-gentoo: line 151: stage3_pointer_data:
> bad array subscript
> + stage3_latest_tarball=
> + printf ' => Got: %s\n' ''
>  => Got:
> +
>
Same here bash 4.1  don't support reverse array index.
https://github.com/gza/lxc-gentoo-template/commit/c613a30e956a3465e708077270ba7a156df39a5d

> The file gets downloaded, however something happen on line 151
>
> this is the content of the latest file
>
>  latest-stage3-amd64.txt
> # Latest as of Sun, 29 Dec 2013 00:30:01 +0000
> # ts=1388277001
> 20131226/stage3-amd64-20131226.tar.bz2
>
>
> I did assign
> manually stage3_latest_tarball=20131226/stage3-amd64-20131226.tar.bz2
> to get this part moving..
>
> by the way, I am in new zealand, so internet pretty much sucks.
>
> after that the install process finish, however i can't start the container
>
> [root at vagrant-oracle65 ~]# lxc-start --name mygentoo
> lxc-start: No such file or directory - failed to mount 'sys' on 'sys'
> lxc-start: failed to setup the mount entries for 'mygentoo'
> lxc-start: failed to setup the container
> lxc-start: invalid sequence number 1. expected 2
> lxc-start: failed to spawn 'mygentoo'
> lxc-start: Device or resource busy - failed to remove cgroup
> '/cgroup/cpuset/lxc/mygentoo'
> [root at vagrant-oracle65 ~]#
>
>
> quick look at the config file, and notice was no rootfs
>
> so i did add lxc.rootfs = /container/mygentoo/rootfs
>
good catch.


> after that the container worked , nice job
>
> [root at vagrant-oracle65 ~]# lxc-start --name mygentoo
> INIT: version 2.88 booting
>
>    OpenRC 0.12.4 is starting up Gentoo Linux (x86_64)
>
>  * Mounting /proc ... [ ok ]
>  * Mounting /run ... * /run/openrc: creating directory
>  * /run/lock: creating directory
>  * /run/lock: correcting owner
>  * Caching service dependencies ... [ ok ]
>  * Mounting /dev/mqueue ... [ ok ]
>  * Mounting /dev/shm ... [ ok ]
>  * setting up tmpfiles.d entries for /dev ... [ ok ]
>  * Creating user login records ... [ ok ]
>  * Wiping /tmp directory ... [ ok ]
>  * Bringing up network interface lo ... [ ok ]
>  * Updating /etc/mtab ... [ ok ]
>  * setting up tmpfiles.d entries ... [ ok ]
> INIT: Entering runlevel: 3
>  * Bringing up interface eth0
>  *   Caching network module dependencies
> need firewalld
>  *   dhcp ... *     Running udhcpc ... [ ok ]
>  *     received address 192.168.122.241/24 <http://192.168.122.241/24>
>  [ ok ]
>  * Starting local
>  [ ok ]
>
>
> This is mygentoo. (Linux x86_64 3.8.13-16.3.1.el6uek.x86_64) 19:39:42
>
> mygentoo login: root (automatic login)
> mygentoo ~ #
>
>
> some info about the environment I am using.
>
> [root at vagrant-oracle65 ~]# rpm -q bash kernel-uek lxc
> bash-4.1.2-15.el6_4.x86_64
> kernel-uek-3.8.13-16.3.1.el6uek.x86_64
> lxc-0.9.0-2.0.5.el6.x86_64
> [root at vagrant-oracle65 ~]# uname -r
> 3.8.13-16.3.1.el6uek.x86_64
> [root at vagrant-oracle65 ~]#
>
> Hope this helps,
> Alvaro.
>
It did a lot !
thanks
>
>
> On Sat, Dec 28, 2013 at 6:02 AM, Guillaume ZITTA <lxc at zitta.fr
> <mailto:lxc at zitta.fr>> wrote:
>
>     Hi,
>
>     I'm working on lxc-gentoo template.
>     https://github.com/gza/lxc-gentoo-template
>
>     It needs more testing before asking for mainline inclusion, but it
>     mostly works.
>     So posting if some interesting in testing with me.
>
>     Regards,
>
>     Guillaume ZITTA
>
>     _______________________________________________
>     lxc-devel mailing list
>     lxc-devel at lists.linuxcontainers.org
>     <mailto:lxc-devel at lists.linuxcontainers.org>
>     http://lists.linuxcontainers.org/listinfo/lxc-devel
>
>



More information about the lxc-devel mailing list