Making it possible to uninstall initscripts / insserv and facilities

Felipe Sateler fsateler at debian.org
Wed Nov 25 18:18:10 GMT 2015


On 25 November 2015 at 13:25, Martin Pitt <mpitt at debian.org> wrote:
> Michael Biebl [2015-11-25 16:13 +0100]:
>> > Would it be a problem to invoke insserv with -f on remove or disable?
>> > It would appear it isn't, as the debhelper autoscripts do || true on
>> > failure of update-rc.d remove. If so, the change would be very simple:
>> >
>> > diff --git a/debian/src/sysv-rc/sbin/update-rc.d
>> > b/debian/src/sysv-rc/sbin/update-rc.d
>> > index a631021..55cd5b0 100755
>> > --- a/debian/src/sysv-rc/sbin/update-rc.d
>> > +++ b/debian/src/sysv-rc/sbin/update-rc.d
>> > @@ -168,6 +168,10 @@ sub insserv_updatercd {
>> >
>> >     usage("not enough arguments") if ($#args < 1);
>> >
>> > +    # Add force flag if initscripts is not installed
>> > +    # This enables inistcripts-less systems to not fail when a
>> > facility is missing
>> > +    unshift(@opts, '-f') unless -f '/etc/init.d/mountkernfs.sh';
>> > +
>> >     $scriptname = shift @args;
>> >     $action = shift @args;
>> >     my $insserv = "/usr/lib/insserv/insserv";
>>
>>
>> Martin, any objections to this approach in general and this patch
>> specifically?
>
> As I wrote I think this is mostly good, but I'd really restrict this
> to running under systemd
>
>   unshift(@opts, '-f') unless -f '/etc/init.d/mountkernfs.sh' || ! -d '/run/systemd/systemd';
>
> IMHO insserv really ought to fail hard if you remove
> /etc/init.d/mountkernfs.sh (or initscripts as a whole) and are
> actually running sysvinit.

I agree that failing hard if you are running sysvinit would be ideal.
However, this check would break in
containerized or chrooted environments. Unfortunately, drawing
inferences from the running system is bound to have this sort of
problems. AFAIK, d-i does not run systemd; would things work there
when initscripts is no longer transitively depended upon?

>
> upstart doesn't need that either, so maybe it can be rewritten using
>
>   || -d /run/sysvinit/init
>
> (or whatever sysvinit's socket was), but then we'd still need to check
> e. g. openrc.

Maybe instead of using only mountkernfs.sh as flag file, we could:

1. Check existence of /lib/sysvinit/init
2. Check existence of some file only present in sysvinit-core
    (initreq.h? /usr/share/sysvinit/* ?)
3. Check existence of mountkernfs.sh

And only pass the --force flag if all three checks fail.

>
>> If not, could you Felipe please file a bug against sysv-rc?

Will do.

-- 

Saludos,
Felipe Sateler




More information about the Pkg-systemd-maintainers mailing list