1

I get this error while trying to upgrade:

Preparing to replace nginx 1.4.4-4~raring (using .../nginx_1.4.5-1~raring_amd64.deb) ...
Unpacking replacement nginx ...
dpkg: error processing /var/cache/apt/archives/nginx_1.4.5-1~raring_amd64.deb (--unpack):
 trying to overwrite '/usr/sbin/nginx', which is also in package nginx-full 1.4.4-4~raring
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/nginx_1.4.5-1~raring_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

I'm using these repos:

deb http://nginx.org/packages/ubuntu/ raring nginx
deb-src http://nginx.org/packages/ubuntu/ raring nginx

Why is this file in nginx and nginx-full? I thought nginx-full depends on nginx?

Does anyone know why this happens and how to resolve it? Thank you!

pythonimus
  • 367
  • 1
  • 3
  • 12

1 Answers1

3

The nginx-full package isn't from "http://nginx.org/packages/ubuntu/" repository, it is from Ubuntu main repository.

Remove nginx-full (from main repo) before installing nginx (from nginx repo).

Keep in mind you will have problems with the include directive in the nginx.conf file, you need to change the line include /etc/nginx/conf.d/*.conf to include /etc/nginx/sites-enabled/*.conf after install.

You can use apt pinning to avoid this problem by giving more priority to nginx package from nginx repository over the default ubuntu repository.

Take a look here: http://www.argon.org/~roderick/apt-pinning.html

pythonimus
  • 367
  • 1
  • 3
  • 12
fgbreel
  • 663
  • 4
  • 13
  • 1
    I just did a apt-get remove nginx-full nginx-common, apt-get upgraded nginx from nginx's repository automatically. Thanks! – pythonimus Mar 02 '14 at 00:20
  • 1
    Created /etc/apt/preferences.d/nginx and added: Package: * Pin: origin nginx.org Pin-Priority: 600 – pythonimus Mar 12 '14 at 15:17
  • Indeed, this works as expected. I updated repo and then removed `nginx-full` and `nginx-common`. Then, when I installed `sudo apt install nginx=1.9.5*` it asked me if I wanted to use new conf or keep my existing one. Very handy tool. Thanks NGiNX for being awesome~ – nicorellius Feb 12 '17 at 00:49