Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 07-16-2010, 04:12 PM   #1
Registered: May 2010
Posts: 133

Rep: Reputation: 16
[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:
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:
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 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:
sudo cp /var/lib/dpkg/info/libxml-sax-perl.postinst /var/lib/dpkg/info/libxml-sax-perl.postinst.bak0
I deleted the old file:
sudo rm /var/lib/dpkg/info/libxml-sax-perl.postinst
Created a new file:
sudo vi /var/lib/dpkg/info/libxml-sax-perl.postinst
With the following content (copied from the link mentioned above):
## ---------------------------------------------------------------------- 
## debian/postinst : postinstallation script for libxml-sax-perl 
## ---------------------------------------------------------------------- 

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

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

if [ -n "$2" ] && dpkg --compare-versions "$2" le 0.16-0.1
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/* 
# 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)"
[ ! -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

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

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

exit 0

## ----------------------------------------------------------------------
Made the file executable:
sudo chmod +x /var/lib/dpkg/info/libxml-sax-perl.postinst
And upgraded again:
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
Old 07-17-2010, 09:20 AM   #2
Senior Member
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,823

Rep: Reputation: 611Reputation: 611Reputation: 611Reputation: 611Reputation: 611Reputation: 611
thanks for sharing. taking thread off ZRT


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to execute "reboot" in cgi script jcaga Fedora 4 05-10-2012 08:45 AM
"Unable to find medium with live File System" error in Ubuntu Installation. subashk80 Linux - Newbie 2 12-01-2009 11:49 PM
Getting error "sudo: unable to execute ./setup: Success" d_girish_d Linux - Software 3 07-20-2009 11:33 PM
Post Ubuntu Installation Error "No serving hosts found" Fouad Riaz Bajwa Linux - Laptop and Netbook 1 12-28-2006 08:29 PM
Compiling KDE 3.2.0 - "Can't open perl script "/dcopidlng/kalyptus" linuxgamer09483 Linux - Software 3 04-09-2004 08:25 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:32 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration