[Lxc-users] lxc-ubuntu: Only replace i386 by i686 in lxc's config, otherwise debootstrap will fail

Stéphane Graber stgraber at ubuntu.com
Thu Jun 23 17:45:26 UTC 2011


On Thu, 2011-06-23 at 11:10 -0500, Serge Hallyn wrote:
> Quoting Stéphane Graber (stgraber at ubuntu.com):
> > 
> > Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
> 
> Hi Stéphane, 

Hi, see comments below.


> could you take a look at the email I sent out late last night,
> patch 3/2?  It has a slightly different approach.  You are
> right, as it was arch wasn't being done right.  With the patch
> 3/2, (heck, I'll append it here below) it worked for me for
> both i386 and x86_64.  So I'd like to stick with that one if
> possible, just bc i've tested it.
> 
> Subject: [PATCH 3/2] lxc-ubuntu template: set lxc.arch in config
> 
> Otherwise the container works fine, except uname -a reports x86_64,
> not i686.
> 
> And unfortunately debootstrap and lxc.arch each accept only the
> opposite of each other (i386 vs i686) :)
> 
> Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
> ---
>  templates/lxc-ubuntu.in |    9 +++++++--
>  1 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/templates/lxc-ubuntu.in b/templates/lxc-ubuntu.in
> index 0b68e84..41ea90f 100644
> --- a/templates/lxc-ubuntu.in
> +++ b/templates/lxc-ubuntu.in
> @@ -175,6 +175,7 @@ lxc.tty = 4
>  lxc.pts = 1024
>  lxc.rootfs = $rootfs
>  lxc.mount  = $path/fstab
> +lxc.arch = $arch
>  
>  lxc.cgroup.devices.deny = a
>  # /dev/null and zero
> @@ -397,8 +398,8 @@ trim_container=0
>  if [ "$arch" == "x86_64" ]; then arch=amd64
>  fi
>  
> -if [ "$arch" == "i686" ]; then
> -    arch=i386
> +if [ "$arch" == "i386" ]; then
> +    arch=i686
>  fi
>  
>  hostarch=$arch
> @@ -418,6 +419,10 @@ do
>      esac
>  done
>  
> +if [ "$arch" == "i386" ]; then
> +    arch=i686
> +fi
> +

This bit is wrong and that's what i was fixing.
In the lxc-ubuntu.in you gave me on IRC
(http://bazaar.launchpad.net/~serge-hallyn/ubuntu/oneiric/lxc/update-templates/view/head:/templates/lxc-ubuntu.in), you instead have:


> if [ "$arch" == "i686" ]; then
>     arch=i386
> fi
> 
> if [ ! -z "$clean" -a -z "$path" ]; then
>     clean || exit 1
>     exit 0
> fi

>  if [ ! -z "$clean" -a -z "$path" ]; then
>      clean || exit 1
>      exit 0

Which is correct. So something in your 3/2 has went wrong.
Applying 3/2 to the lxc-ubuntu will make it call debootstrap with
--arch=i686 when started with --arch i386. Causing debootstrap to fail.

This problem doesn't exist with the lxc-ubuntu.in from your bzr branch.


Unless I missed something, the following commits should be good to
apply:
 - [PATCH 1/2] lxc-create: pass remaining args to templates
 - [PATCH 2/2] templates: consolidate and extend ubuntu templates

Then, the following should be fixed:
 - [PATCH 3/2] lxc-ubuntu template: set lxc.arch in config

And then the following should apply fine:
 - lxc-ubuntu: Base arch detection code on debootstrap's with some
additions when we don't have dpkg or udpkg
 - lxc-ubuntu: Default to current ubuntu release. If can't match any
valid release, use lucid.

Dropping:
 - lxc-ubuntu: Only replace i386 by i686 in lxc's config, otherwise
debootstrap will fail

And finally drop the 'if [ "$arch" = "" ]' so we ignore what's in the
environment.

Sounds good? Did I miss something?

-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20110623/a2a1d893/attachment.pgp>


More information about the lxc-users mailing list