Nginx on CentOS 7 – Fix Errors When Updating Packages

centos7installationnginxpackageswebmin

I have a CentOS 7 VM with Nginx installed. I use Webmin to administer the server.

It normally installs updates automatically, but the nginx update failed so I tried to manually do the update. It returns this:

Installing package(s) with command /bin/yum -y install nginx ..
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.netsite.dk
 * epel: mirror.netsite.dk
 * extras: mirror.netsite.dk
 * updates: mirror.netsite.dk
Resolving Dependencies
--> Running transaction check
---> Package nginx.x86_64 1:1.20.1-9.el7 will be updated
--> Processing Dependency: nginx(abi) = 1.20.1 for package: 1:nginx-mod-mail-1.20.1-9.el7.x86_64
--> Processing Dependency: nginx(abi) = 1.20.1 for package: 1:nginx-mod-stream-1.20.1-9.el7.x86_64
--> Processing Dependency: nginx(abi) = 1.20.1 for package: 1:nginx-mod-http-perl-1.20.1-9.el7.x86_64
--> Processing Dependency: nginx(abi) = 1.20.1 for package: 1:nginx-mod-http-image-filter-1.20.1-9.el7.x86_64
--> Processing Dependency: nginx(abi) = 1.20.1 for package: 1:nginx-mod-http-xslt-filter-1.20.1-9.el7.x86_64
---> Package nginx.x86_64 1:1.20.2-1.el7.ngx will be an update
--> Finished Dependency Resolution
Error: Package: 1:nginx-mod-http-perl-1.20.1-9.el7.x86_64 (@epel)
           Requires: nginx(abi) = 1.20.1
           Removing: 1:nginx-1.20.1-9.el7.x86_64 (@epel)
               nginx(abi) = 1.20.1
           Updated By: 1:nginx-1.20.2-1.el7.ngx.x86_64 (nginx)
               Not found
Error: Package: 1:nginx-mod-stream-1.20.1-9.el7.x86_64 (@epel)
           Requires: nginx(abi) = 1.20.1
           Removing: 1:nginx-1.20.1-9.el7.x86_64 (@epel)
               nginx(abi) = 1.20.1
           Updated By: 1:nginx-1.20.2-1.el7.ngx.x86_64 (nginx)
               Not found
Error: Package: 1:nginx-mod-mail-1.20.1-9.el7.x86_64 (@epel)
           Requires: nginx(abi) = 1.20.1
           Removing: 1:nginx-1.20.1-9.el7.x86_64 (@epel)
               nginx(abi) = 1.20.1
           Updated By: 1:nginx-1.20.2-1.el7.ngx.x86_64 (nginx)
               Not found
Error: Package: 1:nginx-mod-http-image-filter-1.20.1-9.el7.x86_64 (@epel)
           Requires: nginx(abi) = 1.20.1
           Removing: 1:nginx-1.20.1-9.el7.x86_64 (@epel)
               nginx(abi) = 1.20.1
           Updated By: 1:nginx-1.20.2-1.el7.ngx.x86_64 (nginx)
               Not found
Error: Package: 1:nginx-mod-http-xslt-filter-1.20.1-9.el7.x86_64 (@epel)
           Requires: nginx(abi) = 1.20.1
           Removing: 1:nginx-1.20.1-9.el7.x86_64 (@epel)
               nginx(abi) = 1.20.1
           Updated By: 1:nginx-1.20.2-1.el7.ngx.x86_64 (nginx)
               Not found
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest
.. install failed!

I have tried to run the rpm command suggested – and then redo the package update. But that made no difference.

I also tried to install the 19 other packages – they all installed correctly. Then I retried Nginx – but it still fails with the same error… I have also tried to disable the nginx repo and the epel repo in turn (in case it was a clash between the two repos) – but it made no difference.

Does anyone know what caused this issue – and how to fix it?

Thanks in advance!

/John

Best Answer

I've solved this for my system, though my solution may not be applicable to everyone, depending on whether or not you use the nginx-* modules that are causing the dependency issues.


My solution was to remove nginx-mod-http-perl, nginx-mod-stream, nginx-mod-mail, nginx-mod-http-image-filter, and nginx-mod-http-xslt-filter, and I was then able to yum upgrade to get the latest nginx version.

Edited to add: In addition to removing those packages, I updated /etc/yum.repos.d/epel.repo to have exclude=nginx*, to prevent @epel-provided nginx packages from being reinstalled.

This worked for me because I don't actually use the functionality provided by those packages; I have a hunch they are installed by Webmin (which, like the OP, I'm also using) to support some of the features that it can provide.

If you are using functionality these modules provide, then I think the solution, at least for now, is to disable the nginx repo, and re-enable it if/when @epel releases compatible modules. If you do this, you will not have any nginx upgrades available, since there's no 1.20.2 available on @epel.


The core problem seems to be that you (and I) have nginx-1.20.1-9.el7.x86_64 (@epel) installed, but both @epel and nginx repos enabled.

On/around Nov 16, the nginx repo released nginx-1.20.2, and so yum is now trying to update to that version. However, there are no corresponding 1.20.2 updates for the various nginx-* modules installed (either on @epel or on nginx) and so they couldn't be udpated. Those modules also require nginx(abi) = 1.20.1, which is the one that @epel provides (but that nginx does not appear to provide) and so the dependency check failed.

Sidenote: in our case, we did have the nginx-provided core package installed at one point in time, and it was replaced at some point with the @epel version - this is from yum logs:

# zgrep -h nginx.x86 /var/log/yum.log-202* /var/log/yum.log
Apr 22 03:55:37 Updated: nginx.x86_64 1:1.18.0-1.el7.ngx
Oct 30 09:27:11 Updated: nginx.x86_64 1:1.18.0-2.el7.ngx
Apr 21 08:48:33 Updated: nginx.x86_64 1:1.20.0-1.el7.ngx
May 26 04:20:28 Updated: nginx.x86_64 1:1.20.1-1.el7.ngx
Jun 18 06:46:31 Installed: nginx.x86_64 1:1.20.1-2.el7
Oct 27 04:51:03 Updated: nginx.x86_64 1:1.20.1-9.el7

On June 18 the .ngx package was replaced with the one provided by @epel. This may or may not be relevant to the problem at hand.