[lxc-users] LXC Slackware Container - runit

Matteo Bernardini matteo.bernardini at gmail.com
Tue Sep 18 10:27:21 UTC 2018


Il giorno lun 17 set 2018 alle ore 19:08 spaceman
<spaceman at antispaceman.com> ha scritto:
>
> Hi,
>
> Using a stock LXC Slackware container can anyone tell me why I cannot do
> this:
>
> # /etc/rc.d/rc.local
>
> /usr/bin/runsvdir /services &
>
> If I remove the ampersand it runs fine, but with the ampersand it fails
> to run the services directory.
>
> I'm thinking there is something missing from the container that runit
> needs but cannot think what it is. I checked depedencies using ldd
> and no libraries are missing. I've also commented the restrictions
> (lxc.cap.drop) in the lxc config but it does nothing.
>
> It just doesn't run with no error message to explain why. I know runit
> works with Slackware as the host uses both.
>
> Love Slackware and LXC but need process supervision. Don't particularly
> want to use runit for init and boot as that would require a lot of work.

this is not related to LXC, this behaviour is the same outside of a
container: you have to use the Slackware standard way to add
additional services at startup and shutdown.

for example, create an /etc/rc.d/rc.runit file with the following
content (dashes are just to delimit the blocks of text)

- - -
runit_start () {
    /usr/bin/runsv /service
}

runit_stop () {
    killall -9 runsv
}

case "$1" in
'start')
  runit_start
  ;;
'stop')
  runit_stop
  ;;
*)
  echo "usage $0 start|stop"
esac
- - -

then add to /etc/rc.d/rc.local the following block

- - -
if [ -x /etc/rc.d/rc.runit ]; then
  /etc/rc.d/rc.runit start
fi
- - -

and to /etc/rc.d/rc.local_shutdown the following

- - -
if [ -x /etc/rc.d/rc.runit ]; then
  /etc/rc.d/rc.runit stop
fi
- - -

Matteo


More information about the lxc-users mailing list