[lxc-users] compiling

Michael H. Warfield mhw at WittsEnd.com
Sat Sep 6 16:45:23 UTC 2014

On Sat, 2014-09-06 at 16:13 +0400, Vit Ry wrote:
> On Fri, 5 Sep 2014 21:15:52 +0200
> J Bc <javibc at esdebian.org> wrote:

> > But when you install from repositories, it create an init.d script
> > than run, stop lxc...
> > is it necessary this script if you compile?

> You can run and stop lxc container without /etc/inid.d/ script (use lxc-{start,create}).
> It is necessary only if you need to run your container on system startup (after reboot).
> I didn't need it by myself, but if you want, some guys [1] show how to do it.

> [1]: http://blog.philippklaus.de/2011/02/start-linux-containers-lxc-at-startup/
> [2]: https://wiki.debian.org/LXC

Please note that if you are compiling from git, a lot of information at
the above links have changed and may be erroneous!  The link [1] from
3-1/2 years ago is woefully out of date.  I would not recommend
following those instructions for builds from git.

With regards to the second link...

For instance, lxc-start defaults to background mode now and you would
need to use the "-F" option to keep it in foreground mode.

There is no "lxc-halt" command in git.

The lxc-stop command issues a "powerdown" unless you specify the
"-k" (kill) option (the old method), thus rendering the lxc-halt command
redundant and possibly incorrect.

The host init scripts have been extensively redone wrt how and which
containers are autostarted, use of groups, and use of lxc-autostart for
the start on host bootup process.

For the autoboot code from git, autostarting using symlinks
into /etc/lxc/auto/ is no longer supported nor is the use of the options
in /etc/default/lxc to specify the containers.  Use group membership
(lxc.group) and autoboot (lxc.start.auto, lxc.start.order, and
lxc.start.delay) in the container config file now.  The default case is
to first boot any container with lxc.start.auto = 1 which is in the
"onboot" group first and then any container with lxc.start.auto = 1
which is not in any group (the NULL group).

Startup scripts/conf/services are now provided for lxc for sysvinit,
upstart, and systemd init systems.  Version 1.1.x and above should also
eventually have init scripts/services for lxc-net setting up an lxcbr
bridge (patches submitted).

If you install lxc pre 1.0 from repos it may work the old ways but
compiling and installing from git will follow the newer conventions.
Take the instructions in the above pages with a large grain of salt and
understand that there will be differences/errors.  Those pages need
significant revisions for the current versions.  The first page, in
fact, should probably be disregarded with regards to the versions in

For Debian (I just checked configure.ac) the current git head builds
init scripts for upstart and systemd.  If you build from git, you may
want to copy (or symlink) the libexec files (where they are systemd
helper scripts) to init.d where they function as the sysvinit scripts.

For that purpose, lxc-net (if it exists) is linked to init.d/lxc-net and
lxc-autostarthelper (or, now, lxc-containers depending on patches) is
linked to init.d/lxc for the sysvinit scripts.

> --Vitaly

Michael H. Warfield (AI4NB) | (770) 978-7061 |  mhw at WittsEnd.com
   /\/\|=mhw=|\/\/          | (678) 463-0932 |  http://www.wittsend.com/mhw/
   NIC whois: MHW9          | An optimist believes we live in the best of all
 PGP Key: 0x674627FF        | possible worlds.  A pessimist is sure of it!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 465 bytes
Desc: This is a digitally signed message part
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20140906/cc2bc8a8/attachment.sig>

More information about the lxc-users mailing list