How to fix dependencies / broken packages [duplicate]

When I try to install system updates, skype or phpmyadmin I got this error:

You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 libc6 : Depends: libgcc1 but it is not going to be installed
         Depends: tzdata but it is not going to be installed
 libc6-dev : Depends: libc-dev-bin (= 2.15-0ubuntu10.3)
             Depends: linux-libc-dev but it is not going to be installed
             Recommends: gcc but it is not going to be installed or
                         c-compiler
 skype:i386 : Depends: libasound2:i386 (>= 1.0.16) but it is not going to be installed
              Depends: libc6:i386 (>= 2.3.6-6~) but it is not going to be installed
              Depends: libc6:i386 (>= 2.7) but it is not going to be installed
              Depends: libgcc1:i386 (>= 1:4.1.1) but it is not going to be installed
              Depends: libqt4-dbus:i386 (>= 4:4.5.3) but it is not going to be installed
              Depends: libqt4-network:i386 (>= 4:4.8.0) but it is not going to be installed
              Depends: libqt4-xml:i386 (>= 4:4.5.3) but it is not going to be installed
              Depends: libqtcore4:i386 (>= 4:4.7.0~beta1) but it is not going to be installed
              Depends: libqtgui4:i386 (>= 4:4.8.0) but it is not going to be installed
              Depends: libqtwebkit4:i386 (>= 2.1.0~2011week13) but it is not going to be installed
              Depends: libstdc++6:i386 (>= 4.6) but it is not going to be installed
              Depends: libx11-6:i386 but it is not going to be installed
              Depends: libxext6:i386 but it is not going to be installed
              Depends: libxss1:i386 but it is not going to be installed
              Depends: libxv1:i386 but it is not going to be installed
              Depends: libssl1.0.0:i386 but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

How to solve this?


Solution 1:

-f or --fix-broken

Explanation from the man apt-get pages

Fix; attempt to correct a system with broken dependencies in place. This option, when used with install/remove, can omit any packages to permit APT to deduce a likely solution. If packages are specified, these have to completely correct the problem. The option is sometimes necessary when running APT for the first time; APT itself does not allow broken package dependencies to exist on a system. It is possible that a system's dependency structure can be so corrupt as to require manual intervention (which usually means using dselect(1) or dpkg --remove to eliminate some of the offending packages). Use of this option together with -m may produce an error in some situations. Configuration Item: APT::Get::Fix-Broken.

I recommend trying the following commands.

sudo dpkg --configure -a

sudo apt-get install -f

Answer yes to any prompts and let apt-get try to resolve the issue for you.

EDIT:

Based on comment try the following command it should clean up your system.

sudo sh -c "apt-get update;apt-get dist-upgrade;apt-get autoremove;apt-get autoclean"