为什么从 Ubuntu 中删除 nginx 时会收到依赖性警告/错误?

为什么从 Ubuntu 中删除 nginx 时会收到依赖性警告/错误?
root@ubuntus:~# apt-get remove nginx-light
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package nginx-light is not installed, so not removed
You might want to run `apt-get -f install' to correct these:
The following packages have unmet dependencies:
  nginx-full: Depends: nginx-common (= 1.0.5-1ppa2~lucid) but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

如何解决?

更新:

root@tftc:~# 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 41 not upgraded.
2 not fully installed or removed.
Need to get 0B/60.6kB of archives.
After this operation, 246kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
(Reading database ... 62634 files and directories currently installed.)
Unpacking nginx-common (from .../nginx-common_1.0.5-1ppa2~lucid_all.deb) ...
dpkg: error processing /var/cache/apt/archives/nginx-common_1.0.5-1ppa2~lucid_all.deb (--unpack):
 trying to overwrite '/etc/ufw/applications.d/nginx', which is also in package nginx 0:1.0.5-1ppa2~lucid
Processing triggers for man-db ...
Processing triggers for ureadahead ...
Processing triggers for ufw ...
Errors were encountered while processing:
 /var/cache/apt/archives/nginx-common_1.0.5-1ppa2~lucid_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

答案1

由于弄乱了软件包存储库,您的系统崩溃了。因此,您必须按顺序执行以下命令来解决问题:

apt-get update
apt-get upgrade
apt-get install nginx-common
apt-get remove nginx-full

每一步都要仔细阅读消息并遵循给出的说明。

编辑: 我说的仍然没错。你真的搞乱了你的设置。强制安装从来都不是一个好主意。你试图安装一个不适合你的系统的软件包,然后又强制安装了另一个版本号的软件包。我不知道你强制安装/更新/删除了哪些其他软件包。(这2 not fully installed or removed.是一件坏事。)所以我会尝试

apt-get remove nginx-common nginx-full
apt-get purge nginx-common nginx-full
apt-get -f install

下次安装适用于其他 Ubuntu/Debian 版本的软件包之前请三思。

答案2

我只是“重现”了这个问题:

  • 安装 Ubuntu 10.04 中的标准 nginx 0.7.x
  • 添加 nginx 的 PPA
  • 运行apt-get updateapt-get upgrade
  • 升级失败,尝试删除/清除 nginx 也失败

修复:

  • 删除 nginx PPA(我注释掉了该行/etc/apt/sources.list.d/...
  • apt-get purge nginx nginx-full nginx-common- 现在成功了
  • 再次添加 PPA(取消注释该行)
  • apt-get updateapt-get install nginx

相关内容