[Lxc-users] On clean shutdown of Ubuntu 10.04 containers

Trent W. Buck twb at cybersource.com.au
Mon Dec 6 23:55:23 UTC 2010


"Michael H. Warfield" <mhw at WittsEnd.com>
writes:

> Yeah, that's something where I wish we had an "onboot" and/or "disabled"
> config file like OpenVZ does.  So you can have some configured but that
> don't autoboot when you boot the system.  As that stands, you would have
> to rename or remove the config file.  :-P

As a workaround I have my init script look for /forceboot inside the
container's rootfs.  I was going to have an entry like
"upstart.autostart = [yes|no]" in the lxc.conf file, but lxc-start
doesn't like unrecognized entries.

>> * the stop function greps for /sbin/init in container inittab instead of 
>> trying to allow for any random container pid #1
>
> Yeah, that little trick won't work with Ubuntu or Fedora using upstart.

AFAIK init inside the container *MUST* be pid 1.  pid 1 is handled
specially by the kernel, such silently discarding all kill -9's sent to
it.

>> * starts containers in screen
>> - I have not figured out what it would take to get nice behavior out of 
>> lxc-console yet and screen is both easy and standard.
>
> I usually start them with logging enabled and redirected with the -o
> option.  To each his own.

I set lxc.console = /var/log/lxc/$utsname.log, which captures the
container's /dev/console.  lxc-console attaches to gettys on the
container's /dev/tty[1-6].

If something is wrong in the start script, I can run lxc-start manually,
replacing -d with -s lxc.console=/dev/stderr to get an interactive
/dev/console.





More information about the lxc-users mailing list