[Lxc-users] Converting openvz guests to lxc

John Drescher drescherjm at gmail.com
Tue Jan 19 15:24:32 UTC 2010


I have been testing converting working openvz guests to lxc without
success. I have two basic problems.

1. The lxc guest is taking over the virtual terminals of the host.
2. The lxc guest pauses randomly for a few seconds.

I am using gentoo as the host (under virtualbox for testing so I do
not disturb the real openvz host) and guest using containers that work
under openvz specifically 2.6.27 openvz kernels.

localhost ~ # equery l lxc
[ Searching for package 'lxc' in all categories among: ]
 * installed packages
[I--] [ ~] app-emulation/lxc-0.6.4-r2 (0)
localhost ~ # uname -a
Linux localhost 2.6.32-gentoo #10 SMP Sat Jan 16 23:50:38 Local time
zone must be set--see zic x86_64 Intel(R) Core(TM)2 Quad CPU Q9550 @
2.83GHz GenuineIntel GNU/Linux


localhost ~ # lxc-start -n guest_1
INIT: version 2.86 booting
Loading /lib64/rc/console/keymap

   OpenRC 0.5.2 is starting up Gentoo Linux (x86_64) [LXC]

* /proc is already mounted, skipping
* Setting hostname to gentoo-openvz-~core2-2009-11-13...                  [ ok ]
* Configuring kernel parameters...                                        [ ok ]
* Creating user login records...                                          [ ok ]
* Cleaning /var/run...                                                    [ ok ]
* Wiping /tmp directory...                                                [ ok ]
* Setting terminal encoding [UTF-8]...
/etc/init.d/termencoding: line 31: /dev/tty5: Operation not permitted
/etc/init.d/termencoding: line 31: /dev/tty6: Operation not permitted
/etc/init.d/termencoding: line 31: /dev/tty7: Operation not permitted
/etc/init.d/termencoding: line 31: /dev/tty8: Operation not permitted
/etc/init.d/termencoding: line 31: /dev/tty9: Operation not permitted
/etc/init.d/termencoding: line 31: /dev/tty10: Operation not permitted
/etc/init.d/termencoding: line 31: /dev/tty11: Operation not permitted
/etc/init.d/termencoding: line 31: /dev/tty12: Operation not permitted    [ ok ]
* Loading key mappings [us]...                                            [ ok ]
* Setting keyboard mode [UTF-8]...
Couldnt open /dev/tty1
Couldnt open /dev/tty2
Couldnt open /dev/tty3
Couldnt open /dev/tty4
Couldnt open /dev/tty5
Couldnt open /dev/tty6
Couldnt open /dev/tty7
Couldnt open /dev/tty8
Couldnt open /dev/tty9
Couldnt open /dev/tty10
Couldnt open /dev/tty11
Couldnt open /dev/tty12                                                   [ ok ]
* Bringing up interface eth0
*   dhcp...
*     Running dhcpcd...
eth0: dhcpcd 4.0.13 starting
eth0: broadcasting for a lease
eth0: offered 192.168.1.102 from 192.168.1.1
eth0: acknowledged 192.168.1.102 from 192.168.1.1
eth0: checking 192.168.1.102 is available on attached networks
eth0: leased 192.168.1.102 for 86400 seconds                              [ ok ]
*     received address 192.168.1.102/24                                   [ ok ]
*   Adding routes
*     default via 192.168.1.1...
SIOCADDRT: File exists                                                    [ !! ]
* Starting network                                                        [ ok ]
* Initializing random number generator...                                 [ ok ]
INIT: Entering runlevel: 3
* Mounting network filesystems...                                         [ ok ]
* Starting syslog-ng...
Jan 19 10:17:09 gentoo-openvz-~core2-2009-11-13 syslog-ng[329]:
syslog-ng starting up; version='3.0.4'
                   [ ok ]
* Starting sshd...
Jan 19 10:17:10 gentoo-openvz-~core2-2009-11-13 sshd[343]: Server
listening on 0.0.0.0 port 22.
                 [ ok ]
