You are not logged in.

#1 2010-06-22 07:48:01

zenny
Member
Registered: 2008-04-15
Posts: 24

help with lxc (linux containers)

I am trying to implement LXC in archlinux (arch nubi), but I could get it work till lxc-start (I am using 0.7.0 as mentioned in the comments at http://aur.archlinux.org/packages.php?ID=29930). I am following http://wiki.archlinux.org/index.php/Linux_Containers, http://lxc.teegra.org and http://blog.bodhizazen.net/linux/lxc-co … ontainers/ without success. sad

I am confused and stuck at two points?

1) after 'lxc-start -n containername', no outputs are available. Also cannot get to the new container using 'lxc-console -n containername'. I just get ' Type <Ctrl+a q> to exit the console' and no prompt.

2) Does not know how veth gets a network IP? my ifconfig output looks like this:


br0       Link encap:Ethernet  HWaddr 00:1F:D0:5A:D9:B1 
          inet addr:192.168.1.151  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::21f:d0ff:fe5a:d9b1/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:8053 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7669 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:6532794 (6.2 Mb)  TX bytes:1070650 (1.0 Mb)

eth0      Link encap:Ethernet  HWaddr 00:1F:D0:5A:D9:B1 
          inet6 addr: fe80::21f:d0ff:fe5a:d9b1/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:8118 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7723 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:6660935 (6.3 Mb)  TX bytes:1073847 (1.0 Mb)
          Interrupt:26 Base address:0xa000

lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:8 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:400 (400.0 b)  TX bytes:400 (400.0 b)

vethUyt0E Link encap:Ethernet  HWaddr AA:C4:D0:03:DA:FB 
          inet6 addr: fe80::a8c4:d0ff:fe03:dafb/64 Scope:Link
          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
          RX packets:6 errors:0 dropped:0 overruns:0 frame:0
          TX packets:47 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:552 (552.0 b)  TX bytes:3228 (3.1 Kb)

Container's /etc/sysinit looks like this:
#!/bin/bash
# Whatever is needed to clean out old daemon/service pids from your container
rm -f $(find /var/run -name '*pid')
rm -f /var/lock/subsys/*

# Configure network settings
## You can either use dhcp here, manually configure your
## interfaces or try to get the rc.d/network script working.
## There have been reports that network failed in this
## environment.
route add default gw 192.168.1.1
echo > /etc/resolv.conf search localhost
echo >> /etc/resolv.conf nameserver 192.168.1.1

# Initally we don't have any container originated mounts
rm -f /etc/mtab
touch /etc/mtab

###where 192.168.1.1 is the DSL modem's gateway IP.###

In the lxc-config file I assigned 192.168.1.50/24 as IP address as below:


$cat /var/lib/lxc/mini_x86_64/config
lxc.utsname = mini_x86_64
lxc.tty = 1
#lxc.pseudo = 1024 #did not work
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = br0
lxc.network.name = eth0
lxc.network.mtu = 1500
lxc.network.ipv4 = 192.168.1.50/24
lxc.rootfs = /var/chroot/lxc-rootfs/rootfs.mini_x86_64
lxc.mount = /var/chroot/lxc-fstab/fstab.mini_x86_64
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
# /dev/pts/* - pts namespaces are "coming soon"
lxc.cgroup.devices.allow = c 136:* rwm
lxc.cgroup.devices.allow = c 5:2 rwm
# rtc
lxc.cgroup.devices.allow = c 254:0 rwm


3) Tried to ask at IRC and always get "#archlinux: Cannot send to channel" when I post something?

Where did I go wrong? Whining for days. Thanks for help!

zenny

Offline

#2 2010-06-28 16:15:20

zenny
Member
Registered: 2008-04-15
Posts: 24

Re: help with lxc (linux containers)

bump!!!

Offline

#3 2010-06-30 23:17:36

delerious010
Member
From: Montreal
Registered: 2008-10-07
Posts: 72

Re: help with lxc (linux containers)

Hi Zenny,

I'd written an Arch Wiki page a while back for while I was learning about LXC. It is based on some you've listed and has a few additions. Not sure if you've had a chance to read through it : http://wiki.archlinux.org/index.php/Linux_Containers . Havn't had a chance to get back to this topic in a while due to other concerns, so things may have changed slightly.

To, hopefully, answer some of your questions :
1) http://wiki.archlinux.org/index.php/Lin … gin_prompt
My primary guess is that you do not have a getty running on that console. Please verify that you have one starting in the container's /etc/inittab. Alternately, it could make sense that the getty is not starting due to missing device nodes within your container.
If the issue was indeed missing devices, etc..., it may be a good idea to update that wiki section to add a note to that effect.

2) On the host, veth has no IP address.
On the container, however, veth is either populated based on your lxc config file for the container, or based on your rc scripts. In your case, this is through the lxc config file.

Seeing "lxc.network.link = br0", however, makes me wonder whether you've created the bridge device on your host ? http://wiki.archlinux.org/index.php/Lin … vice_setup

Can you ping your container machine ?

3) I do know some IRC channels require that you register with nickserv or whatnot before allowing you to post in forums. Did you check your IRC channel's status window to see whether there are messages to this effect ?

Regards,
- Jon.

[edit] meh, forum thinks line ending periods belong in urls.

Last edited by delerious010 (2010-06-30 23:19:24)

Offline

Board footer

Powered by FluxBB