Re: [lxc-users] LXC Slackware Container - runit

2018-09-18 Thread Matteo Bernardini
Il giorno mar 18 set 2018 alle ore 13:30 spaceman
 ha scritto:
>
> Hi,
>
> Matteo Bernardini wrote:
> >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.
> >
> >runit_start () {
> >/usr/bin/runsv /service
> >}
> >
>
> Yes that works, but try this instead:
>
> runit_start () {
> /usr/bin/runsv /service &
> }
>
> allowing both rc.runit and rc.local to finish (unless you want bash
> running continously), however runsv just exits without a trace. This
> works with several other of my rc scripts.
>
> In bash '&' normally means background the process, but here the process
> just disappears (with no output or exit code).
>
> Using your script none of the rest of rc.local after you start rc.runit
> will be executed until rc.runit stops.

that happens because, from what I have read on the matter (I am a
first timer with it), runit wants to stay in foreground: I had
provided general instructions for daemons in my first reply but this
doesn't seem to apply cleanly to runsv.

according to the official documentation

http://smarden.org/runit/useinit.html

your best option, as Slackware uses an hybrid init system (bsd +
sysinit), seems to be adding to /etc/inittab the line

SV:123456:respawn:/sbin/runsvdir-start

with a /service main directory containing other subdirectories for the
various services.

I don't know how you installed runit but /sbin/runsvdir-start is
provided in the package generated from the SlackBuild available at
slackbuilds.org

https://slackbuilds.org/repository/14.2/system/runit/

Matteo
___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users

Re: [lxc-users] LXC Slackware Container - runit

2018-09-18 Thread Serge E. Hallyn
Quoting spaceman (space...@antispaceman.com):
> Serge E. Hallyn wrote:
> 
> Hi,
> 
> >> # /etc/rc.d/rc.local
> >> 
> >> /usr/bin/runsvdir /services &
> >
> >Is it pid 1 doing this?  Does it go on to exit?
> >
> 
> pid 1 for the container is init which sets off the boot process and
> operates normally and doesn't exit. Don't really understand the
> question.

"pid 1 sets off the boot process" != "pid 1 forks+execs
 /usr/bin/runsvdir /services & and then exits".

If the latter happens, then you'll need to have pid 1 stick around
somehow.  When pid 1 exits, the container gets killed.
___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users

Re: [lxc-users] LXC Slackware Container - runit

2018-09-18 Thread spaceman
Serge E. Hallyn wrote:

Hi,

>> # /etc/rc.d/rc.local
>> 
>> /usr/bin/runsvdir /services &
>
>Is it pid 1 doing this?  Does it go on to exit?
>

pid 1 for the container is init which sets off the boot process and
operates normally and doesn't exit. Don't really understand the
question.

Regards,
spaceman
___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users

Re: [lxc-users] LXC Slackware Container - runit

2018-09-18 Thread spaceman
Hi,

Matteo Bernardini wrote:
>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.
>
>runit_start () {
>/usr/bin/runsv /service
>}
>

Yes that works, but try this instead:

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

allowing both rc.runit and rc.local to finish (unless you want bash
running continously), however runsv just exits without a trace. This
works with several other of my rc scripts.

In bash '&' normally means background the process, but here the process
just disappears (with no output or exit code).

Using your script none of the rest of rc.local after you start rc.runit
will be executed until rc.runit stops.

Regards,
spaceman
___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users

Re: [lxc-users] LXC Slackware Container - runit

2018-09-18 Thread Matteo Bernardini
Il giorno lun 17 set 2018 alle ore 19:08 spaceman
 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
___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users

Re: [lxc-users] LXC Slackware Container - runit

2018-09-17 Thread Serge E. Hallyn
Quoting spaceman (space...@antispaceman.com):
> 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 &

Is it pid 1 doing this?  Does it go on to exit?

> 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.
> 
> Regards,
> spaceman
> ___
> lxc-users mailing list
> lxc-users@lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users
___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users