sudo apt-get -f install 是什么意思?

我以前见过它。我只是想知道它到底是做什么的?
2个回答

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.

21你可以感谢上帝。当你有一个破损的包裹时,就像脚里有一块石头...而且你正在参加马拉松比赛...有熊骑着鲨鱼骑着巨大的蜘蛛。但幸好这些破损的东西会被修复好。 - Luis Alvarado
4在偶尔的情况下,sudo apt-get -f install 单独使用可能无法完全修复损坏的软件包。请参考这个答案 - Eliah Kagan
补充一点,如果你对导致未满足依赖的 package 改变主意,只需执行 sudo apt-get remove package 来消除未满足依赖错误,不安装修复问题的包。 - user373531

这是我发现它非常有用的地方。我运行了一个dpkg命令来安装一些.deb包,但安装失败了,因为缺少一些依赖项。
然后我运行了
apt-get -f install

并且它准确地安装了所需的依赖项。然后,我能够重新运行我的dpkg命令,一切都正常工作了。