LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   [Ubuntu] apt libxml-sax-perl "unable to execute installed post-installation script" (https://www.linuxquestions.org/questions/linux-software-2/%5Bubuntu%5D-apt-libxml-sax-perl-unable-to-execute-installed-post-installation-script-820273/)

XXLRay 07-16-2010 04:12 PM

[Ubuntu] apt libxml-sax-perl "unable to execute installed post-installation script"
 
I had a problem on ubuntu when running "sudo apt-get dist-upgrade" and wanted to report how I solved it. Hopefully this helps anybody with similar problems.

I always got the error message:
Code:

Setting up libxml-sax-perl (0.96+dfsg-2) ...
dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libxml-sax-perl (--configure):
 subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
 libxml-sax-perl
E: Sub-process /usr/bin/dpkg returned an error code (1)

The problem is in libxml-sax-perl.postinst which does not seem to be executable.

I did not install any perl packages manually by cpan and found the solution in http://ubuntuforums.org/archive/inde...t-1342009.html where it was only one part of a bigger problem.

I created a backup file (always a good idea) of my libxml-sax-perl.postinst:
Code:

sudo cp /var/lib/dpkg/info/libxml-sax-perl.postinst /var/lib/dpkg/info/libxml-sax-perl.postinst.bak0
I deleted the old file:
Code:

sudo rm /var/lib/dpkg/info/libxml-sax-perl.postinst
Created a new file:
Code:

sudo vi /var/lib/dpkg/info/libxml-sax-perl.postinst
With the following content (copied from the link mentioned above):
Code:

#!/bin/sh
## ----------------------------------------------------------------------
## debian/postinst : postinstallation script for libxml-sax-perl
## ----------------------------------------------------------------------

## ----------------------------------------------------------------------
set -e

## ----------------------------------------------------------------------
if [ "$1" = configure ]
then
[ -d /etc/perl/XML/SAX ] || mkdir --parents /etc/perl/XML/SAX
if which ucfr >/dev/null 2>&1
then
ucfr libxml-sax-perl /etc/perl/XML/SAX/ParserDetails.ini
fi

if [ -n "$2" ] && dpkg --compare-versions "$2" le 0.16-0.1
then
echo "Migrating the Perl SAX parser information directory."
# first, move /etc/perl/XML/SAX/ParserDetails.d/ under
# /var/lib/libxml-sax-perl
for i in /etc/perl/XML/SAX/ParserDetails.d/*
do
# the directory should never be missing or empty, but the [ ! -e ]
# construct handles an unexpanded glob just in case
[ ! -e "$i" ] || \
mv "$i" "/var/lib/libxml-sax-perl/ParserDetails.d/50-$(basename $i)"
done
[ ! -d /etc/perl/XML/SAX/ParserDetails.d ] || \
rmdir --ignore-fail-on-non-empty /etc/perl/XML/SAX/ParserDetails.d

# now downgrade XML::SAX::PurePerl priority by removing it first
update-perl-sax-parsers --remove XML::SAX::PurePerl
fi

update-perl-sax-parsers --add XML::SAX::PurePerl --priority 10
update-perl-sax-parsers --update
fi

## ----------------------------------------------------------------------
## automatically generated debhelper commands


exit 0

## ----------------------------------------------------------------------

Made the file executable:
Code:

sudo chmod +x /var/lib/dpkg/info/libxml-sax-perl.postinst
And upgraded again:
Code:

sudo apt-get dist-upgrade -fReading package lists... Done
Building dependency tree     
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0B of additional disk space will be used.
Do you want to continue [Y/n]? Y
Setting up libxml-sax-perl (0.96+dfsg-2) ...
update-perl-sax-parsers: Registering Perl SAX parser XML::SAX::PurePerl with priority 10...
update-perl-sax-parsers: Updating overall Perl SAX parser modules info file...

Creating config file /etc/perl/XML/SAX/ParserDetails.ini with new version


AlucardZero 07-17-2010 09:20 AM

thanks for sharing. taking thread off ZRT


All times are GMT -5. The time now is 09:43 AM.