[Lxc-users] Need simple configuration for embedded ARM LXC

Serge Hallyn serge.hallyn at ubuntu.com
Fri Apr 12 13:53:04 UTC 2013


Quoting Somnath Mitra (somnath.mitra at xockets.com):
> Greetings,
> 
> I have built lxc 0.9.0 running on Linux 3.6.0 on Xilinx ARM Cortex A9 dual
> core embedded board. For general utilities it has busybox/dropbear.
> 
> I wish to run applications in containers. I used this configuration:
> 
> /tmp # cat lxc-veth-xckt.conf
> lxc.utsname = beta
> lxc.network.type = veth
> lxc.network.flags = up
> lxc.network.link = br0
> lxc.network.hwaddr = 4a:49:43:49:79:bf
> lxc.network.ipv4 = 10.2.3.5/24
> ## lxc.network.ipv6 = 2003:db8:1:0:1234:fe0b:3597
> ## lxc.mount = /etc/lxc/fstab
> ## lxc.rootfs = /tmp/lxc/rootfs
> lxc.rootfs = /
> 
> I have br0 setup already:
> 
> /tmp # ifconfig br0
> br0       Link encap:Ethernet  HWaddr 00:0A:35:00:01:22
>           BROADCAST MULTICAST  MTU:1500  Metric:1
>           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:0 txqueuelen:0
>           RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
> 
> 
> Then I tried to run an app container:
> 
> /tmp # lxc-execute -n foobar -f lxc-veth-xckt.conf /bin/ash
> device vethlmY2Y8 entered promiscuous mode
> IPv6: ADDRCONF(NETDEV_UP): vethlmY2Y8: link is not ready
> IPv6: ADDRCONF(NETDEV_CHANGE): vethlmY2Y8: link becomes ready
> lxc-execute: Failed to find an lxc-init
> lxc-execute: invalid sequence number 1. expected 4
> lxc-execute: failed to spawn 'foobar'
> device vethlmY2Y8 left promiscuous mode
> br0: port 2(vethlmY2Y8) entered disabled state
> 
> 
> Since the container rootfs is shared with host I am confused why it cannot
> find lxc-init?

Sounds like a compilation/packaging problem.  It works for me
here, with ubuntu raring:

cat > lxc.conf << EOF
lxc.utsname = beta
lxc.network.type = empty
lxc.rootfs = /
lxc.aa_profile = unconfined
EOF

sudo lxc-execute -n foobar -f lxc.conf -l info -o outout -- ps -ef
UID        PID  PPID  C STIME TTY          TIME CMD
root         1     0  0 08:46 pts/1    00:00:00 /usr/lib/x86_64-linux-gnu/lxc/lxc-init -- ps -ef
root         2     1  0 08:46 pts/1    00:00:00 ps -ef

(an interactive shell doesn't work - just hangs, I don't use
lxc-execute so always forget what is expect to work and what
isn't)

> I have already checked that kernel is configured correctly using
> lxc-checkconfig.
> 
> Pls send a pointer to a simple working configuration for embedded systems.

Take a look at src/lxc/execute.c:choose_init().  It will look for
lxc-init in three places:

	LXCINITDIR "/lxc/lxc-init"
	/usr/lib/lxc/lxc-init
	/sbin/lxc-init

LXCINITDIR in ubuntu is /usr/lib/x86_64-linux-gnu, and lxc-init is in
fact at /usr/lib/x86_64-linux-gnu/lxc/lxc-init.  (You can find your
LXCINITDIR in config.log if you built your own lxc).  But the
easier thing might be to just copy lxc-init into /sbin.

-serge




More information about the lxc-users mailing list