LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   dpkg can't remove a package, dependency problems (http://www.linuxquestions.org/questions/linux-newbie-8/dpkg-cant-remove-a-package-dependency-problems-710845/)

AncientPC 03-11-2009 03:03 PM

dpkg can't remove a package, dependency problems
 
When installing a package (hugs) through apt-get my laptop had a kernel panic and I had to do a hard reset. Upon starting up, I ran fsck all the partitions (jfs) and rebooted into Ubuntu.

However hugs was unconfigured and can't be installed / removed. I tried an apt-get purge and dpkg --configure -a / dpkg --remove -f hugs but the error message in all cases is:
Code:

root@core:/var/lib/aptitude# dpkg --remove hugs
(Reading database ... 161721 files and directories currently installed.)
Removing hugs ...
dpkg (subprocess): unable to execute pre-removal script: Exec format error
dpkg: error processing hugs (--remove):
 subprocess pre-removal script returned error exit status 2
dpkg (subprocess): unable to execute post-installation script: Exec format error
dpkg: error while cleaning up:
 subprocess post-installation script returned error exit status 2
Errors were encountered while processing:
 hugs

How do I get around the pre-removal script and force dpkg to remove hugs?

farslayer 03-11-2009 03:18 PM

Did you try forcing a reinstall over top of the package ?

apt-get -f install
or
apt-get -f install hugs

other options are listed here:
http://www.linux.com/feature/48910

If you get it to complete the installation you should then be able to remove it.

AncientPC 03-11-2009 05:45 PM

Well I'm having trouble installing/removing it either way, but forcing the install doesn't work. One of the dependency libraries was corrupt so I cleared all the cached packages and reran the command. Now the error is "dpkg: unable to execute post-install script: Exec format error"

Code:

root@core:~# aptitude install -f hugs
Reading package lists... Done
Building dependency tree     
Reading state information... Done
Reading extended state information     
Initializing package states... Done
The following partially installed packages will be configured:
  hugs
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0B of archives. After unpacking 0B will be used.
Writing extended state information... Done
Setting up hugs (98.200609.21-5) ...
dpkg (subprocess): unable to execute post-installation script: Exec format error
dpkg: error processing hugs (--configure):
 subprocess post-installation script returned error exit status 2
Errors were encountered while processing:
 hugs
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install.  Trying to recover:
Reading package lists... Done           
Building dependency tree     
Reading state information... Done
Reading extended state information     
Initializing package states... Done


farslayer 03-11-2009 07:32 PM

Did you look at the link I provided ? it has other options as well for working past these issues..



You should have posted this thread in the Debian forum, it might have got more exposure that way to some of the more advance Debian users, who might not notice the post here.. just for future reference.

AncientPC 03-12-2009 12:40 AM

Yes, the link was very helpful and informative. However despite trying all the suggestions I still cannot install / remove the hugs package. It doesn't help that there are no other versions to force a downgrade (but even then the remove script would probably crap out).

fakie_flip 05-14-2010 03:45 PM

I'm having the same problem with 2 different package. I'd like to know how to fix that post remove debian script. I get exit status 2, but I don't see anywhere in the script where it returns an value of 2.

fakie_flip 05-14-2010 03:45 PM

#!/bin/sh
set -e
# Automatically added by dh_installtex
##
## postrm-tex
##
## postrm snippets for registering hyphenation patterns, font maps, and formats
##
## Authors:
## Florent Rougon <f.rougon@free.fr>
## Norbert Preining <preining@logic.at>
##
#

dhit_call_update_texmf_config ()
{
if which update-texmf-config >/dev/null; then
update-texmf-config $*
else
echo "update-texmf-config not present: is tex-common installed?" >&3
fi
}

dhit_check_run_without_errors ()
{
silent=0
if [ "$1" = "-silent" ] ; then
silent=1
shift
fi
if which "$1" >/dev/null; then
tempfile=$(mktemp -p /tmp checkrun.XXXXXXXX)
if [ $silent = 0 ] ; then
printf "Running '$*'.\nThis may take some time..."
fi
set +e
if "$@" > $tempfile 2>&1 ; then
rm -f $tempfile
[ $silent = 0 ] && echo " done."
else
echo
echo "$* failed. Output has been stored in"
echo "$tempfile"
echo "If tex-common is not configured you can ignore this error" \
"message!"
echo "Otherwise, please include this file if you report a bug."
echo
fi
set -e
fi

return 0
}


case "$1" in
remove|disappear)
dhit_check_run_without_errors -silent update-updmap --quiet
dhit_check_run_without_errors -silent update-language
dhit_check_run_without_errors -silent update-fmtutil
for i in lsrfull ; do
if [ "$i" = lsr ] ; then
dhit_call_update_texmf_config lsr
fi
if [ "$i" = lsrfull ] ; then
dhit_call_update_texmf_config lsrfull
fi
if [ "$i" = map ] ; then
dhit_call_update_texmf_config map
fi
if [ "$i" = allformats ] ; then
for fmt in ; do
rm -f /var/lib/texmf/web2c/$fmt.*
done
fi
if [ "$i" = format ] ; then
for fmt in ; do
rm -f /var/lib/texmf/web2c/$fmt.*
done
fi
if [ "$i" = hyphen ] ; then
dhit_call_update_texmf_config hyphen
fi
done
;;

purge|upgrade|failed-upgrade|abort-upgrade|abort-install)
;;

*)
echo "postrm called with unknown argument '$1'" >&2
exit 1
;;
esac

#


All times are GMT -5. The time now is 08:36 PM.