On 01/05/2011 05:19 AM, Daniel Lezcano wrote: > On 01/04/2011 09:36 AM, Rob Landley wrote: >> I'm attempting to write a simple HOWTO for setting up a container with >> LXC. Unfortunately, console handling is really really brittle and the >> only way I've gotten it to work is kind of unpleasant to document. >> >> Using lxc 0.7.3 (both in debian sid and built from source myself), I >> can lxc-create a container, and when I run lxc-start it launches init >> in the container. But the console is screwy. >> >> If my init program is just a command shell, the first key I type will >> crash lxc-start with an I/O error. (Wrapping said shell with a script >> to redirect stdin/stdout/stderr to various /dev character devices >> doesn't seem to improve matters.) >> >> Using the busybox template and the busybox-i686 binary off of >> busybox.net, it runs init and connects to the various tty devices, and >> this somehow prevents lxc-start from crashing. But if I "press enter >> to active this console" like it says, the resulting shell prompt is >> completely unusable. If I'm running from an actual TTY device, then >> some of the keys I type go to the container and some don't. If my >> console is connected to a PTY when I run lxc-start (such as if I ssh >> in and run lxc-start from the ssh session), _none_ of the characters I >> type go to the shell prompt. >> >> To get a usable shell prompt in the container, what I have to do is >> lxc-start in one window, ssh into the server to get a fresh terminal, >> and then run lxc-console in that second terminal. That's the only >> magic sequence I've found so far that works. >> >> The attached html file is a long drawn-out reproduction sequence for >> this. >> >> I tried downloading lxc-git to see if this is already fixed, but >> running "autoconf" doesn't seem to want to produce a ./configure file >> for me. ("configure.ac:8: error: possibly undefined macro: >> AM_CONFIG_HEADER") I'm really not an autoconf expert (the whole thing >> is just a horrible idea at the design level), so have no idea what I'm >> doing wrong there. > > Hi Rob, > > there is a small bug when installing the template in the inittab, it > should be: > > ::sysinit:/etc/init.d/rcS > tty1::respawn:/bin/getty -L tty1 115200 vt100 > console::askfirst:/bin/sh > > Otherwise, I think the busybox version you are using is bogus. I had the > same problem than you but I installed busybox-1.18.1, compiled as > static, ran the template script, modified the inittab and it works like > a charm.
The modified inittab fixed it for me. Huh, and now that I know what it's doing, using this as /sbin/init: #!/bin/sh exec /bin/sh < /dev/console > /dev/console 2>/dev/console Seems to be working fine with lxc-start. (Dunno why it wasn't before...) Thanks, Rob ------------------------------------------------------------------------------ Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel