How to Fix Broken Packages in Ubuntu [Quick Tip]

Last updated: January 4, 2015

Ubuntu-tips

If a package installation fails in Ubuntu, it can cause a package manager to freeze or become locked. When you start Ubuntu Software Center, it asks you to press button to repair broken packages in your system, but it does not always work.

Fix Broken Packages in Ubuntu

Here are a few tips show you how to fix broken packages in command line. To get started, open terminal from the Dash or by pressing Ctrl+Alt+T on keyboard:

1. If a package installation fails due to dependencies issue, run below command in terminal:

sudo apt-get -f install && sudo dpkg --configure -a

The command either solves the dependencies, or removes the package (if dependencies unavailable) automatically.

2. If a problem occurs with MergeList, appearing as a missing “Package: header” error:

E: Encountered a section with no Package: header
E: Problem with MergeList…
E: The package lists or status file could not be parsed or opened.

Then remove the package lists and recreate one:

sudo rm /var/lib/apt/lists var jetpackLazyImagesL10n = {"loading_warning":"Images are still loading. Please cancel your print and try again."};