0

When I try to update my nginx version (installed from debian repository) to the latest version from the nginx repository, it will fail because it can not overwrite a file that is also in one of the old nginx packages (that package is about to get removed automatically). This is the bash output when running the apt install nginx -V command:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
   geoip-database (20190724-1~bpo10+1)
   libgd3 (2.2.5-5.2)
   libgeoip1 (1.6.12-3~bpo10+1)
Use 'apt autoremove' to remove them.
The following packages will be REMOVED:
   libnginx-mod-http-auth-pam (1.14.2-2)
   libnginx-mod-http-dav-ext (1.14.2-2)
   libnginx-mod-http-echo (1.14.2-2)
   libnginx-mod-http-geoip (1.14.2-2)
   libnginx-mod-http-image-filter (1.14.2-2)
   libnginx-mod-http-subs-filter (1.14.2-2)
   libnginx-mod-http-upstream-fair (1.14.2-2)
   libnginx-mod-http-xslt-filter (1.14.2-2)
   libnginx-mod-mail (1.14.2-2)
   libnginx-mod-stream (1.14.2-2)
   nginx-common (1.14.2-2)
   nginx-full (1.14.2-2)
The following packages will be upgraded:
   nginx (1.14.2-2 => 1.16.1-1~buster)
1 upgraded, 0 newly installed, 12 to remove and 0 not upgraded.
Need to get 0 B/850 kB of archives.
After this operation, 291 kB disk space will be freed.
Do you want to continue? [Y/n]
dpkg: libnginx-mod-http-auth-pam: dependency problems, but removing anyway as you requested:
 nginx-full depends on libnginx-mod-http-auth-pam (= 1.14.2-2).

(Reading database ... 152770 files and directories currently installed.)
Removing libnginx-mod-http-auth-pam (1.14.2-2) ...
dpkg: nginx-common: dependency problems, but removing anyway as you requested:
 nginx-full depends on nginx-common (= 1.14.2-2); however:
  Package nginx-common is to be removed.
 libnginx-mod-stream depends on nginx-common (= 1.14.2-2).
 libnginx-mod-mail depends on nginx-common (= 1.14.2-2).
 libnginx-mod-http-xslt-filter depends on nginx-common (= 1.14.2-2).
 libnginx-mod-http-upstream-fair depends on nginx-common (= 1.14.2-2).
 libnginx-mod-http-subs-filter depends on nginx-common (= 1.14.2-2).
 libnginx-mod-http-image-filter depends on nginx-common (= 1.14.2-2).
 libnginx-mod-http-geoip depends on nginx-common (= 1.14.2-2).
 libnginx-mod-http-echo depends on nginx-common (= 1.14.2-2).
 libnginx-mod-http-dav-ext depends on nginx-common (= 1.14.2-2).

Removing nginx-common (1.14.2-2) ...
(Reading database ... 152743 files and directories currently installed.)
Preparing to unpack .../nginx_1.16.1-1~buster_amd64.deb ...
Unpacking nginx (1.16.1-1~buster) over (1.14.2-2) ...
dpkg: error processing archive /var/cache/apt/archives/nginx_1.16.1-1~buster_amd64.deb (--unpack):
 trying to overwrite '/usr/sbin/nginx', which is also in package nginx-full 1.14.2-2
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/nginx_1.16.1-1~buster_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

It seems like it is not uninstalling the old packages first and then installing the new ones. Instead it is uninstalling two packages and then trying to install the updated one. Because after I try this update I need to reinstall nginx-common and libnginx-mod-http-auth-pam.

My question is: Does anyone know a way to force the new install (dist-upgrade and --with-new-pkgs did not work) or do I need to uninstall those packages manually? Or am I just missing a step to do before upgrading?

1
  • Did you try to remove them one by one instead of all together?
    – Seth
    Aug 19, 2019 at 11:09

2 Answers 2

0

Don't know if this is still relevant, but I had a similar issue. What worked for me was that I uninstalled the old nginx: apt remove nginx nginx-common

Then installed the new version: apt install nginx

If your current version is broken, you can fix it with apt --fix-broken install

0

Use this command. This worked for me.

sudo dpkg --purge --force-depends apache2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .