How to Fix Broken Packages in Ubuntu [Quick Tip]

January 4, 2015 — 5 Comments

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/* -vf

sudo apt-get update

3. If a problem occurs with a lock on the apt cache, for example:

E: Could not get lock /var/cache/apt/archives/lock – open (11: Resource temporarily unavailable)

Then delete the locks by running below commands one by one:

sudo fuser -cuk /var/lib/dpkg/lock 

sudo rm -f /var/lib/dpkg/lock

sudo fuser -cuk /var/cache/apt/archives/lock

sudo rm -f /var/cache/apt/archives/lock

If you have some more tips to fix broken packages in Ubuntu Linux, please don’t hesitate to leave a comment here.

I'm a freelance blogger who started using Ubuntu 5+ years ago and wishes to share my experiences and some useful tips with Ubuntu beginners and lovers. Please notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me on Google Plus or email to ubuntuhandbook1@gmail.com

5 responses to How to Fix Broken Packages in Ubuntu [Quick Tip]

  1. im running ubuntu 14.10
    ive been noticing below lines at the end of sudo apt-get update

    N: Ignoring file ‘getdeb.list.bck’ in directory ‘/etc/apt/sources.list.d/’ as it has an invalid filename extension
    W: Failed to fetch “http://archive.getdeb.net/ubuntu/dists/utopic-getdeb/apps/binary-i386/Packages” Bad header line [IP: 104.28.24.125 80]

    W: Failed to fetch “http://archive.getdeb.net/ubuntu/dists/utopic-getdeb/games/binary-i386/Packages” 416 Requested Range Not Satisfiable [IP: 104.28.24.125 80]

    W: Failed to fetch “http://ppa.launchpad.net/jon-severinsson/ffmpeg/ubuntu/dists/utopic/main/binary-amd64/Packages” 404 Not Found

    W: Failed to fetch “http://ppa.launchpad.net/jon-severinsson/ffmpeg/ubuntu/dists/utopic/main/binary-i386/Packages” 404 Not Found

    W: Failed to fetch “http://ppa.launchpad.net/mc3man/trusty-media/ubuntu/dists/utopic/main/binary-amd64/Packages” 404 Not Found

    W: Failed to fetch “http://ppa.launchpad.net/mc3man/trusty-media/ubuntu/dists/utopic/main/binary-i386/Packages” 404 Not Found

    E: Some index files failed to download. They have been ignored, or old ones used instead.

    • You got these errors because the server stability or your internet connection is not good. Just ignore them, or go to Software & Update utility -> other Software -> disable or remove these repositories from the list.

  2. If you are having difficulty upgrading or updating due to unmet dependencies open package manager and click on your settings menu, then preferences, now remove the checkmark from the box marked ‘consider recommendations as dependencies’. Reboot and upgrade. M.A.

  3. in ubuntu 14.04, this issue received
    N: Ignoring file ‘archive.key’ in directory ‘/etc/apt/sources.list.d/’ as it has an invalid filename extension
    N: Ignoring file ‘archive.key’ in directory ‘/etc/apt/sources.list.d/’ as it has an invalid filename extension
    Thanks in advance

  4. The following packages have unmet dependencies:

    vlc: Depends: vlc-nox (= 2.1.6-0ubuntu14.04.1) but 2.1.6-0ubuntu14.04.1 is to be installed
    Depends: libc6 (>= 2.15) but 2.19-0ubuntu6.6 is to be installed
    Depends: libfreetype6 (>= 2.2.1) but 2.5.2-1ubuntu2.5 is to be installed
    Depends: libgcc1 (>= 1:4.1.1) but 1:4.9.1-0ubuntu1 is to be installed
    Depends: libqtcore4 (>= 4:4.8.0) but 4:4.8.5+git192-g085f851+dfsg-2ubuntu4.1 is to be installed
    Depends: libqtgui4 (>= 4:4.8.0) but 4:4.8.5+git192-g085f851+dfsg-2ubuntu4.1 is to be installed
    Depends: libsdl-image1.2 (>= 1.2.10) but it is not going to be installed
    Depends: libstdc++6 (>= 4.6) but 4.8.4-2ubuntu1~14.04 is to be installed
    Depends: libva-x11-1 (> 1.3.0~) but it is not going to be installed
    Depends: libva1 (> 1.3.0~) but it is not going to be installed
    Depends: libxcb-composite0 but it is not going to be installed
    Depends: libxcb-xv0 (>= 1.2) but it is not going to be installed
    Depends: zlib1g (>= 1:1.2.3.3) but 1:1.2.8.dfsg-1ubuntu1 is to be installed

Leave a Reply

*

Text formatting is available via select HTML.

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>