[Pkg-sysvinit-devel] Bug#687410: Bug#687410: sysvinit: non-privileged user can cause sysvinit.postinst to fail

Roger Leigh rleigh at codelibre.net
Wed Sep 12 21:52:03 UTC 2012


On Wed, Sep 12, 2012 at 04:21:02PM +0200, Michael Stapelberg wrote:
> Hi,
> 
> Daniel Kahn Gillmor <dkg at fifthhorseman.net> writes:
> >  PID="$(pidof /sbin/init || true)"
> > [...]
> >                         kill -s USR1 "$PID"
> The comment in the file states:
> 
>         # PID of init; may not always be 1.  Use for sending signals
>         # and checking if init is running.
>         PID="$(pidof /sbin/init || true)"
> 
> I’d be interested in cases where the PID of init is not 1. IMO, this
> should also be explained (at least briefly) in that comment.

I checked the git history to find out why we do this.  It was added
for systemd and upstart, to prevent signalling other init daemons
when sysvinit is installed, but not running, to prevent problems
sending unwanted signals.

Regarding PID not always being 1, IIRC this is on GNU/Hurd, where
/sbin/init is started by some other process, and there are several
other translators and other things started first, so its PID can't be
1.  However, I don't think Hurd is using sysvinit yet.  It might be
simpler to check for [ "$(readlink /proc/1/exe)" = "/sbin/init" ] and
forget about Hurd for the time being.  This /might/ affect upstart,
which also uses /sbin/init, but the check wouldn't help in this case
anyway.


Regards,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux    http://people.debian.org/~rleigh/
 `. `'   schroot and sbuild  http://alioth.debian.org/projects/buildd-tools
   `-    GPG Public Key      F33D 281D 470A B443 6756 147C 07B3 C8BC 4083 E800



More information about the Pkg-sysvinit-devel mailing list