[lxc-users] running various (mismatching) distributions in lxc

Serge Hallyn serge.hallyn at ubuntu.com
Wed May 14 21:17:05 UTC 2014


Quoting Tomas Vondra (tv at fuzzy.cz):
> Hi all,
> 
> lxc-newbie here. I'm learning about lxc for a few days, and one of the
> things that caught my eye is the possibility to run various mismatching
> distributions. For example Gentoo container on a CentOS host, and so on.
> 
> The docs I found (e.g. the really nice blog series at [1]) seem to
> suggest this should be possible and quite easy to setup, however
> whenever I keep getting into issues / containers that don't boot etc.
> 
> Running gentoo on gentoo, or fedora on fedora seems to work, but when I
> try to 'mix it' I get various errors (init/systemd failures etc),
> resulting in a container that is either completely unbootable or
> impossible to use.
> 
> So my question is - is that a good idea, or should I stick with running
> matching containers (gentoo in gentoo, fedora in fedora, ...)? Or are
> there some additional steps that I need to do, to make this work?

There are some combinations that are harder than others, but mixing
distributions is mostly perfectly fine.  If you have specific problems,
please let us know and depending on the nature (and the base and
container distributions) different people will be happy to get
involved.

> Or maybe some 'rules' - e.g. that both host/guest should run the same
> init system (e.g. both systemd), or something like that?

That isn't a rule.  In practice it cancertainly complicate things though.

> For example - after a while of struggling (and installing rpm/yum and a
> few other tools into the gentoo system), the lxc-create seems to create
> centos container just fine:
> 
>   # lxc-create -t centos -n centos-test
> 
>   ...
>   Container rootfs and config have been created.
>   Edit the config file to check/enable networking setup.
>   ...
> 
>   (full output http://pastebin.com/21b18gYK)
> 
> but once I try to start it, I get this:
> 
>   # lxc-start -n centos-test
>   lxc-start: No such file or directory - error mounting
> /opt/lxc/lib/lxc/rootfs/proc/sysrq-trigger on
> /opt/lxc/lib/lxc/rootfs/proc/sysrq-trigger

Hm, grep sysrq-trigger templates/* doesn't give me anything, so
this seems to be something specific to the templates in your
package.

For just getting it to run (or break at the next step) you could
probably just comment out the sysrq-trigger line in either
/var/lib/lxc/container/fstab or /var/lib/lxc/container/config
(whichever it is using).

>   lxc-start: failed to setup the automatic mounts for 'centos-test'
>   lxc-start: failed to setup the container
>   lxc-start: invalid sequence number 1. expected 2
>   lxc-start: failed to spawn 'centos-test
> 
> and other failures if I try to create and start fedora or ubuntu
> containers.
> 
> thanks
> Tomas
> 
> [1] https://www.stgraber.org/2013/12/20/lxc-1-0-blog-post-series/
> _______________________________________________
> lxc-users mailing list
> lxc-users at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users


More information about the lxc-users mailing list