Discussion:
Errors with update-rc.d: /etc/init.d/XXX exists during rc.d purge (use -f to force)
Richard Leitner - SKIDATA
2013-11-27 16:02:38 UTC
Permalink
Hi Paul,
good to hear I'm not the only one suffering from this issue...
No, I've received no response on the mailing list yet, but maybe someone has a hint for us now?

The only "workaround" I found is to purge the package and afterwards install the new version.
I know this is a really dirty workaround, but it's the only "solution" I found.

Have you discovered any other workarounds, Paul?

regards
Richard

>-----Original Message-----
>From: Stath, Paul [mailto:PStath-px+1RXq+rMaB+***@public.gmane.org]
>Sent: Wednesday, November 27, 2013 4:49 PM
>To: Richard Leitner - SKIDATA
>Subject: RE: Errors with update-rc.d: /etc/init.d/XXX exists during rc.d purge (use -f to force)
>
>Richard --
>
>I am also getting the "update-rc.d: /etc/init.d/XXX exists during rc.d purge"  error when I attempt to install a newer version of one of my packages.
>
>It doesn't look like you received any response to your post to the yocto mailing list.
>
>Did you get any response, or did you discover a workaround?
>
>--
>Paul Stath
>Axxcelera Broadband Wireless
Stath, Paul
2013-11-27 16:40:23 UTC
Permalink
Richard --

My "workaround" was a little less drastic than yours. (grin)

Before upgrading to the new package via 'dpkg -i', I would edit the postrm script in /var/lib/dpkg/info/<pkg-name>,postrm, adding the "-f" argument to "force" the symlink removal, as suggested by the error message.

Then the upgrade install works correctly. (With only a warning from the postrm script of the previous package.)

I believe that the issue is that when installing a package over an earlier release, dpkg performs the following steps:

1) Extract control files of new package
2) Execute "prerm" script of previous package if applicable.
3) Execute "preinst" script of new package.
4) Unpack new files and backup old files.
5) Execute "postrm" script of previous package if applicable.
6) Configure the package

When installing a newer version of the package, the "postrm" in step 5 fails, because the initscript from the new package is extracted in step 4, and update-rc.d w/o the "-f" argument exits with a non-zero return code.

I would argue that the "updatercd_postrm()" stanza in the update-rc.d.bbclass should include the "-f" flag.
(Anyone on the list want to chime in on this?)

In the meantime, I have added my own "updatercd_postrm()" stanza in the .bbappend file for the package I'm having issues with, which overrides the one provided by update-rc.d.bbclass.

updatercd_postrm() {
update-rc.d $D -f ${INITSCRIPT_NAME} remove
}

--
Paul Stath
Axxcelera Broadband Wireless

