sudo apt-get -f install 到底起什么作用?

sudo apt-get -f install 到底起什么作用?

我以前见过。我只是想知道它到底有什么用处?

答案1

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.

答案2

我发现它在这里非常有用。我运行了 dpkg 命令来安装几个 .deb 包,但由于缺少一些依赖项,安装失败了。

然后我跑了

apt-get -f install

并且它安装了所需的依赖项。然后我重新运行了 dpkg 命令,一切正常。

相关内容