大网数据广告活动
服务器运维问答

Nginx unmet dependencies, unable to upgrade / remove

· 52CE 我爱测

Recently I had installed newrelic on my Ubuntu server and after that I automatically started getting errors in log with failed to load newrelic extension. I tried upgrading / removing newrelic but in both cases I am getting a err…

问题原文

原帖链接 · Khatri · CC BY-SA 3.0

Recently I had installed newrelic on my Ubuntu server and after that I automatically started getting errors in log with failed to load newrelic extension.

I tried upgrading / removing newrelic but in both cases I am getting a error:

ubuntu@ip:/etc/php$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
 nginx : Depends: nginx-core (< 1.10.0-0ubuntu0.16.04.4.1~) but 1.10.3-0ubuntu0.16.04.1 is installed or
                  nginx-full (< 1.10.0-0ubuntu0.16.04.4.1~) but it is not installed or
                  nginx-light (< 1.10.0-0ubuntu0.16.04.4.1~) but it is not installed or
                  nginx-extras (< 1.10.0-0ubuntu0.16.04.4.1~) but it is not installed
E: Unmet dependencies. Try using -f.

I tried running sudo apt-get -f install but it results in output:

ubuntu@ip:/etc/php$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  linux-headers-4.4.0-78 linux-headers-4.4.0-78-generic linux-headers-4.4.0-79 linux-headers-4.4.0-79-generic
  linux-image-4.4.0-78-generic linux-image-4.4.0-79-generic nginx-common nginx-core
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  nginx
The following packages will be upgraded:
  nginx
1 upgraded, 0 newly installed, 0 to remove and 9 not upgraded.
7 not fully installed or removed.
Need to get 787 kB of archives.
After this operation, 2,777 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
WARNING: The following packages cannot be authenticated!
  nginx
Install these packages without verification? [y/N] y
Get:1 http://nginx.org/packages/ubuntu xenial/nginx amd64 nginx amd64 1.12.1-1~xenial [787 kB]
Fetched 787 kB in 2s (275 kB/s)
(Reading database ... 138963 files and directories currently installed.)
Preparing to unpack .../nginx_1.12.1-1~xenial_amd64.deb ...
Unpacking nginx (1.12.1-1~xenial) over (1.10.0-0ubuntu0.16.04.4) ...
dpkg: error processing archive /var/cache/apt/archives/nginx_1.12.1-1~xenial_amd64.deb (--unpack):
 trying to overwrite '/etc/nginx/uwsgi_params', which is also in package nginx-common 1.10.3-0ubuntu0.16.04.1
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/nginx_1.12.1-1~xenial_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

I did find one article which suggests removing nginx and then reinstalling. This is a production server with continuous traffic so I want to avoid risk of uninstalling nginx, and then later failing. I have changed configs of nginx, and don't have note of all my changes. Any safe way to solve this?

已采纳解答

原帖链接 · Khatri · CC BY-SA 3.0

After researching and experimenting with lot of stuff, I could not find any solution and finally followed this https://askubuntu.com/questions/243568/nginx-dependency-problem-trying-to-upgrade

I did following:

  1. I made a backup of /etc/nginx
  2. Then removed nginx
  3. re-installed nginx
  4. Then as it is replaced /etc/nginx with backup folder and it started working

I had a downtime of around 15-20 mins doing all this.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-07-12)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。