dpkg (subprocess): unable to execute installed post-removal script: Exec format error -> dpkg: error processing libmad0 (--purge) -> apt-get and aptitude package manager broken

Asked by saneesh veetil on 2010-05-29

Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
9 not fully installed or removed.
After this operation, 0B of additional disk space will be used.
Setting up liba52-0.7.4 (0.7.4-13ubuntu1) ...
dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing liba52-0.7.4 (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up libid3tag0 (0.15.1b-10build2) ...
dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libid3tag0 (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up libmad0 (0.15.1b-4ubuntu1) ...
dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libmad0 (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up libmpeg2-4 (0.4.1-3) ...
dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libmpeg2-4 (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up libopencore-amrnb0 (0.1.2-1) ...
No apport report written because MaxReports has already been reached
                                                                    dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libopencore-amrnb0 (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up libopencore-amrwb0 (0.1.2-1) ...
No apport report written because MaxReports has already been reached
                                                                    dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libopencore-amrwb0 (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up libsidplay1 (1.36.59-5) ...
No apport report written because MaxReports has already been reached
                                                                    dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libsidplay1 (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up libtwolame0 (0.3.12-1) ...
No apport report written because MaxReports has already been reached
                                                                    dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libtwolame0 (--configure):
 subprocess installed post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of gstreamer0.10-plugins-ugly:
 gstreamer0.10-plugins-ugly depends on liba52-0.7.4; however:
  Package liba52-0.7.4 is not configured yet.
 gstreamer0.10-plugins-ugly depends on libid3tag0 (>= 0.15.1b); however:
  Package libid3tag0 is not configured yet.
 gstreamer0.10-plugins-ugly depends on libmad0 (>= 0.15.1b-3); however:
  Package libmad0 is not configured yet.
 gstreamer0.10-plugins-ugly depends on libmpeg2-4; however:
  Package libmpeg2-4 is not configured yet.
 gstreamer0.10-plugins-ugly depends on libopencore-amrnb0; however:
  Package libopencore-amrnb0 is not configured yet.
 gstreamer0.10-plugins-ugly depends on libopencore-amrwb0; however:
  Package libopencore-amrwb0 is not configured yet.
 gstreamer0.10-plugins-ugly deNo apport report written because MaxReports has already been reached
                                                                                                  No apport report written because MaxReports has already been reached
                                         pends on libsidplay1; however:
  Package libsidplay1 is not configured yet.
 gstreamer0.10-plugins-ugly depends on libtwolame0; however:
  Package libtwolame0 is not configured yet.
dpkg: error processing gstreamer0.10-plugins-ugly (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 liba52-0.7.4
 libid3tag0
 libmad0
 libmpeg2-4
 libopencore-amrnb0
 libopencore-amrwb0
 libsidplay1
 libtwolame0
 gstreamer0.10-plugins-ugly
E: Sub-process /usr/bin/dpkg returned an error code (1)

CAN ANYONE PLZ HELP ME HOW TO GET RID OF THIS PROBLEM?
I have tried doing:
apt-get -f install
apt-get upgrade
apt-get clean

neither of them worked for me.plz help me!!!

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu dpkg Edit question
Assignee:
No assignee Edit question
Solved by:
Mark Rijckenberg
Solved:
2010-05-29
Last query:
2010-05-29
Last reply:
2010-05-29

Hi,

First please make sure to close all open programs, including all package managers like Synaptic, Add/remove programs, etc ...

Then please try this procedure:

Step 1: Open Terminal from "Applications->Accessories->
Terminal"

Step 2: Please COPY-PASTE each line below into the Terminal then hit <enter> after each line)

Tip: If you have a wheel mouse or 3 button mouse, you do not need to type commands into the Terminal. Highlight the command written on the webpage. Move your cursor anywhere in the Terminal and press the wheel or middle button. Automatic Copy and paste! No spelling mistakes! No Typos! No other errors!

cat /etc/lsb-release
uname -a
sudo rm /var/lib/apt/lists/lock
sudo cp -arf /var/lib/dpkg /var/lib/dpkg.backup
sudo cp /var/lib/dpkg/status-old /var/lib/dpkg/status
sudo cp /var/lib/dpkg/available-old /var/lib/dpkg/available
sudo rm -rf /var/lib/dpkg/updates/*
sudo rm -rf /var/lib/apt/lists
sudo mkdir /var/lib/apt/lists
sudo mkdir /var/lib/apt/lists/partial
LANG=C;sudo aptitude clean
LANG=C;sudo aptitude autoclean
LANG=C;sudo apt-get update
sudo dpkg --clear-avail
sudo dpkg --configure -a
LANG=C;sudo aptitude install -f
LANG=C;sudo aptitude update
LANG=C;sudo aptitude dist-upgrade

Step 3: Please post results (copy/paste terminal output from each command) on this thread

Hope it helps,

Regards,

Mark

sunny@sunny-laptop:~$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=10.04
DISTRIB_CODENAME=lucid
DISTRIB_DESCRIPTION="Ubuntu 10.04 LTS"
sunny@sunny-laptop:~$ uname -a
Linux sunny-laptop 2.6.32-21-generic #32-Ubuntu SMP Fri Apr 16 08:10:02 UTC 2010 i686 GNU/Linux
sunny@sunny-laptop:~$ sudo rm /var/lib/apt/lists/lock
[sudo] password for sunny:
sunny@sunny-laptop:~$ sudo cp -arf /var/lib/dpkg /var/lib/dpkg.backup
sunny@sunny-laptop:~$ sudo cp /var/lib/dpkg/status-old /var/lib/dpkg/status
sunny@sunny-laptop:~$ sudo cp /var/lib/dpkg/available-old /var/lib/dpkg/available
sunny@sunny-laptop:~$ sudo rm -rf /var/lib/dpkg/updates/*
sunny@sunny-laptop:~$ sudo rm -rf /var/lib/apt/lists
sunny@sunny-laptop:~$ sudo mkdir /var/lib/apt/lists
sunny@sunny-laptop:~$ sudo mkdir /var/lib/apt/lists/partial
sunny@sunny-laptop:~$ LANG=C;sudo aptitude clean
Reading package lists... Done
Building dependency tree
Reading state information... Done
Initializing package states... Done
Writing extended state information... Done
sunny@sunny-laptop:~$ LANG=C;sudo aptitude autoclean
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Freed 0B of disk space
sunny@sunny-laptop:~$ LANG=C;sudo apt-get update
Get:1 http://security.ubuntu.com lucid-security Release.gpg [189B]
Get:2 http://gb.archive.ubuntu.com lucid Release.gpg [189B]
Get:3 http://gb.archive.ubuntu.com lucid-updates Release.gpg [189B]
Get:4 http://security.ubuntu.com lucid-security Release [38.5kB]
Get:5 http://gb.archive.ubuntu.com lucid Release [57.2kB]
Get:6 http://gb.archive.ubuntu.com lucid-updates Release [38.5kB]
Get:7 http://security.ubuntu.com lucid-security/main Packages [14.6kB]
Get:8 http://security.ubuntu.com lucid-security/restricted Packages [14B]
Get:9 http://security.ubuntu.com lucid-security/main Sources [4130B]
Get:10 http://security.ubuntu.com lucid-security/restricted Sources [14B]
Get:11 http://security.ubuntu.com lucid-security/universe Packages [3469B]
Get:12 http://security.ubuntu.com lucid-security/universe Sources [780B]
Get:13 http://security.ubuntu.com lucid-security/multiverse Packages [14B]
Get:14 http://security.ubuntu.com lucid-security/multiverse Sources [14B]
Get:15 http://gb.archive.ubuntu.com lucid/main Packages [1386kB]
Get:16 http://gb.archive.ubuntu.com lucid/restricted Packages [6208B]
Get:17 http://gb.archive.ubuntu.com lucid/main Sources [659kB]
Get:18 http://gb.archive.ubuntu.com lucid/restricted Sources [3775B]
Get:19 http://gb.archive.ubuntu.com lucid/universe Packages [5448kB]
Get:20 http://gb.archive.ubuntu.com lucid/universe Sources [3165kB]
Get:21 http://gb.archive.ubuntu.com lucid/multiverse Packages [180kB]
Get:22 http://gb.archive.ubuntu.com lucid/multiverse Sources [119kB]
Get:23 http://gb.archive.ubuntu.com lucid-updates/main Packages [172kB]
Get:24 http://gb.archive.ubuntu.com lucid-updates/restricted Packages [2102B]
Get:25 http://gb.archive.ubuntu.com lucid-updates/main Sources [66.5kB]
Get:26 http://gb.archive.ubuntu.com lucid-updates/restricted Sources [737B]
Get:27 http://gb.archive.ubuntu.com lucid-updates/universe Packages [31.0kB]
Get:28 http://gb.archive.ubuntu.com lucid-updates/universe Sources [8389B]
Get:29 http://gb.archive.ubuntu.com lucid-updates/multiverse Packages [632B]
Get:30 http://gb.archive.ubuntu.com lucid-updates/multiverse Sources [14B]
Fetched 11.4MB in 23s (476kB/s)
Reading package lists... Done
sunny@sunny-laptop:~$ sudo dpkg --clear-avail
sunny@sunny-laptop:~$ sudo dpkg --configure -a
Setting up liba52-0.7.4 (0.7.4-13ubuntu1) ...
dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing liba52-0.7.4 (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up libopencore-amrwb0 (0.1.2-1) ...
dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libopencore-amrwb0 (--configure):
 subprocess installed post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of gstreamer0.10-plugins-ugly:
 gstreamer0.10-plugins-ugly depends on liba52-0.7.4; however:
  Package liba52-0.7.4 is not configured yet.
 gstreamer0.10-plugins-ugly depends on libopencore-amrwb0; however:
  Package libopencore-amrwb0 is not configured yet.
dpkg: error processing gstreamer0.10-plugins-ugly (--configure):
 dependency problems - leaving unconfigured
Setting up libtwolame0 (0.3.12-1) ...
dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libtwolame0 (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up libopencore-amrnb0 (0.1.2-1) ...
dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libopencore-amrnb0 (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up libsidplay1 (1.36.59-5) ...
dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libsidplay1 (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up libmpeg2-4 (0.4.1-3) ...
dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libmpeg2-4 (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up libmad0 (0.15.1b-4ubuntu1) ...
dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libmad0 (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up libid3tag0 (0.15.1b-10build2) ...
dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libid3tag0 (--configure):
 subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
 liba52-0.7.4
 libopencore-amrwb0
 gstreamer0.10-plugins-ugly
 libtwolame0
 libopencore-amrnb0
 libsidplay1
 libmpeg2-4
 libmad0
 libid3tag0
sunny@sunny-laptop:~$ LANG=C;sudo aptitude install -f
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:
  gstreamer0.10-plugins-ugly liba52-0.7.4 libid3tag0 libmad0 libmpeg2-4 libopencore-amrnb0 libopencore-amrwb0
  libsidplay1 libtwolame0
0 packages upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
Need to get 0B of archives. After unpacking 0B will be used.
Setting up liba52-0.7.4 (0.7.4-13ubuntu1) ...
dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing liba52-0.7.4 (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up libid3tag0 (0.15.1b-10build2) ...
dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libid3tag0 (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up libmad0 (0.15.1b-4ubuntu1) ...
dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libmad0 (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up libmpeg2-4 (0.4.1-3) ...
dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libmpeg2-4 (--configure):
 subprocess installed post-installation script returned error exit status 2
No apport report written because MaxReports is reached already
                                                              Setting up libopencore-amrnb0 (0.1.2-1) ...
dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libopencore-amrnb0 (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up libopencore-amrwb0 (0.1.2-1) ...
No apport report written because MaxReports is reached already
                                                              dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libopencore-amrwb0 (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up libsidplay1 (1.36.59-5) ...
No apport report written because MaxReports is reached already
                                                              dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libsidplay1 (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up libtwolame0 (0.3.12-1) ...
No apport report written because MaxReports is reached already
                                                              dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libtwolame0 (--configure):
 subprocess installed post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of gstreamer0.10-plugins-ugly:
 gstreamer0.10-plugins-ugly depends on liba52-0.7.4; however:
  Package liba52-0.7.4 is not configured yet.
 gstreamer0.10-plugins-ugly depends on libid3tag0 (>= 0.15.1b); however:
  Package libid3tag0 is not configured yet.
 gstreamer0.10-plugins-ugly depends on libmad0 (>= 0.15.1b-3); however:
  Package libmad0 is not configured yet.
 gstreamer0.10-plugins-ugly depends on libmpeg2-4; however:
  Package libmpeg2-4 is not configured yet.
 gstreamer0.10-plugins-ugly depends on libopencore-amrnb0; however:
  Package libopencore-amrnb0 is not configured yet.
 gstreamer0.10-plugins-ugly depends on libopencore-amrwb0; however:
  Package libopencore-amrwb0 is not configured yet.
 gstreamer0.10-plugins-ugly deNo apport report written because MaxReports is reached already
                                                                                            pends on libsidplay1; however:
  Package libsidplay1 is not configured yet.
 gstreamer0.10-plugins-ugly depends on libtwolame0; however:
  Package libtwolame0 is not configured yet.
dpkg: error processing gstreamer0.10-plugins-ugly (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              Errors were encountered while processing:
 liba52-0.7.4
 libid3tag0
 libmad0
 libmpeg2-4
 libopencore-amrnb0
 libopencore-amrwb0
 libsidplay1
 libtwolame0
 gstreamer0.10-plugins-ugly
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install. Trying to recover:
Setting up liba52-0.7.4 (0.7.4-13ubuntu1) ...
dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing liba52-0.7.4 (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up libopencore-amrwb0 (0.1.2-1) ...
dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libopencore-amrwb0 (--configure):
 subprocess installed post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of gstreamer0.10-plugins-ugly:
 gstreamer0.10-plugins-ugly depends on liba52-0.7.4; however:
  Package liba52-0.7.4 is not configured yet.
 gstreamer0.10-plugins-ugly depends on libopencore-amrwb0; however:
  Package libopencore-amrwb0 is not configured yet.
dpkg: error processing gstreamer0.10-plugins-ugly (--configure):
 dependency problems - leaving unconfigured
Setting up libtwolame0 (0.3.12-1) ...
dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libtwolame0 (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up libopencore-amrnb0 (0.1.2-1) ...
dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libopencore-amrnb0 (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up libsidplay1 (1.36.59-5) ...
dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libsidplay1 (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up libmpeg2-4 (0.4.1-3) ...
dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libmpeg2-4 (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up libmad0 (0.15.1b-4ubuntu1) ...
dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libmad0 (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up libid3tag0 (0.15.1b-10build2) ...
dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libid3tag0 (--configure):
 subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
 liba52-0.7.4
 libopencore-amrwb0
 gstreamer0.10-plugins-ugly
 libtwolame0
 libopencore-amrnb0
 libsidplay1
 libmpeg2-4
 libmad0
 libid3tag0
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done

sunny@sunny-laptop:~$ LANG=C;sudo aptitude update
Hit http://security.ubuntu.com lucid-security Release.gpg
Hit http://gb.archive.ubuntu.com lucid Release.gpg
Hit http://gb.archive.ubuntu.com lucid-updates Release.gpg
Hit http://security.ubuntu.com lucid-security Release
Hit http://gb.archive.ubuntu.com lucid Release
Hit http://gb.archive.ubuntu.com lucid-updates Release
Hit http://security.ubuntu.com lucid-security/main Packages
Hit http://gb.archive.ubuntu.com lucid/main Packages
Hit http://security.ubuntu.com lucid-security/restricted Packages
Hit http://security.ubuntu.com lucid-security/main Sources
Hit http://security.ubuntu.com lucid-security/restricted Sources
Hit http://gb.archive.ubuntu.com lucid/restricted Packages
Hit http://gb.archive.ubuntu.com lucid/main Sources
Hit http://gb.archive.ubuntu.com lucid/restricted Sources
Hit http://security.ubuntu.com lucid-security/universe Packages
Hit http://security.ubuntu.com lucid-security/universe Sources
Hit http://security.ubuntu.com lucid-security/multiverse Packages
Hit http://security.ubuntu.com lucid-security/multiverse Sources
Hit http://gb.archive.ubuntu.com lucid/universe Packages
Hit http://gb.archive.ubuntu.com lucid/universe Sources
Hit http://gb.archive.ubuntu.com lucid/multiverse Packages
Hit http://gb.archive.ubuntu.com lucid/multiverse Sources
Hit http://gb.archive.ubuntu.com lucid-updates/main Packages
Hit http://gb.archive.ubuntu.com lucid-updates/restricted Packages
Hit http://gb.archive.ubuntu.com lucid-updates/main Sources
Hit http://gb.archive.ubuntu.com lucid-updates/restricted Sources
Hit http://gb.archive.ubuntu.com lucid-updates/universe Packages
Hit http://gb.archive.ubuntu.com lucid-updates/universe Sources
Hit http://gb.archive.ubuntu.com lucid-updates/multiverse Packages
Hit http://gb.archive.ubuntu.com lucid-updates/multiverse Sources
Reading package lists... Done

sunny@sunny-laptop:~$ LANG=C;sudo aptitude dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
The following NEW packages will be installed:
  linux-headers-2.6.32-22{a} linux-headers-2.6.32-22-generic{a} linux-image-2.6.32-22-generic
The following packages will be REMOVED:
  linux-headers-2.6.32-21{u} linux-headers-2.6.32-21-generic{u}
The following packages will be upgraded:
  linux-generic linux-headers-generic linux-image-generic
The following partially installed packages will be configured:
  gstreamer0.10-plugins-ugly liba52-0.7.4 libid3tag0 libmad0 libmpeg2-4 libopencore-amrnb0 libopencore-amrwb0
  libsidplay1 libtwolame0
3 packages upgraded, 3 newly installed, 2 to remove and 0 not upgraded.
Need to get 41.5MB of archives. After unpacking 96.9MB will be used.
Do you want to continue? [Y/n/?] y
Writing extended state information... Done
Get:1 http://gb.archive.ubuntu.com/ubuntu/ lucid-updates/main linux-headers-2.6.32-22 2.6.32-22.33 [9868kB]
Get:2 http://gb.archive.ubuntu.com/ubuntu/ lucid-updates/main linux-headers-2.6.32-22-generic 2.6.32-22.33 [727kB]
Get:3 http://gb.archive.ubuntu.com/ubuntu/ lucid-updates/main linux-headers-generic 2.6.32.22.23 [3950B]
Get:4 http://gb.archive.ubuntu.com/ubuntu/ lucid-updates/main linux-image-2.6.32-22-generic 2.6.32-22.33 [30.9MB]
Get:5 http://gb.archive.ubuntu.com/ubuntu/ lucid-updates/main linux-generic 2.6.32.22.23 [3956B]
Get:6 http://gb.archive.ubuntu.com/ubuntu/ lucid-updates/main linux-image-generic 2.6.32.22.23 [3960B]
Fetched 41.5MB in 1min 17s (536kB/s)
Selecting previously deselected package linux-headers-2.6.32-22.
(Reading database ... 133089 files and directories currently installed.)
Unpacking linux-headers-2.6.32-22 (from .../linux-headers-2.6.32-22_2.6.32-22.33_all.deb) ...
Selecting previously deselected package linux-headers-2.6.32-22-generic.
Unpacking linux-headers-2.6.32-22-generic (from .../linux-headers-2.6.32-22-generic_2.6.32-22.33_i386.deb) ...
Preparing to replace linux-headers-generic 2.6.32.21.22 (using .../linux-headers-generic_2.6.32.22.23_i386.deb) ...
Unpacking replacement linux-headers-generic ...
(Reading database ... 151496 files and directories currently installed.)
Removing linux-headers-2.6.32-21-generic ...
Removing linux-headers-2.6.32-21 ...
Selecting previously deselected package linux-image-2.6.32-22-generic.
(Reading database ... 133090 files and directories currently installed.)
Unpacking linux-image-2.6.32-22-generic (from .../linux-image-2.6.32-22-generic_2.6.32-22.33_i386.deb) ...
Done.
Preparing to replace linux-generic 2.6.32.21.22 (using .../linux-generic_2.6.32.22.23_i386.deb) ...
Unpacking replacement linux-generic ...
Preparing to replace linux-image-generic 2.6.32.21.22 (using .../linux-image-generic_2.6.32.22.23_i386.deb) ...
Unpacking replacement linux-image-generic ...
Setting up liba52-0.7.4 (0.7.4-13ubuntu1) ...
dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing liba52-0.7.4 (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up libid3tag0 (0.15.1b-10build2) ...
dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libid3tag0 (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up libmad0 (0.15.1b-4ubuntu1) ...
dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libmad0 (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up libmpeg2-4 (0.4.1-3) ...
dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libmpeg2-4 (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up libopencore-amrnb0 (0.1.2-1) ...
No apport report written because MaxReports is reached already
                                                              dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libopencore-amrnb0 (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up libopencore-amrwb0 (0.1.2-1) ...
No apport report written because MaxReports is reached already
                                                              dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libopencore-amrwb0 (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up libsidplay1 (1.36.59-5) ...
No apport report written because MaxReports is reached already
                                                              dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libsidplay1 (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up libtwolame0 (0.3.12-1) ...
No apport report written because MaxReports is reached already
                                                              dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libtwolame0 (--configure):
 subprocess installed post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of gstreamer0.10-plugins-ugly:
 gstreamer0.10-plugins-ugly depends on liba52-0.7.4; however:
  Package liba52-0.7.4 is not configured yet.
 gstreamer0.10-plugins-ugly depends on libid3tag0 (>= 0.15.1b); however:
  Package libid3tag0 is not configured yet.
 gstreamer0.10-plugins-ugly depends on libmad0 (>= 0.15.1b-3); however:
  Package libmad0 is not configured yet.
 gstreamer0.10-plugins-ugly depends on libmpeg2-4; however:
  Package libmpeg2-4 is not configured yet.
 gstreamer0.10-plugins-ugly depends on libopencore-amrnb0; however:
  Package libopencore-amrnb0 is not configured yet.
 gstreamer0.10-plugins-ugly depends on libopencore-amrwb0; however:
  Package libopencore-amrwb0 is not configured yet.
 gstreamer0.10-plugins-ugly deNo apport report written because MaxReports is reached already
                                                                                            No apport report written because MaxReports is reached already
                             pends on libsidplay1; however:
  Package libsidplay1 is not configured yet.
 gstreamer0.10-plugins-ugly depends on libtwolame0; however:
  Package libtwolame0 is not configured yet.
dpkg: error processing gstreamer0.10-plugins-ugly (--configure):
 dependency problems - leaving unconfigured
Setting up linux-headers-2.6.32-22 (2.6.32-22.33) ...
Setting up linux-headers-2.6.32-22-generic (2.6.32-22.33) ...
Examining /etc/kernel/header_postinst.d.
run-parts: executing /etc/kernel/header_postinst.d/nvidia-common 2.6.32-22-generic /boot/vmlinuz-2.6.32-22-generic

Setting up linux-headers-generic (2.6.32.22.23) ...
Setting up linux-image-2.6.32-22-generic (2.6.32-22.33) ...
Running depmod.
update-initramfs: Generating /boot/initrd.img-2.6.32-22-generic
Running postinst hook script /usr/sbin/update-grub.
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.32-22-generic
Found initrd image: /boot/initrd.img-2.6.32-22-generic
Found linux image: /boot/vmlinuz-2.6.32-21-generic
Found initrd image: /boot/initrd.img-2.6.32-21-generic
Found memtest86+ image: /boot/memtest86+.bin
done
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/nvidia-common 2.6.32-22-generic /boot/vmlinuz-2.6.32-22-generic
run-parts: executing /etc/kernel/postinst.d/pm-utils 2.6.32-22-generic /boot/vmlinuz-2.6.32-22-generic

Setting up linux-image-generic (2.6.32.22.23) ...
Setting up linux-generic (2.6.32.22.23) ...
Errors were encountered while processing:
 liba52-0.7.4
 libid3tag0
 libmad0
 libmpeg2-4
 libopencore-amrnb0
 libopencore-amrwb0
 libsidplay1
 libtwolame0
 gstreamer0.10-plugins-ugly
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install. Trying to recover:
Setting up liba52-0.7.4 (0.7.4-13ubuntu1) ...
dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing liba52-0.7.4 (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up libopencore-amrwb0 (0.1.2-1) ...
dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libopencore-amrwb0 (--configure):
 subprocess installed post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of gstreamer0.10-plugins-ugly:
 gstreamer0.10-plugins-ugly depends on liba52-0.7.4; however:
  Package liba52-0.7.4 is not configured yet.
 gstreamer0.10-plugins-ugly depends on libopencore-amrwb0; however:
  Package libopencore-amrwb0 is not configured yet.
dpkg: error processing gstreamer0.10-plugins-ugly (--configure):
 dependency problems - leaving unconfigured
Setting up libtwolame0 (0.3.12-1) ...
dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libtwolame0 (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up libopencore-amrnb0 (0.1.2-1) ...
dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libopencore-amrnb0 (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up libsidplay1 (1.36.59-5) ...
dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libsidplay1 (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up libmpeg2-4 (0.4.1-3) ...
dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libmpeg2-4 (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up libmad0 (0.15.1b-4ubuntu1) ...
dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libmad0 (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up libid3tag0 (0.15.1b-10build2) ...
dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libid3tag0 (--configure):
 subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
 liba52-0.7.4
 libopencore-amrwb0
 gstreamer0.10-plugins-ugly
 libtwolame0
 libopencore-amrnb0
 libsidplay1
 libmpeg2-4
 libmad0
 libid3tag0
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Writing extended state information... Done

Current status: 0 updates [-3].

Hey Mark thanks for attending to my problem again.I will soon gain mastery over this.So that i wont be bothering you like this.

Ian Ace (iaculallad) said : #4

After getting the stated error, input the following command to your terminal:

sudo apt-get -f install

HTH.

First run this command to get rid of the problematic package dependencies:

sudo aptitude purge gstreamer0.10-plugins-ugly liba52-0.7.4 libopencore-amrwb0 libtwolame0 libopencore-amrnb0 libsidplay1 libmpeg2-4 libid3tag0

The command starts with sudo and ends with libid3tag0 at the very end of the command.

Then run these commands again:

sudo dpkg --clear-avail
sudo dpkg --configure -a
LANG=C;sudo aptitude install -f
LANG=C;sudo aptitude update
LANG=C;sudo aptitude dist-upgrade

@Ian: he already ran that command and it did not help.

sunny@sunny-laptop:~$ sudo aptitude purge gstreamer0.10-plugins-ugly liba52-0.7.4 libopencore-amrwb0 libtwolame0 libopencore-amrnb0 libsidplay1 libmpeg2-4 libid3tag0
[sudo] password for sunny:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initialising package states... Done
The following packages will be REMOVED:
  gstreamer0.10-plugins-ugly{p} liba52-0.7.4{p} libid3tag0{p} libmpeg2-4{p} libopencore-amrnb0{p} libopencore-amrwb0{p}
  libsidplay1{p} libtwolame0{p}
The following partially installed packages will be configured:
  libmad0
0 packages upgraded, 0 newly installed, 8 to remove and 0 not upgraded.
Need to get 0B of archives. After unpacking 2,634kB will be freed.
Do you want to continue? [Y/n/?] y
Writing extended state information... Done
(Reading database ... 136473 files and directories currently installed.)
Removing gstreamer0.10-plugins-ugly ...
Removing liba52-0.7.4 ...
dpkg (subprocess): unable to execute installed post-removal script: Exec format error
dpkg: error processing liba52-0.7.4 (--purge):
 subprocess installed post-removal script returned error exit status 2
Removing libid3tag0 ...
dpkg (subprocess): unable to execute installed post-removal script: Exec format error
dpkg: error processing libid3tag0 (--purge):
 subprocess installed post-removal script returned error exit status 2
Removing libmpeg2-4 ...
dpkg (subprocess): unable to execute installed post-removal script: Exec format error
dpkg: error processing libmpeg2-4 (--purge):
 subprocess installed post-removal script returned error exit status 2
Removing libopencore-amrnb0 ...
dpkg (subprocess): unable to execute installed post-removal script: Exec format error
dpkg: error processing libopencore-amrnb0 (--purge):
 subprocess installed post-removal script returned error exit status 2
No apport report written because MaxReports has already been reached
                                                                    Removing libopencore-amrwb0 ...
dpkg (subprocess): unable to execute installed post-removal script: Exec format error
dpkg: error processing libopencore-amrwb0 (--purge):
 subprocess installed post-removal script returned error exit status 2
No apport report written because MaxReports has already been reached
                                                                    Removing libsidplay1 ...
dpkg (subprocess): unable to execute installed post-removal script: Exec format error
dpkg: error processing libsidplay1 (--purge):
 subprocess installed post-removal script returned error exit status 2
No apport report written because MaxReports has already been reached
                                                                    Removing libtwolame0 ...
dpkg (subprocess): unable to execute installed post-removal script: Exec format error
dpkg: error processing libtwolame0 (--purge):
 subprocess installed post-removal script returned error exit status 2
No apport report written because MaxReports has already been reached
                                                                    Errors were encountered while processing:
 liba52-0.7.4
 libid3tag0
 libmpeg2-4
 libopencore-amrnb0
 libopencore-amrwb0
 libsidplay1
 libtwolame0
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install. Trying to recover:
Setting up libmad0 (0.15.1b-4ubuntu1) ...
dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libmad0 (--configure):
 subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
 libmad0
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initialising package states... Done
Writing extended state information... Done

sunny@sunny-laptop:~$ sudo dpkg --clear-avail
sunny@sunny-laptop:~$ sudo dpkg --configure -a
Setting up libmad0 (0.15.1b-4ubuntu1) ...
dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libmad0 (--configure):
 subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
 libmad0
sunny@sunny-laptop:~$ LANG=C;sudo aptitude install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
The following packages will be REMOVED:
  liba52-0.7.4{p} libid3tag0{p} libmpeg2-4{p} libopencore-amrnb0{p} libopencore-amrwb0{p} libsidplay1{p} libtwolame0{p}
The following partially installed packages will be configured:
  libmad0
0 packages upgraded, 0 newly installed, 7 to remove and 0 not upgraded.
Need to get 0B of archives. After unpacking 1323kB will be freed.
Do you want to continue? [Y/n/?] y
(Reading database ... 136359 files and directories currently installed.)
Removing liba52-0.7.4 ...
dpkg (subprocess): unable to execute installed post-removal script: Exec format error
dpkg: error processing liba52-0.7.4 (--purge):
 subprocess installed post-removal script returned error exit status 2
Removing libid3tag0 ...
dpkg (subprocess): unable to execute installed post-removal script: Exec format error
dpkg: error processing libid3tag0 (--purge):
 subprocess installed post-removal script returned error exit status 2
Removing libmpeg2-4 ...
dpkg (subprocess): unable to execute installed post-removal script: Exec format error
dpkg: error processing libmpeg2-4 (--purge):
 subprocess installed post-removal script returned error exit status 2
Removing libopencore-amrnb0 ...
dpkg (subprocess): unable to execute installed post-removal script: Exec format error
dpkg: error processing libopencore-amrnb0 (--purge):
 subprocess installed post-removal script returned error exit status 2
No apport report written because MaxReports is reached already
                                                              Removing libopencore-amrwb0 ...
dpkg (subprocess): unable to execute installed post-removal script: Exec format error
dpkg: error processing libopencore-amrwb0 (--purge):
 subprocess installed post-removal script returned error exit status 2
No apport report written because MaxReports is reached already
                                                              Removing libsidplay1 ...
dpkg (subprocess): unable to execute installed post-removal script: Exec format error
dpkg: error processing libsidplay1 (--purge):
 subprocess installed post-removal script returned error exit status 2
No apport report written because MaxReports is reached already
                                                              Removing libtwolame0 ...
dpkg (subprocess): unable to execute installed post-removal script: Exec format error
dpkg: error processing libtwolame0 (--purge):
 subprocess installed post-removal script returned error exit status 2
No apport report written because MaxReports is reached already
                                                              Errors were encountered while processing:
 liba52-0.7.4
 libid3tag0
 libmpeg2-4
 libopencore-amrnb0
 libopencore-amrwb0
 libsidplay1
 libtwolame0
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install. Trying to recover:
Setting up libmad0 (0.15.1b-4ubuntu1) ...
dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libmad0 (--configure):
 subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
 libmad0
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done

sunny@sunny-laptop:~$ LANG=C;sudo aptitude update
Hit http://security.ubuntu.com lucid-security Release.gpg
Hit http://gb.archive.ubuntu.com lucid Release.gpg
Hit http://gb.archive.ubuntu.com lucid-updates Release.gpg
Hit http://security.ubuntu.com lucid-security Release
Hit http://gb.archive.ubuntu.com lucid Release
Hit http://gb.archive.ubuntu.com lucid-updates Release
Hit http://security.ubuntu.com lucid-security/main Packages
Hit http://security.ubuntu.com lucid-security/restricted Packages
Hit http://security.ubuntu.com lucid-security/main Sources
Hit http://gb.archive.ubuntu.com lucid/main Packages
Hit http://security.ubuntu.com lucid-security/restricted Sources
Hit http://security.ubuntu.com lucid-security/universe Packages
Hit http://security.ubuntu.com lucid-security/universe Sources
Hit http://security.ubuntu.com lucid-security/multiverse Packages
Hit http://security.ubuntu.com lucid-security/multiverse Sources
Hit http://gb.archive.ubuntu.com lucid/restricted Packages
Hit http://gb.archive.ubuntu.com lucid/main Sources
Hit http://gb.archive.ubuntu.com lucid/restricted Sources
Hit http://gb.archive.ubuntu.com lucid/universe Packages
Hit http://gb.archive.ubuntu.com lucid/universe Sources
Hit http://gb.archive.ubuntu.com lucid/multiverse Packages
Hit http://gb.archive.ubuntu.com lucid/multiverse Sources
Hit http://gb.archive.ubuntu.com lucid-updates/main Packages
Hit http://gb.archive.ubuntu.com lucid-updates/restricted Packages
Hit http://gb.archive.ubuntu.com lucid-updates/main Sources
Hit http://gb.archive.ubuntu.com lucid-updates/restricted Sources
Hit http://gb.archive.ubuntu.com lucid-updates/universe Packages
Hit http://gb.archive.ubuntu.com lucid-updates/universe Sources
Hit http://gb.archive.ubuntu.com lucid-updates/multiverse Packages
Hit http://gb.archive.ubuntu.com lucid-updates/multiverse Sources
Reading package lists... Done

sunny@sunny-laptop:~$ LANG=C;sudo aptitude dist-upgrade
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:
  libmad0
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 384kB of archives. After unpacking 0B will be used.
Get:1 http://gb.archive.ubuntu.com/ubuntu/ lucid/universe liba52-0.7.4 0.7.4-13ubuntu1 [28.6kB]
Get:2 http://gb.archive.ubuntu.com/ubuntu/ lucid/main libid3tag0 0.15.1b-10build2 [35.5kB]
Get:3 http://gb.archive.ubuntu.com/ubuntu/ lucid/universe libmpeg2-4 0.4.1-3 [55.9kB]
Get:4 http://gb.archive.ubuntu.com/ubuntu/ lucid/universe libopencore-amrnb0 0.1.2-1 [90.1kB]
Get:5 http://gb.archive.ubuntu.com/ubuntu/ lucid/universe libopencore-amrwb0 0.1.2-1 [46.9kB]
Get:6 http://gb.archive.ubuntu.com/ubuntu/ lucid/universe libsidplay1 1.36.59-5 [73.5kB]
Get:7 http://gb.archive.ubuntu.com/ubuntu/ lucid/universe libtwolame0 0.3.12-1 [53.6kB]
Fetched 384kB in 1s (244kB/s)
Selecting previously deselected package liba52-0.7.4.
(Reading database ... 136360 files and directories currently installed.)
Preparing to replace liba52-0.7.4 0.7.4-13ubuntu1 (using .../liba52-0.7.4_0.7.4-13ubuntu1_i386.deb) ...
Unpacking replacement liba52-0.7.4 ...
dpkg (subprocess): unable to execute old post-removal script: Exec format error
dpkg: warning: old post-removal script returned error exit status 2
dpkg - trying script from the new package instead ...
dpkg: ... it looks like that went OK.
Selecting previously deselected package libid3tag0.
Preparing to replace libid3tag0 0.15.1b-10build2 (using .../libid3tag0_0.15.1b-10build2_i386.deb) ...
Unpacking replacement libid3tag0 ...
dpkg (subprocess): unable to execute old post-removal script: Exec format error
dpkg: warning: old post-removal script returned error exit status 2
dpkg - trying script from the new package instead ...
dpkg: ... it looks like that went OK.
Selecting previously deselected package libmpeg2-4.
Preparing to replace libmpeg2-4 0.4.1-3 (using .../libmpeg2-4_0.4.1-3_i386.deb) ...
Unpacking replacement libmpeg2-4 ...
dpkg (subprocess): unable to execute old post-removal script: Exec format error
dpkg: warning: old post-removal script returned error exit status 2
dpkg - trying script from the new package instead ...
dpkg: ... it looks like that went OK.
Selecting previously deselected package libopencore-amrnb0.
Preparing to replace libopencore-amrnb0 0.1.2-1 (using .../libopencore-amrnb0_0.1.2-1_i386.deb) ...
Unpacking replacement libopencore-amrnb0 ...
dpkg (subprocess): unable to execute old post-removal script: Exec format error
dpkg: warning: old post-removal script returned error exit status 2
dpkg - trying script from the new package instead ...
dpkg: ... it looks like that went OK.
Selecting previously deselected package libopencore-amrwb0.
Preparing to replace libopencore-amrwb0 0.1.2-1 (using .../libopencore-amrwb0_0.1.2-1_i386.deb) ...
Unpacking replacement libopencore-amrwb0 ...
dpkg (subprocess): unable to execute old post-removal script: Exec format error
dpkg: warning: old post-removal script returned error exit status 2
dpkg - trying script from the new package instead ...
dpkg: ... it looks like that went OK.
Selecting previously deselected package libsidplay1.
Preparing to replace libsidplay1 1.36.59-5 (using .../libsidplay1_1.36.59-5_i386.deb) ...
Unpacking replacement libsidplay1 ...
dpkg (subprocess): unable to execute old post-removal script: Exec format error
dpkg: warning: old post-removal script returned error exit status 2
dpkg - trying script from the new package instead ...
dpkg: ... it looks like that went OK.
Selecting previously deselected package libtwolame0.
Preparing to replace libtwolame0 0.3.12-1 (using .../libtwolame0_0.3.12-1_i386.deb) ...
Unpacking replacement libtwolame0 ...
dpkg (subprocess): unable to execute old post-removal script: Exec format error
dpkg: warning: old post-removal script returned error exit status 2
dpkg - trying script from the new package instead ...
dpkg: ... it looks like that went OK.
Setting up liba52-0.7.4 (0.7.4-13ubuntu1) ...

Setting up libid3tag0 (0.15.1b-10build2) ...

Setting up libmad0 (0.15.1b-4ubuntu1) ...
dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libmad0 (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up libmpeg2-4 (0.4.1-3) ...

Setting up libopencore-amrnb0 (0.1.2-1) ...

Setting up libopencore-amrwb0 (0.1.2-1) ...

Setting up libsidplay1 (1.36.59-5) ...

Setting up libtwolame0 (0.3.12-1) ...

Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
Errors were encountered while processing:
 libmad0
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install. Trying to recover:
Setting up libmad0 (0.15.1b-4ubuntu1) ...
dpkg (subprocess): unable to execute installed post-installation script: Exec format error
dpkg: error processing libmad0 (--configure):
 subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
 libmad0
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Writing extended state information... Done

Run this command to get rid of the package libmad0

sudo aptitude purge libmad0

Then run these commands again:

sudo dpkg --clear-avail
sudo dpkg --configure -a
LANG=C;sudo aptitude install -f
LANG=C;sudo aptitude update
LANG=C;sudo aptitude dist-upgrade

sunny@sunny-laptop:~$ sudo aptitude purge libmad0
[sudo] password for sunny:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initialising package states... Done
The following packages will be REMOVED:
  libmad0{p}
0 packages upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
Need to get 0B of archives. After unpacking 156kB will be freed.
Do you want to continue? [Y/n/?] y
Writing extended state information... Done
(Reading database ... 136414 files and directories currently installed.)
Removing libmad0 ...
dpkg (subprocess): unable to execute installed post-removal script: Exec format error
dpkg: error processing libmad0 (--purge):
 subprocess installed post-removal script returned error exit status 2
Errors were encountered while processing:
 libmad0
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
Initialising package states... Done
Writing extended state information... Done

Open terminal and run this command:

sudo rm /var/lib/dpkg/info/libmad*.post*

Then rerun this command:

sudo aptitude purge libmad0

This should fix the issue with libmad0

This solution is also described here:

http://rowlandm.blogspot.com/

.

Thanks Mark Rijckenberg, that solved my question.