[Lxc-users] Container taking over host tty

Duc-Saysana HOANG d.hoang at numericable.com
Thu Nov 4 22:19:57 UTC 2010


On Sun, 31 Oct 2010 18:42:43 +0000
thewanderer <thewanderer at gim11.pl> wrote:

> My configuration file is as follows: 
> 
> lxc.utsname = rkaw.pl 
> lxc.tty = 2 
> lxc.network.type = veth 
> lxc.network.flags = up 
> lxc.network.link = lbrpriv 
> lxc.network.hwaddr = 4a:00:00:00:00:01 
> lxc.network.ipv4 = 10.0.7.1/24 
> lxc.cgroup.cpuset.cpus = 0 
> lxc.cgroup.cpu.shares = 1000
> lxc.cgroup.memory.max_usage_in_bytes = 536870912 
> lxc.rootfs = /srv/vz/private/121 
> lxc.mount = /srv/vz/private/121.fstab 
> lxc.cgroup.devices.deny = a 
> 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/null and zero 
> lxc.cgroup.devices.allow = c 1:3 rwm 
> lxc.cgroup.devices.allow = c 1:5 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
> 
> I thought that setting lxc.tty to 2 would prevent the container from
> accessing my host's ttys. However, I am logged in on tty1 and when I run
> `lxc-start -n rkaw` I see the boot output on tty1 and my console is
> captured a while after. tty2 is also affected - even lines go into the
> container and odd lines get delivered to the host system.
> How to isolate the container's ttys from my own ttys and be able to do
> `lxc-console`? I'm at a loss.
> Debian Squeeze/Sid amd64, kernel 2.6.36 with all needed features on,
> cgroup mounted, lxc utilities 0.7.3.
> Oh, and is `lxc-ls` supposed to show _two_ entries of "rkaw", one per
> line?
> 
> ------------------------------------------------------------------------------
> Nokia and AT&T present the 2010 Calling All Innovators-North America contest
> Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
> $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
> Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
> http://p.sf.net/sfu/nokia-dev2dev
> _______________________________________________
> Lxc-users mailing list
> Lxc-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-users
> 

Hello,

When you execute 'lxc-start -n rkaw' it launch your container in foreground.
Your current console is attached to the processus lxc-start.
That's why you see all the boot messages of your container in your current consoles
(tty1 and tty2) because some boot messages are sent to STDERR, not STDOUT ...
Well my guess may be wrong though.

If you do not want to lanch your container with your current console attached to it,
you have to launch lxc-start as a daemon with option -d.
You can add -o option too to tell lxc-start to send all his logs to the given
(log) file.

Hope that can help.

Cheers,

D.S.HOANG




More information about the lxc-users mailing list