apt-get broken, cannot fix or remove libapt-pkg4.12

Solution 1:

Run:

dpkg --configure -a

and try again.

You can also download the libapt-pkg package from here and install it manually:


If the above commands don't work:

Update: The command below doesn't work. Download the appropriate version directly at http://security.ubuntu.com/ubuntu/pool/main/a/apt/.

Download the package using the following command:

wget http://security.ubuntu.com/ubuntu/pool/main/a/apt/libapt-pkg4.12_0.9.7.1ubuntu2_amd64.deb

Now remove the currently installed package:

sudo dpkg --force-depends -r libapt-pkg4.12
sudo dpkg --force-depends -r libapt-pkg4.12:i386

Then, install the downloaded package:

sudo dpkg -i libapt-pkg4.12_0.9.7.1ubuntu2_amd64.deb

Run, the following command again and check:

sudo apt-get -f install 

Solution 2:

This is how I did it:

First, I downloaded this 2 deb files:

apt_0.9.7.7ubuntu3_i386.deb
libapt-pkg4.12_0.9.7.7ubuntu3_i386.deb

Second, I run this command:

sudo dpkg --force-depends -r libapt-pkg4.12

Then I install the 2 deb files with this command:

sudo dpkg -i apt_0.9.7.7ubuntu3_i386.deb libapt-pkg4.12_0.9.7.7ubuntu3_i386.deb

and it works....