[Lxc-users] Startup scripts [Was: Re: security question]

Gordon Henderson gordon at drogon.net
Sun Aug 21 19:51:09 UTC 2011


On Sun, 21 Aug 2011, John wrote:

> On 21/08/11 18:01, Gordon Henderson wrote:
>> I've been using the file-rc boot script mechanisms rather than the
>> sysv-rc system for LXC containers. That might seem like a step
>> backwards, but actually, it's fine and gives you much finer (& easier
>> IMO) control over what gets started and stopped when a container is
>> booted. Y

> Have you tried Arch Linux Gordon? it uses a BSD-Style init which is what
> I think you mean.

Not tried it - I'm more or less wedded to Debian right now though (but 
really only because I have a couple of dozen physical servers all running 
Debian - if only there were 25 hours in a day ;-)

> I think it's much cleaner and easier to work with. All
> "switches" are in rc.conf, there isn't loads of rc.runlevel directories
> full of symlinks and you can point your inittab at a lxc-specific
> rc.sysinit and rc.shutdown. This is what I have and it works well. My
> point was about the fact that using a stock rc.shutdown, for example,
> will shut down the host.

I found the stock shutdown (in Debian, anyway) rendered the host with a 
read-only root partition rather than shut down... The 'lxc' script I'm 
using attempts to 'fix' inittab and some of the rc scripts though, but 
file-rc gives me better control.

file-rc still has /etc/init.d but no /etc/rc.x directories. Instead 
/etc/init.d/rcS is a big script that parses /etc/runlevel.conf - and that 
file kicks off scripts as needed.

e.g. /etc/runlevel.conf contains lines like:

# <sort> <off-> <on-levels>     <command>
02      -       S               /etc/init.d/hostname.sh
#06     -       S               /etc/init.d/keyboard-setup
#11     -       2,3,4,5         /etc/init.d/klogd
#12     -       2,3,4,5         /etc/init.d/acpid
12      -       S               /etc/init.d/mtab.sh
16      -       2,3,4,5         /etc/init.d/ssh
19     -       2,3,4,5         /etc/init.d/mysql
21     0,1,6   -               /etc/init.d/mysql

etc. The default runlevel in Debian is 2.

Gordon




More information about the lxc-users mailing list