[Pkg-sysvinit-devel] Bug#638019: /run/initctl

Roger Leigh rleigh at codelibre.net
Sun Jan 8 15:47:09 UTC 2012


On Sun, Jan 08, 2012 at 04:29:43PM +0100, Robert Millan wrote:
> El 8 de gener de 2012 16:20, Roger Leigh <rleigh at codelibre.net> ha escrit:
> > If we don't do that, then we are left running the old /sbin/init binary,
> > which is an important part of the upgrade.
> 
> Only until reboot. A reboot is necessary for the upgrade anyway
> (needed by kernel).
> 
> > Or if telinit/init return an error code, we can loop until it succeeds.
> 
> That could work, yes.  If init didn't act upon SIGUSR1 yet, its
> initctl handle is for a node that no longer exists in the file system.
>  Then the only way for it to receive commands is to re-open
> $OLDINITCTL which is now a symlink.
> 
> Btw, isn't step 6 a pre-requisite for step 2?

No, 2) is replacing with a symlink, while 6) is removing the
now unneeded symlink.  I noticed that if you mv /dev/initctl
/dev/initctl.old, init (I presume) immediately recreates
/dev/initctl.

The following sequence appears to work:

# New control channel
mkfifo /run/initctl
# Symlink to new channel
ln -s /run/initctl /dev/initctl.new
# Replace existing channel with symlink
mv /dev/initctl.new /dev/initctl
# Reopen control channel (now /run/initctl)
kill -SIGUSR1 1
# Replace init with new version using new paths
init u
# Delete old path
[rm /run/initctl]

If /dev/initctl is not open or is invalid, "init u" exits with
an error, so we can loop on this in the postinst to wait until
it's reopened.  It's pretty quick though, so perhaps loop a
fixed number of times and then continue with a warning if not
possible, especially since it's not fatal?


Regards,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.





More information about the Pkg-sysvinit-devel mailing list