[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: dpkg can't purge init script



On Wed, Aug 22, 2001 at 09:24:02PM +0200, Eric Van Buggenhaut wrote:
> Sorry for cross-posting, I posted to the wrong list first.
> 
> I can't purge a package :
> 
> curitiba_POTATO:/# dpkg --purge superviser-server
> (Reading database ... 9401 files and directories currently installed.)
> Removing superviser-server ...
> Stopping superviser-server: dpkg: error processing superviser-server (--purge):
>  subprocess pre-removal script returned error exit status 1
   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

So we go look for things that could return 1 in prerm.

> Errors were encountered while processing:
>  superviser-server
> curitiba_POTATO:/# ls -l /etc/init.d/superviser-server
> -rwxr-xr-x    1 root     root         1945 Jul 27 11:10 /etc/init.d/superviser-server

Yes, of course, when prerm fails then no files are deleted. That's _pre_-removal.

> #! /bin/sh
> # prerm script for superviser-server
> #
> # see: dh_installdeb(1)
> 
> set -e

That is correct and important; it causes the failure of an individual
command to cause the entire script to fail.

> # summary of how this script can be called:
> #        * <prerm> `remove'
> #        * <old-prerm> `upgrade' <new-version>
> #        * <new-prerm> `failed-upgrade' <old-version>
> #        * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
> #        * <deconfigured's-prerm> `deconfigure' `in-favour'
> #          <package-being-installed> <version> `removing'
> #          <conflicting-package> <version>
> # for details, see /usr/doc/packaging-manual/
> 
> case "$1" in
>     remove|upgrade|deconfigure)
> #       install-info --quiet --remove /usr/info/superviser-server.info.gz
>         ;;
> 
>     failed-upgrade)
>         ;;
>     *)
>         echo "prerm called with unknown argument \`$1'" >&2
>         exit 0
>     ;;
> esac
> 
> # dh_installdeb will replace this with shell code automatically
> # generated by other debhelper scripts.
> 

Nothing so far has actually done anything.

> #DEBHELPER#
> 
> exit 0

Clearly the thing that is returning 1 lies in the debhelper prerm.

> And the debhelper script :
> 
> [eric@curitibaPOTATO:~/arturo/superviser-server-1.0]$ more debian/prerm.debhelper
> # Automatically added by dh_installdocs
> if [ \( "$1" = "upgrade" -o "$1" = "remove" \) -a -L /usr/doc/superviser-server ]; then
>         rm -f /usr/doc/superviser-server

rm -f always returns 0, not that.

> fi
> # End automatically added section
> # Automatically added by dh_installinit
> /etc/init.d/superviser-server stop

That's the only thing it could be. Your init.d script is failing and
returning 1. It is bugged, fix it. Hint: --oknodo parameter to
start-stop-daemon (look it up).

> Is this a bug in debhelper ?

Yes actually, it should be guarded with a -e:
if [ -e "/etc/init.d/superviser-ircd" ]; then
	/etc/init.d/superviser-ircd stop
fi

However, this is not the problem here (wrong error message). (My
debhelper guards it, I don't know why your's hasn't)

-- 
Andrew Suffield <asuffield@users.sourceforge.net>
Dept. of Computing, Imperial College, London, UK

Attachment: pgpFe4Saxirlo.pgp
Description: PGP signature


Reply to: