[lxc-devel] lxc-execute only finds lxc-init when lxc-init is manually populated inside of the container

Stéphane Graber stgraber at ubuntu.com
Wed Mar 26 21:42:45 UTC 2014


On Wed, Mar 26, 2014 at 05:36:27PM -0400, Peter Fedorow wrote:
> On 14-03-26 05:13 PM, Stéphane Graber wrote:
> >On Wed, Mar 26, 2014 at 05:08:31PM -0400, Peter Fedorow wrote:
> >>How to Reproduce
> >>----------------
> >>1.  lxc-create -n test1 -t ubuntu
> >>2.  lxc-execute -n test1 -- /bin/bash
> >>
> >>Fails:
> >>lxc-execute: Failed to find an lxc-init
> >>
> >>3.  lxc-start -n test1 -d
> >>4.  lxc-console -n test1
> >>5.  login
> >>6.  sudo apt-get install lxc
> >>7.  sudo shutdown -h now
> >>8.  lxc-execute -n test1 -- /bin/bash
> >>
> >>Success!
> >>
> >>
> >>LXC Versions Tested
> >>-------------------
> >>Ubuntu automatic upstream - 1.0.1+master~20140326-1500-0ubuntu1~ppa1~saucy1
> >>Ubuntu Trusty - 1.0.1-0ubuntu1
> >>Ubuntu 13.10 - 1.0.0~alpha1-0ubuntu14.1
> >>
> >>OS
> >>--
> >>$ lsb_release -a
> >>No LSB modules are available.
> >>Distributor ID:    Ubuntu
> >>Description:    Ubuntu 13.10
> >>Release:    13.10
> >>Codename:    saucy
> >>$ uname -a
> >>Linux bigserver 3.11.0-18-generic #32-Ubuntu SMP Tue Feb 18 21:11:14
> >>UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
> >>
> >>
> >>Additional Notes
> >>----------------
> >>
> >>Installing the binary is a work-around for 64-bit, there is no
> >>obvious work-around for 32-bit containers on a 64-bit host.
> >>
> >>This is not the same as bug #22.  The library is being found, but it
> >>needs to be loaded from outside of the container's rootfs.
> >>Providing the binary alone inside of the container is insufficient
> >>unless the binary is statically linked and 32-bit compatible.
> >>
> >>
> >>Regards,
> >>Peter Fedorow
> >
> >
> >lxc-execute depends on lxc-init being available in the container rootfs,
> >just like lxc-start depends on /sbin/init being available in the
> >container rootfs.
> >
> >So to use lxc-execute, you just need to make sure whatever package
> >provides lxc-init (in Ubuntu's case, lxc itself) is installed inside the
> >rootfs before you use lxc-execute.
> >
> 
> I mentioned that work-around in the bug report, but as noted, it
> does not work for 32-bit containers on 64-bit hosts.  (I even tried
> it - see below.)  Further, even on 64-bit hosts, the default package
> resolution for the Ubuntu lxc package pulls in 63 packages, yet it
> is frequently desirable to use lxc-execute for light-weight tasks.

Ah, I think I see the problem, the issue is about the path to lxc-init
which is hardcoded inside LXC to the multiarch path.

So the best way around this (which is arguably not ideal) is to install
lxc (the 32bit version) inside the container and just symlink that
lxc-init to /usr/lib/x86_64-linux-gnu/lxc/lxc-init in that container.

I guess we should make the path to lxc-init configurable somehow to deal
with that corner case.

> 
> 
> Attempt to install 64-bit lxc packages in 32-bit container.
> <yeah right> :)
> ---
> $ sudo dpkg --add-architecture amd64
> $ sudo apt-get install lxc:amd64
> $ sudo apt-get install lxc:amd64
> Result:
> Reading package lists... Done
> Building dependency tree
> Reading state information... Done
> Some packages could not be installed. This may mean that you have
> requested an impossible situation or if you are using the unstable
> distribution that some required packages have not yet been created
> or been moved out of Incoming.
> The following information may help resolve the situation:
> 
> The following packages have unmet dependencies:
>  logrotate : Depends: cron or
>                       anacron but it is not going to be installed or
>                       cron-daemon
>  lxc:amd64 : Depends: apparmor:amd64 but it is not going to be installed
>              Depends: dnsmasq-base:amd64 but it is not going to be
> installed
>              Depends: liblxc0:amd64 (= 1.0.0~alpha1-0ubuntu14.1) but
> it is not going to be installed
>              Depends: python3:amd64 but it is not going to be installed
>              Depends: python3-lxc:amd64 but it is not going to be installed
>              Recommends: cgroup-lite:amd64 but it is not installable or
>                          cgroup-bin:amd64 but it is not going to be
> installed
>              Recommends: lxc-templates:amd64 (>=
> 0.8.0~rc1-4ubuntu43) but it is not installable
>              Recommends: openssl:amd64 but it is not going to be installed
> E: Error, pkgProblemResolver::Resolve generated breaks, this may be
> caused by held packages.
> ---
> 
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel

-- 
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: 819 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20140326/9040816e/attachment-0001.pgp>


More information about the lxc-devel mailing list