56

I have seen it before. I am just wondering what exactly does it do?

2 Answers2

52

From man apt-get:

   -f, --fix-broken
       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.
Isaiah
  • 59,344
  • 21
    A you can thank the lord for it. When you have a broken package its like having a rock inside your shoe... and you are in a marathon... with bears riding sharks riding huge spiders. But thanks to this broken stuff gets fixed. – Luis Alvarado Aug 24 '11 at 04:04
  • 4
    In the occasional situation where sudo apt-get -f install is not, by itself, sufficient to fix broken packages, see this answer. – Eliah Kagan Sep 13 '12 at 16:22
  • Just as an addition - if you change your mind about the package that resulted in the unmet dependencies, then simply do sudo apt-get remove package to get rid of the unmet dependency error and not install the packages that fix the break. –  Oct 10 '16 at 12:53
1

Here's where I found it very useful. I ran a dpkg command to install a couple of .deb packages, but the install failed because some dependencies were missing.

I then ran

apt-get -f install

and it installed exactly the dependencies that were needed. I was then able to re-run my dpkg command and everything worked.

Chad
  • 493
  • 6
  • 13