Some more notes about Linux Containers

I’ve been playing around more with Linux Containers after my post about init scripts and I start to think they are quite near being working for Gentoo. I hope once I come back from my vacations to get them in the tree together with Tiziano.

Right now the problems we have are:

  • the standard stage3 needs to be heavily tweaked or it’ll be a massacre when started;
  • if I do set ttys in the configuration, at start time it moves me to the real tty1, which causes a domino effect with X11 that is annoying, although not critical;
  • OpenRC needs to be tweaked to add support for Linux-Containers; there are quite a few things that could be eased up by having a working OpenRC that ignores some init scripts when running in containers; the code seems to be in src/librc/librc.c (look for openvz) and should be easy to check whether we’re running on containers, by checking the running cgroup (/proc/self/cgroup);
  • the current ebuild in Tiziano’s overlay creates a /var/lib/lib directory and installs the lxc- binaries in /usr/bin, both of which shouldn’t happen in Gentoo once installed;
  • running rc shutdown inside the container will stop all the services properly, but will not kill init and thus not kill the vserver, I’m not sure why; running kill 1 also seems not to work, I have yet to check whether sending the kill signal from outside will properly shut down the rc inside, if yes, then it’ll be a good way to shut down the container.

Once I’ll be back and I’ll be working on the init scripts, they’ll be in a separate package, kinda like mysql’s, since what I have for now is slightly more complex, will add a few more standard locations (for instance they’ll use a /var/log/lxc directory that is not part of the standard install of lxc) and will require a couple of packages that are not part of lxc.