[Lxc-users] lxc template for RHEL?

Dan Kegel dank at kegel.com
Sun Aug 26 04:09:40 UTC 2012


On Sat, Aug 25, 2012 at 3:53 PM, Fajar A. Nugraha <list at fajar.net> wrote:
> What host are you using?
$ uname -a
Linux i5lap 3.2.0-29-generic-pae #46-Ubuntu SMP Fri Jul 27 17:25:43
UTC 2012 i686 i686 i386 GNU/Linux
$ cat /etc/issue
Ubuntu 12.04.1 LTS \n \l
$ dpkg-query -W lxc
lxc	0.7.5-3ubuntu62

> An ubuntu host will automatically add a networking section like this,
> which works
>
> lxc.network.type=veth
> lxc.network.link=lxcbr0
> lxc.network.flags=up

Right, except it doesn't work with your template somehow.

> The default networking config section from lxc-fedora (upstream
> version), when used in Ubuntu host would add an additional interface
> in the container (because it's basically a separate, additional
> networking section) and will result in "failed to rename
> vethXXXXXX->eth0 : File exists" error, so I commented it out. Which is
> why I'm surprised if you say lxc-fedora works for you, because its
> default networking section should be the same (i.e. should also cause
> "eth0: File exists" error).

Works here.  The resulting concatenated config file for fedora is

lxc.network.type=veth
lxc.network.link=lxcbr0
lxc.network.flags=up
lxc.utsname = democf
lxc.tty = 4
lxc.pts = 1024
lxc.rootfs = /var/lib/lxc/democf/rootfs
lxc.mount  = /var/lib/lxc/democf/fstab
# uncomment the next line to run the container unconfined:
#lxc.aa_profile = unconfined
#cgroups
lxc.cgroup.devices.deny = a
# /dev/null and zero
lxc.cgroup.devices.allow = c 1:3 rwm
lxc.cgroup.devices.allow = c 1:5 rwm
# consoles
lxc.cgroup.devices.allow = c 5:1 rwm
lxc.cgroup.devices.allow = c 5:0 rwm
lxc.cgroup.devices.allow = c 4:0 rwm
lxc.cgroup.devices.allow = c 4:1 rwm
# /dev/{,u}random
lxc.cgroup.devices.allow = c 1:9 rwm
lxc.cgroup.devices.allow = c 1:8 rwm
lxc.cgroup.devices.allow = c 136:* rwm
lxc.cgroup.devices.allow = c 5:2 rwm
# rtc
lxc.cgroup.devices.allow = c 254:0 rwm

> Try replacing your container config networking section (lxc.network.*)
> with the ones from your working ubuntu container, or the one I pasted
> earlier (i.e. you should NOT have any line that says "lxc.network.name
> = eth0", only those three lines above for lxc.network.*).

They're identical, nothing to replace.

> Since you already have a working /etc/resolv.conf (i.e. NOT a symlink)
> inside the container, can you try rebooting the container? If it works
> (i.e. got networking on boot), I can push a simple fix (which
> basically would just change "cp -a" to just "cp").

It does seem to have networking on boot now, so I think you're on to
something there.
- Dan




More information about the lxc-users mailing list