supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
* Trying to alter runit a little.
@ 2005-11-12 15:02 L. Jason Godsey
  2005-11-17  8:59 ` Gerrit Pape
  0 siblings, 1 reply; 7+ messages in thread
From: L. Jason Godsey @ 2005-11-12 15:02 UTC (permalink / raw)


I've removed the requirment for runit to be pid 1.  I want to replace
init within a FreeBSD jail.  The first process to run isn't pid 1.

Do you see any problems that will become of this?

I just did a make package outside of the jail and the system froze, I'm
guessing the build process checks for error if runit is not pid 1.

The machine locked up and I'll have to wait a few hours for someone to
go to the colo machine and power cycle it for me.

Thanks for any feedback on this.

Lanny Jason Godsey



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Trying to alter runit a little.
  2005-11-12 15:02 Trying to alter runit a little L. Jason Godsey
@ 2005-11-17  8:59 ` Gerrit Pape
  2005-11-17 22:46   ` Paul Jarc
  2005-11-18 11:07   ` L. Jason Godsey
  0 siblings, 2 replies; 7+ messages in thread
From: Gerrit Pape @ 2005-11-17  8:59 UTC (permalink / raw)


On Sat, Nov 12, 2005 at 07:02:24AM -0800, L. Jason Godsey wrote:
> I've removed the requirment for runit to be pid 1.  I want to replace
> init within a FreeBSD jail.  The first process to run isn't pid 1.
> 
> Do you see any problems that will become of this?

The runit-init program, normally installed as /sbin/init sends signals
to pid 1 when told to reboot or halt the system.  The runit program
doesn't provide any other communication channel than signals (combined
with magic files), so it relies on being the process with id 1.  If you
change that, nothing else should break but this IPC, but you then have
the problem to find out the id of the runit process on shutdown.  Tools
like pidof are exactly what runit replaces with a reliable solution.

> I just did a make package outside of the jail and the system froze, I'm
> guessing the build process checks for error if runit is not pid 1.
> 
> The machine locked up and I'll have to wait a few hours for someone to
> go to the colo machine and power cycle it for me.

I can't see how this relates to your change, building the package should
never make the system hang, unless the system is buggy.

Regards, Gerrit.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Trying to alter runit a little.
  2005-11-17  8:59 ` Gerrit Pape
@ 2005-11-17 22:46   ` Paul Jarc
  2005-11-21  8:59     ` Gerrit Pape
  2005-11-18 11:07   ` L. Jason Godsey
  1 sibling, 1 reply; 7+ messages in thread
From: Paul Jarc @ 2005-11-17 22:46 UTC (permalink / raw)


Gerrit Pape <pape@smarden.org> wrote:
> If you change that, nothing else should break but this IPC, but you
> then have the problem to find out the id of the runit process on
> shutdown.

Would it work to run runit under runsv?


paul


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Trying to alter runit a little.
  2005-11-17  8:59 ` Gerrit Pape
  2005-11-17 22:46   ` Paul Jarc
@ 2005-11-18 11:07   ` L. Jason Godsey
  2005-11-21  8:56     ` Gerrit Pape
  1 sibling, 1 reply; 7+ messages in thread
From: L. Jason Godsey @ 2005-11-18 11:07 UTC (permalink / raw)


build# diff -u runit.c.original runit.c
--- runit.c.original    Fri Nov 18 10:56:29 2005
+++ runit.c     Fri Nov 18 10:57:41 2005
@@ -54,7 +54,7 @@
   int ttyfd;
   struct stat s;

