Fixing the Apt Repository and Package Manager

Here’s a guide to fixing the APT repository and package manager. This will fix any broken packages, which will stop you from upgrading your Ubuntu system.

The Error Messages

For some reason, you are attempting to update Ubuntu through the command line like so:

sudo apt-get upgrade

or via the Package Manager. But then you are getting the following errors (line 3 may be different for you, depending on the missing package):

W: Some index files failed to download. They have been ignored, or old ones used instead.
E: Malformed Status line, no 3rd word
E: Error occurred while processing libexiv2-11 (UsePackage3)
E: Problem with MergeList /var/lib/dpkg/status
E: The package lists or status file could not be parsed or opened.

or maybe this (line 5 may be different for you, depending on the missing package):

Reading package lists... Error!
E: Malformed Status line, no 3rd word
E: Error occurred while processing libexiv2-11 (UsePackage3)
E: Problem with MergeList /var/lib/dpkg/status
E: The package lists or status file could not be parsed or opened

These messages affirm that the APT repository is indeed broken.


Fixing the APT repository and Package Manager

First off, clean the APT list which may be corrupted:

sudo rm /var/lib/apt/lists/* -vf

Then, clean the debian packaging modules:

sudo mv /var/lib/dpkg/status /var/lib/dpkg/status-bad

And replace the bad packaging module with the previous, working one:

sudo cp /var/lib/dpkg/status-old /var/lib/dpkg/status

Update the repository:

sudo apt-get update

By the end of this, your package manager and apt-repository should be fix and raring to go again!

Technology Consultant at ServiceRocket. Great knowledge in Atlassian JIRA. Blogger. Programmer. Anime Vector Artist.