>From: Richard Leitner - SKIDATA [Richard.Leitner-***@public.gmane.org]
>Sent: Wednesday, November 27, 2013 11:02 AM
>To: Stath, Paul
>Cc: Yocto Project Discussion ML (yocto-EtnWKYl6rD/WsZ/***@public.gmane.org)
>Subject: RE: Errors with update-rc.d: /etc/init.d/XXX exists during rc.d purge (use -f to force)
>
>Hi Paul,
>good to hear I'm not the only one suffering from this issue...
>No, I've received no response on the mailing list yet, but maybe someone has a hint for us now?
>
>The only "workaround" I found is to purge the package and afterwards install the new version.
>I know this is a really dirty workaround, but it's the only "solution" I found.
>
>Have you discovered any other workarounds, Paul?
>
>regards
>Richard
>
>>-----Original Message-----
>>From: Stath, Paul [mailto:PStath-px+1RXq+rMaB+***@public.gmane.org]
>>Sent: Wednesday, November 27, 2013 4:49 PM
>>To: Richard Leitner - SKIDATA
>>Subject: RE: Errors with update-rc.d: /etc/init.d/XXX exists during rc.d purge (use -f to force)
>>
>>Richard --
>>
>>I am also getting the "update-rc.d: /etc/init.d/XXX exists during rc.d purge"  error when I attempt to install a newer version of one of my packages.
>>
>>It doesn't look like you received any response to your post to the yocto mailing list.
>>
>>Did you get any response, or did you discover a workaround?
>>
>>--
>>Paul Stath
>>Axxcelera Broadband Wireless
Richard Leitner - SKIDATA
2013-11-28 14:01:31 UTC
Permalink
Hi Paul,
thank you for that hint and description of your workaround!
Looks like you've invested a little bit more time into working around this issue than me :-)

I've added "-f" to the update-rc.d.bbclass and now it's working like a charm:

diff --git a/meta/classes/update-rc.d.bbclass b/meta/classes/update-rc.d.bbclass
index d8cc342..dbb5781 100644
--- a/meta/classes/update-rc.d.bbclass
+++ b/meta/classes/update-rc.d.bbclass
@@ -33,7 +33,7 @@ updatercd_postrm() {
if test "$D" != ""; then
OPT="-f -r $D"
else
- OPT=""
+ OPT="-f"
fi
if type update-rc.d >/dev/null 2>/dev/null; then
update-rc.d $OPT ${INITSCRIPT_NAME} remove


Nonetheless, I think there have to be a "cleaner" way to solve this issue than forcing the update-rc.d.
Maybe someone else has an idea how to solve this problem?

regards,
Richard


> -----Original Message-----
> From: Stath, Paul [mailto:PStath-px+1RXq+rMaB+***@public.gmane.org]
> Sent: Wednesday, November 27, 2013 5:40 PM
> To: Richard Leitner - SKIDATA
> Cc: Yocto Project Discussion ML (yocto-EtnWKYl6rD/WsZ/***@public.gmane.org)
> Subject: RE: Errors with update-rc.d: /etc/init.d/XXX exists during rc.d purge (use -f to
> force)
>
> Richard --
>
> My "workaround" was a little less drastic than yours. (grin)
>
> Before upgrading to the new package via 'dpkg -i', I would edit the postrm script in
> /var/lib/dpkg/info/<pkg-name>,postrm, adding the "-f" argument to "force" the
> symlink removal, as suggested by the error message.
>
> Then the upgrade install works correctly. (With only a warning from the postrm script
> of the previous package.)
>
> I believe that the issue is that when installing a package over an earlier release, dpkg
> performs the following steps:
>
> 1) Extract control files of new package
> 2) Execute "prerm" script of previous package if applicable.
> 3) Execute "preinst" script of new package.
> 4) Unpack new files and backup old files.
> 5) Execute "postrm" script of previous package if applicable.
> 6) Configure the package
>
> When installing a newer version of the package, the "postrm" in step 5 fails, because
> the initscript from the new package is extracted in step 4, and update-rc.d w/o the "-f"
> argument exits with a non-zero return code.
>
> I would argue that the "updatercd_postrm()" stanza in the update-rc.d.bbclass should
> include the "-f" flag.
> (Anyone on the list want to chime in on this?)
>
> In the meantime, I have added my own "updatercd_postrm()" stanza in the .bbappend
> file for the package I'm having issues with, which overrides the one provided by
> update-rc.d.bbclass.
>
> updatercd_postrm() {
> update-rc.d $D -f ${INITSCRIPT_NAME} remove }
>
> --
> Paul Stath
> Axxcelera Broadband Wireless
>
> >From: Richard Leitner - SKIDATA [Richard.Leitner-***@public.gmane.org]
> >Sent: Wednesday, November 27, 2013 11:02 AM
> >To: Stath, Paul
> >Cc: Yocto Project Discussion ML (yocto-EtnWKYl6rD/WsZ/***@public.gmane.org)
> >Subject: RE: Errors with update-rc.d: /etc/init.d/XXX exists during
> >rc.d purge (use -f to force)
> >
> >Hi Paul,
> >good to hear I'm not the only one suffering from this issue...
> >No, I've received no response on the mailing list yet, but maybe someone has a hint
> for us now?
> >
> >The only "workaround" I found is to purge the package and afterwards install the
> new version.
> >I know this is a really dirty workaround, but it's the only "solution" I found.
> >
> >Have you discovered any other workarounds, Paul?
> >
> >regards
> >Richard
> >
> >>-----Original Message-----
> >>From: Stath, Paul [mailto:PStath-px+1RXq+rMaB+***@public.gmane.org]
> >>Sent: Wednesday, November 27, 2013 4:49 PM
> >>To: Richard Leitner - SKIDATA
> >>Subject: RE: Errors with update-rc.d: /etc/init.d/XXX exists during
> >>rc.d purge (use -f to force)
> >>
> >>Richard --
> >>
> >>I am also getting the "update-rc.d: /etc/init.d/XXX exists during rc.d purge"  error
> when I attempt to install a newer version of one of my packages.
> >>
> >>It doesn't look like you received any response to your post to the yocto mailing list.
> >>
> >>Did you get any response, or did you discover a workaround?
> >>
> >>--
> >>Paul Stath
> >>Axxcelera Broadband Wireless
Loading...