[debhelper-devel] Bug#749400: dh_installinit: disable init scripts on removal of package

Felipe Sateler fsateler at debian.org
Thu Dec 24 03:34:22 UTC 2015


Control: clone -1 -2
Control: tags -2 -moreinfo
Control: reassign -2 sysv-rc/2.88dsf-59.2
Control: retitle -2 update-rc.d: bails out on stop-only services
Control: severity -2 normal

On Thu, 26 Nov 2015 21:43:00 +0000 Niels Thykier <niels at thykier.net> wrote:
> reopen 749400
> tags 749400 moreinfo
> thanks
>
>
> On Mon, 26 May 2014 18:23:20 -0007 Cameron Norman
> <camerontnorman at gmail.com> wrote:
> > Package: debhelper
> >
> > Greetings,
> >
> > It would be much cleaner to disable init scripts when the package is
> > uninstalled, so that a bunch of shell scripts that just run "[ -x
> > $DAEMON ] || exit 0" are not slowing down the boot.
> >
> > Additionally, this causes problems for Upstart, as the "starting" event
> > is emitted before the job can tell if its daemon is installed or not.
> > It also poses a problem for socket activation with Upstart, as the
> > upstart-socket-bridge will create the socket for the job even if the
> > daemon is not installed.
> >
> > I think it would just be overall cleaner to disable the init
> > configuration on removal of the package with a "update-rc.d disable
> > $daemon".
> >
> > Thank you,
> > --
> > Cameron Norman
>
> Hi,
>
> Unfortunately, our attempt to solve this bug as caused a severe
> regression (please see #806276) and had to be reverted.
>
> Apparently it is *not* safe to call "update-rc.d #SCRIPT# disable"
> unconditionally.  It is not entirely clear to me why/when it would work
> / not work, so I will put this on hold until further notice.

The problem seems to be that update-rc.d bails out when Default-Start
is empty. For example, the mdadm-waitidle init script has no
Default-Start (only Default-Stop). Update-rc.d has the following
check:

        ($start_lvls, $stop_lvls) = parse_def_start_stop($lsb_header);
       @toggle_lvls = @$start_lvls;
       if ($#toggle_lvls < 0) {
           error("$name Default-Start contains no runlevels, aborting.");
       }

And indeed on mdadm-waitidle neither enable or disable work. It seems
to me this is just an oversight, and update-rc.d should consider both
start and stop runlevels. I'm now CCing the sysvinit maintainers and
Andreas Hendriksson (which expressed interest in update-rc.d earlier)
for input.

The current update-rc.d behavior has the effect moving S=>K symlinks,
but it does nothing on K (aka, Default-Stop) symlinks. As an example:

% sudo update-rc.d apache2 disable
insserv: warning: current start runlevel(s) (empty) of script
`apache2' overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script
`apache2' overrides LSB defaults (0 1 6).


For update-rc.d, I'm not sure what the correct course of action would
be. Having disabled scripts start on shutdown is clearly bad. Leaving
stop-only services untouched is suboptimal, as there is no difference
between enabled and disabled. And simply removing the links would have
them recreated at next upgrade.

For debhelper, a solution is to apply  0f09b1f8, *not* apply
02cd0cec1c, and instead have lintian remove the warning. Another
solution would be to disable -e, store the error code, only fail if
_action==remove, and finally restore -e.

-- 
Saludos




More information about the debhelper-devel mailing list