supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
From: Gerrit Pape <pape@smarden.org>
Subject: Re: init signals and touching files
Date: Fri, 4 Mar 2005 15:56:15 +0000	[thread overview]
Message-ID: <20050304155619.2914.qmail@c95b2c6a3c7111.315fe32.mid.smarden.org> (raw)
In-Reply-To: <d7e68b1437defb3e875dcb6575c8db41@annvix.org>

Hi Vincent,

On Sun, Feb 27, 2005 at 08:59:34PM -0700, Vincent Danen wrote:
> I have a bit of an issue with runit and it could be that I'm doing 
> something wrong or it could be that maybe this possibility hasn't been 
> considered before.
> 
> I have an SATA drive in my machine with a reiserfs partition in it.  
> For some reason, sata_promise isn't loaded so reiserfs freaks out if it 
> can't mount this partition that's noted in fstab.  As a result, it 
> prompts me to reboot or drop to an admin shell to fix my stuff.  That's 
> all fine, but when I hit exit to reboot the system, runit tries to 
> signal itself by touching /etc/runit/reboot.  The problem is, the f/s 

in stage 1 (and 3) runit discards signals, they only work in stage 2.
Can you show your stage 1 script?

> is read-only so it can't touch the file.  It then carries on as normal, 
> performing a normal boot, but the filesystem is still readonly which 
> causes some services to freak out, etc.  Once I get to stage 2, I can 
> tell it to reboot, but it's still complaining about not being able to 
> touch the /etc/runit/* files.

You can have stage 1 exit with return code 100 in this case.  This
causes runit (version 1.2.1) to skip stage 2 and go to stage 3
immediately.

Another option is to do the system reboot from the stage 1 script itself
(using reboot(2)) in case of an error, this also eliminates the need to
change the /etc/runit/reboot file.  I posted a tiny program than does
this some time ago.

> This makes me wonder if relying on files as a way to signal intentions 
> to runit is really the best idea.  But I'm not sure what would be 
> better.  I don't know what signals runit listens for right now, but 
> maybe it would be better if signals were used to tell runit we want to 
> reboot/halt rather than files?

See the runit man page for the signals runit supports, but it always
additionally checks for a magic file in /etc/runit/ on signals.  I
designed the runit system to work fine with a read-only root filesystem,
you can make any magic file or directory (etc/runit/stopit,
/etc/runit/reboot, service/supervise, ...) a symlink, even a dangling
symlink, pointing to a ramdisk or similar.  But this might not be
necessary in your case: you don't need to rely on the runit program to
tell the system to reboot or halt at the end of stage 3.  Reboot or halt
can be caused by the stage 1 or 3 script itself (using reboot(2)).

> The other issue I have is that runit-init (which I've renamed to init) 
> always wants to shut down.  If I do "init 6", I expect it to reboot, 
> but it halts the system.  I don't think runit should care that 
> runit-init is now called init, but I don't know.  I did write little 

This shouldn't happen, what's the permissions of /etc/runit/reboot in
this case?  If you run `init 6` it should be 0100, and the runit
program, after stage 3 finished, checks for that to decide whether to
reboot or halt.

Regards, Gerrit.


  reply	other threads:[~2005-03-04 15:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-28  3:59 Vincent Danen
2005-03-04 15:56 ` Gerrit Pape [this message]
2005-02-28 15:46 Vincent Danen
2005-03-01 14:29 ` Kevin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050304155619.2914.qmail@c95b2c6a3c7111.315fe32.mid.smarden.org \
    --to=pape@smarden.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).