* Starting local...                                                       [ ok ]


This is gentoo-openvz-~core2-2009-11-13.unknown_domain (Linux x86_64
2.6.32-gentoo) 10:17:11

gentoo-openvz-~core2-2009-11-13 login:


localhost ~ # cat /lxc/guest_1/etc/inittab
#
# /etc/inittab:  This file describes how the INIT process should set up
#                the system in a certain run-level.
#
# Author:  Miquel van Smoorenburg, <miquels at cistron.nl>
# Modified by:  Patrick J. Volkerding, <volkerdi at ftp.cdrom.com>
# Modified by:  Daniel Robbins, <drobbins at gentoo.org>
# Modified by:  Martin Schlemmer, <azarah at gentoo.org>
#
# $Header: /var/cvsroot/gentoo-x86/sys-apps/sysvinit/files/inittab,v
1.5 2005/12/22 02:03:23 vapier Exp $

# Default runlevel.
id:3:initdefault:

# System initialization, mount local filesystems, etc.
si::sysinit:/sbin/rc sysinit

# Further system initialization, brings up the boot runlevel.
rc::bootwait:/sbin/rc boot

l0:0:wait:/sbin/rc shutdown
l1:S1:wait:/sbin/rc single
l2:2:wait:/sbin/rc nonetwork
l3:3:wait:/sbin/rc default
l4:4:wait:/sbin/rc default
l5:5:wait:/sbin/rc default
l6:6:wait:/sbin/rc reboot
#z6:6:respawn:/sbin/sulogin

# TERMINALS
#c1:12345:respawn:/sbin/agetty 38400 tty1 linux
#c2:2345:respawn:/sbin/agetty 38400 tty2 linux
#c3:2345:respawn:/sbin/agetty 38400 tty3 linux
#c4:2345:respawn:/sbin/agetty 38400 tty4 linux
#c5:2345:respawn:/sbin/agetty 38400 tty5 linux
#c6:2345:respawn:/sbin/agetty 38400 tty6 linux

# SERIAL CONSOLES
#s0:12345:respawn:/sbin/agetty 9600 ttyS0 vt100
#s1:12345:respawn:/sbin/agetty 9600 ttyS1 vt100

# What to do at the "Three Finger Salute".
#ca:12345:ctrlaltdel:/sbin/shutdown -r now

# Used by /etc/init.d/xdm to control DM startup.
# Read the comments in /etc/init.d/xdm for more
# info. Do NOT remove, as this will start nothing
# extra at boot if /etc/init.d/xdm is not added
# to the "default" runlevel.
x:a:once:/etc/X11/startDM.sh

# Normally not reached, but fallthrough in case of emergency.
z6:6:respawn:/sbin/sulogin
1:2345:respawn:/sbin/agetty 38400 console
c1:12345:respawn:/sbin/agetty 38400 tty1 linux
c2:12345:respawn:/sbin/agetty 38400 tty2 linux
c3:12345:respawn:/sbin/agetty 38400 tty3 linux
c4:12345:respawn:/sbin/agetty 38400 tty4 linux
localhost ~ #

localhost ~ # cat /etc/lxc/guest_1.conf
lxc.utsname = guest_1
lxc.mount = /etc/lxc/guest_1.fstab
lxc.rootfs = /lxc/guest_1
lxc.tty = 4
lxc.pts = 1024
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = br0
lxc.network.name = eth0
lxc.network.mtu = 1500
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

localhost ~ # cat /etc/lxc/guest_1.fstab
none /lxc/guest_1/dev/pts devpts defaults 0 0
none /lxc/guest_1/proc    proc   defaults 0 0
none /lxc/guest_1/sys     sysfs  defaults 0 0
none /lxc/guest_1/dev/shm tmpfs  defaults 0 0
/usr/portage /lxc/guest_1/usr/portage  none rw,bind 1 0


Any ideas what I am doing wrong?

-- 
John M. Drescher




More information about the lxc-users mailing list