1

Since last month (or two) I am observing this kind of error when running apt-get upgrade:

Preparing to unpack .../nginx-common_1.9.3-1ubuntu1.2_all.deb ...
Unpacking nginx-common (1.9.3-1ubuntu1.2) over (1.9.3-1ubuntu1.1) ...
dpkg: error processing archive /var/cache/apt/archives/nginx-common_1.9.3-1ubuntu1.2_all.deb (--unpack):
 trying to overwrite '/etc/logrotate.d/nginx', which is also in package nginx 1.10.1-1~wily
Preparing to unpack .../nginx-core_1.9.3-1ubuntu1.2_amd64.deb ...
Unpacking nginx-core (1.9.3-1ubuntu1.2) over (1.9.3-1ubuntu1.1) ...
dpkg: error processing archive /var/cache/apt/archives/nginx-core_1.9.3-1ubuntu1.2_amd64.deb (--unpack):
 trying to overwrite '/usr/sbin/nginx', which is also in package nginx 1.10.1-1~wily
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)

Though the whole upgrade process doesn't fail, I still have this error mentioned at the end of upgrade process:

Errors were encountered while processing:
 /var/cache/apt/archives/nginx-common_1.9.3-1ubuntu1.2_all.deb
 /var/cache/apt/archives/nginx-core_1.9.3-1ubuntu1.2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

If I understand it correctly, I have version 1.10.1 currently installed while apt is trying to install version 1.9.3 over it... I.e., it's trying to donwgrade it. Am I right? Is it possible that the newer version came from some PPA while the older one is coming from some official list?

I have Ubuntu 15.10 installed.

How can I prevent this downgrade to happen?

EDIT: Here an output from apt-cache policy nginx

nginx:
  Installed: 1.10.1-1~wily
  Candidate: 1.10.1-1~wily
  Version table:
 *** 1.10.1-1~wily 0
        500 http://nginx.org/packages/ubuntu/ wily/nginx amd64 Packages
        100 /var/lib/dpkg/status
     1.10.0-1~wily 0
        500 http://nginx.org/packages/ubuntu/ wily/nginx amd64 Packages
     1.9.3-1ubuntu1.2 0
        500 http://de.archive.ubuntu.com/ubuntu/ wily-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ wily-security/main amd64 Packages
     1.9.3-1ubuntu1 0
        500 http://de.archive.ubuntu.com/ubuntu/ wily/main amd64 Packages
     1.8.1-1~wily 0
        500 http://nginx.org/packages/ubuntu/ wily/nginx amd64 Packages
     1.8.0-1~wily 0
        500 http://nginx.org/packages/ubuntu/ wily/nginx amd64 Packages
shadyyx
  • 173
  • 1
  • 7

1 Answers1

2

First I would check to see what package APT is configured to install (out of the available options), you can do this with:

apt-cache policy nginx

e.g.

% apt-cache policy nginx
nginx:
  Installed: 1.10.0-0ubuntu0.16.04.2
  Candidate: 1.10.0-0ubuntu0.16.04.2
  Version table:
 *** 1.10.0-0ubuntu0.16.04.2 500
        500 http://nz.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
        500 http://nz.archive.ubuntu.com/ubuntu xenial-updates/main i386 Packages
        500 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu xenial-security/main i386 Packages
        100 /var/lib/dpkg/status
     1.9.15-0ubuntu1 500
        500 http://nz.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
        500 http://nz.archive.ubuntu.com/ubuntu xenial/main i386 Packages

This tells me that if I didn't already have nginx installed, apt would try and install the

1.10.0-0ubuntu0.16.04.2

version of nginx.
Then to install a particular - non candidate - package you can specify it as an option to apt-get e.g. from man apt ( I've truncated the output to make it easier to understand)

SYNOPSIS
apt-get ... pkg [{=pkg_version_number ] ...

e.g.

apt-get install nginx=1.9.15-0ubuntu1

would install the non-candidate version of the nginx package if that was necessary. Note you may have to do some of your own dependency management in this case, but not always.

  • Hi, thanks for the help. I have this output: Installed: 1.10.1-1~wily and Candidate: 1.10.1-1~wily, then version table with these versions: 1.10.1-1~wily 0, 1.10.0-1~wily 0, 1.9.3-1ubuntu1.2 0, 1.9.3-1ubuntu1 0, 1.8.1-1~wily 0 and 1.8.0-1~wily 0. So it all should be fine except for apt-get upgrade tries to install 1.9.3-1ubuntu1.2 0 over my current newest version... I'll add this output to my question. – shadyyx Jun 29 '16 at 13:59