使用 apt-get -f install 时如何忽略未满足的依赖关系?

使用 apt-get -f install 时如何忽略未满足的依赖关系?

我正在尝试使用 apt-get 安装 imagick。应该很简单。这是我的命令。

apt-get install imagemagick libmagickcore-dev libmagickwand-dev

但是它并没有安装,而是一直弹出这个错误信息

The following packages have unmet dependencies:
nginx-full: Depends: nginx-common (= 1.0.4-1ppa1~lucid) but it is not going to be installed 
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

不用担心,所以我会尝试apt-get -f install

Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
  nginx-common
The following NEW packages will be installed:
  nginx-common
0 upgraded, 1 newly installed, 0 to remove and 38 not upgraded.
2 not fully installed or removed.
Need to get 0B/59.4kB of archives.
After this operation, 246kB of additional disk space will be used.
Do you want to continue [Y/n]?

好的,我们继续Y

但后来它给了我这个:

(Reading database ... 23160 files and directories currently installed.)
Unpacking nginx-common (from .../nginx-common_1.0.4-1ppa1~lucid_all.deb) ...
dpkg: error processing /var/cache/apt/archives/nginx-common_1.0.4-1ppa1~lucid_all.deb (--unpack):
 trying to overwrite '/etc/ufw/applications.d/nginx', which is also in package nginx 0:1.0.0-0ppa1~lucid
Processing triggers for man-db ...
Processing triggers for ureadahead ...
Errors were encountered while processing:
 /var/cache/apt/archives/nginx-common_1.0.4-1ppa1~lucid_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

我尝试停止 nginx 服务。我执行了 apt-get update,但无济于事 :(

任何帮助将不胜感激。

答案1

这并不能通过忽略依赖关系来解决问题,但您的 2 个软件包似乎声称拥有文件 /etc/ufw/applications.d/nginx 的所有权。如果您将其移开(mv /etc/ufw/applications.d/nginx ~/nginx-ufw-tmp),然后再次尝试 apt-get -f install,它应该不会再抱怨这个文件了。之后,您可以比较旧的和新的 /etc/ufw/applications.d/nginx 并决定要保留哪一个。请注意,这是一种特殊情况,您似乎是从 ppa 源安装了 nginx?

相关内容