-  if (getpid() != 1) strerr_die2x(111, FATAL, "must be run as process
no 1.");
+  //if (getpid() != 1) strerr_die2x(111, FATAL, "must be run as
process no 1.");
   setsid();

   sig_block(sig_alarm);

build# pwd
/usr/ports/sysutils/runit/work/admin/runit-1.3.1/src

build# make check
./check-local chpst runit runit-init runsv runsvchdir runsvctrl
runsvdir runsvstat sv  svlogd svwaitdown svwaitup utmpset
Checking chpst...
Checking runit...
Killed

main# echo $?
137

#### Original
build# cp runit.c.original runit.c
./check-local chpst runit runit-init runsv runsvchdir runsvctrl
runsvdir runsvstat sv  svlogd svwaitdown svwaitup utmpset
Checking chpst...
Checking runit...
Checking runit-init...
Checking runsv...
Checking runsvchdir...
Checking runsvctrl...
Checking runsvdir...
...

Something in Checking runit is making my FreeBSD 6 system have a stroke
if I remove the line:
if (getpid() != 1) strerr_die2x(111, FATAL, "must be run as process no
1.");


--- Gerrit Pape <pape@smarden.org> wrote:

> On Sat, Nov 12, 2005 at 07:02:24AM -0800, L. Jason Godsey wrote:
> > I've removed the requirment for runit to be pid 1.  I want to
> replace
> > init within a FreeBSD jail.  The first process to run isn't pid 1.
> > 
> > Do you see any problems that will become of this?
> 
> The runit-init program, normally installed as /sbin/init sends
> signals
> to pid 1 when told to reboot or halt the system.  The runit program
> doesn't provide any other communication channel than signals
> (combined
> with magic files), so it relies on being the process with id 1.  If
> you
> change that, nothing else should break but this IPC, but you then
> have
> the problem to find out the id of the runit process on shutdown. 
> Tools
> like pidof are exactly what runit replaces with a reliable solution.
> 
> > I just did a make package outside of the jail and the system froze,
> I'm
> > guessing the build process checks for error if runit is not pid 1.
> > 
> > The machine locked up and I'll have to wait a few hours for someone
> to
> > go to the colo machine and power cycle it for me.
> 
> I can't see how this relates to your change, building the package
> should
> never make the system hang, unless the system is buggy.
> 
> Regards, Gerrit.
> 



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Trying to alter runit a little.
  2005-11-18 11:07   ` L. Jason Godsey
@ 2005-11-21  8:56     ` Gerrit Pape
  0 siblings, 0 replies; 7+ messages in thread
From: Gerrit Pape @ 2005-11-21  8:56 UTC (permalink / raw)


On Fri, Nov 18, 2005 at 03:07:04AM -0800, L. Jason Godsey wrote:
> build# diff -u runit.c.original runit.c
> --- runit.c.original    Fri Nov 18 10:56:29 2005
> +++ runit.c     Fri Nov 18 10:57:41 2005
> @@ -54,7 +54,7 @@
>    int ttyfd;
>    struct stat s;
> 
> -  if (getpid() != 1) strerr_die2x(111, FATAL, "must be run as process
> no 1.");
> +  //if (getpid() != 1) strerr_die2x(111, FATAL, "must be run as
> process no 1.");
>    setsid();
> 
>    sig_block(sig_alarm);
> 
> build# pwd
> /usr/ports/sysutils/runit/work/admin/runit-1.3.1/src
> 
> build# make check
> ./check-local chpst runit runit-init runsv runsvchdir runsvctrl
> runsvdir runsvstat sv  svlogd svwaitdown svwaitup utmpset
> Checking chpst...
> Checking runit...
> Killed
> 
> main# echo $?
> 137

Ah yes.  The runit program test actually is kind of a pseudo test.  It
just tests that the runit program can't be run unless it has pid 1.  So
if you make this change you need to skip or adapt the runit program
test, e.g.:

--- src/Makefile        23 Jul 2005 13:12:39 -0000      1.29
+++ src/Makefile        21 Nov 2005 08:49:52 -0000
@@ -3,8 +3,10 @@
 
 default: sysdeps $(IT)
 
-check: $(IT)
-       ./check-local $(IT)
+check: chpst runit-init runsv runsvchdir runsvctrl runsvdir runsvstat sv \
+         svlogd svwaitdown svwaitup utmpset
+       ./check-local chpst runit-init runsv runsvchdir runsvctrl runsvdir \
+         runsvstat sv svlogd svwaitdown svwaitup utmpset
 
 runit: load runit.o unix.a byte.a
        ./load runit unix.a byte.a -static

Regards, Gerrit.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Trying to alter runit a little.
  2005-11-17 22:46   ` Paul Jarc
@ 2005-11-21  8:59     ` Gerrit Pape
  2005-11-22  6:37       ` Paul Jarc
  0 siblings, 1 reply; 7+ messages in thread
From: Gerrit Pape @ 2005-11-21  8:59 UTC (permalink / raw)


On Thu, Nov 17, 2005 at 05:46:36PM -0500, Paul Jarc wrote:
> Gerrit Pape <pape@smarden.org> wrote:
> > If you change that, nothing else should break but this IPC, but you
> > then have the problem to find out the id of the runit process on
> > shutdown.
> 
> Would it work to run runit under runsv?

It's that at the time the init process pid 1 starts, normally only the
root filesystem is mounted, and is mounted read-only.  runsv needs to
create the ./supervise/ subdirectory and files in it.  The runit program
doesn't need anything on the filesystem with IPC working through
signals.

Regards, Gerrit.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Trying to alter runit a little.
  2005-11-21  8:59     ` Gerrit Pape
@ 2005-11-22  6:37       ` Paul Jarc
  0 siblings, 0 replies; 7+ messages in thread
From: Paul Jarc @ 2005-11-22  6:37 UTC (permalink / raw)


Gerrit Pape <pape@smarden.org> wrote:
> On Thu, Nov 17, 2005 at 05:46:36PM -0500, Paul Jarc wrote:
>> Would it work to run runit under runsv?
>
> It's that at the time the init process pid 1 starts, normally only the
> root filesystem is mounted, and is mounted read-only.

I thought the case in question was running runit *not* as process 1.
For that case, would running it under runsv work?


paul


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-11-22  6:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-12 15:02 Trying to alter runit a little L. Jason Godsey
2005-11-17  8:59 ` Gerrit Pape
2005-11-17 22:46   ` Paul Jarc
2005-11-21  8:59     ` Gerrit Pape
2005-11-22  6:37       ` Paul Jarc
2005-11-18 11:07   ` L. Jason Godsey
2005-11-21  8:56     ` Gerrit Pape

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).