[lxc-devel] lxc + gento + qemu, almost there

Joakim Tjernlund joakim.tjernlund at transmode.se
Wed Mar 11 15:30:59 UTC 2015


On Wed, 2015-03-11 at 11:15 -0400, Stéphane Graber wrote:
> On Wed, Mar 11, 2015 at 03:02:32PM +0000, Joakim Tjernlund wrote:
> > > On Thu, Mar 05, 2015 at 02:28:42PM +0000, Joakim Tjernlund wrote: > I am running a gentoo ppc stage3 on 
> > > lxc 
> > amd64.
> > > > 
> > > > All I needed to do for this to boot was:
> > > > Add to gentoo template 
> > > > chroot()
> > > > {
> > > >     rr=$1
> > > > 
> > > >     shift 1
> > > >     proot -w / -r "${rr}" -q qemu-ppc "$@"
> > > > }
> > > > 
> > > > ppc-qemu.conf:
> > > >  lxc.network.type = veth
> > > >  lxc.network.link = virbr0
> > > >  lxc.network.flags = up
> > > >  #for user emulation of PPC arch
> > > >  lxc.mount.entry=/usr/bin/qemu-ppc usr/bin/qemu-ppc none ro,bind,optional 0 0
> > > > 
> > > > 
> > > > lxc-create -n cusfpv3 -t gentoo  -f /etc/lxc/ppc-qemu.conf -- -a ppc -v ppc
> > > > 
> > > > touch /var/lib/lxc/cusfpv3/rootfs/usr/bin/qemu-ppc # create a handle for bind mount
> > > 
> > > You can avoid that by passing create=file as a mount option in lxc.mount.entry
> > 
> > Nice! one less special thing to do :)
> > 
> > However to remove the chroot() -> proot hack one need to create this file much
> > earlier during lxc-create (and bind mount qemu-ppc so all the chroot stuff inside
> > the gentoo template script can execute(or replace the chroot with something else)
> > Anything you can consider?
> > 
> >  Jocke
> > 
> > PS: Please CC me as I am not on the list.
> 
> Ah yeah, I guess it's reasonable for the runtime config, but the template scripts aren't running in a 
> container so you'll still need your proot trick for that.

You need that, it is running in a real chroot so just have qemu ready to emulate ppc.

> 
> Note that since proot isn't available in quite a few distros (or not supported in some others), it'd be 
> good to have this be conditional to proot being available (or if it's reasonably easy, see the ubuntu 
> template for example, not use it at all).

Right, thats why doing an early qemu bind mount is much better and also cleaner

> 
> > 
> > > 
> > > > 
> > > > lxc-start -n cusfpv3
> > > > 
> > > > Could this be added to the template? 
> > > > Obviously some rework is needed, but I suck at shell programming :( >  the new chroot() function 
> > > > should be replaced with a bind mount of /usr/bin/qemu-ppc in ${rootfs}
> > > > 
> > > >  Jocke
> 


More information about the lxc-devel mailing list