Problems with Nginx when attempting to install other packages

October 19, 2018 1.5k views
Nginx Ubuntu 18.04

Hello,
Whenever I try to install a new packages It shows me the error below:

sudo apt-get install firefox
Reading package lists... Done
Building dependency tree       
Reading state information... Done
firefox is already the newest version (62.0.3+build1-0ubuntu0.18.04.1).
The following packages were automatically installed and are no longer required:
  linux-headers-4.15.0-33 linux-image-4.15.0-33-generic
  linux-modules-4.15.0-33-generic linux-modules-extra-4.15.0-33-generic
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up nginx-core (1.14.0-0ubuntu1.1) ...
Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xe" for details.
invoke-rc.d: initscript nginx, action "start" failed.
● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2018-10-19 23:07:47 +06; 5ms ago
     Docs: man:nginx(8)
  Process: 28316 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)

অক্টোবর 19 23:07:47 azizul-Lenovo-ideapad systemd[1]: Starting A high performance web server and a reverse proxy server...
অক্টোবর 19 23:07:47 azizul-Lenovo-ideapad nginx[28316]: nginx: [emerg] "tcp_nopush" directive is duplicate in /etc/nginx/conf.d/ee-plus.conf:6
অক্টোবর 19 23:07:47 azizul-Lenovo-ideapad nginx[28316]: nginx: configuration file /etc/nginx/nginx.conf test failed
অক্টোবর 19 23:07:47 azizul-Lenovo-ideapad systemd[1]: nginx.service: Control process exited, code=exited status=1
অক্টোবর 19 23:07:47 azizul-Lenovo-ideapad systemd[1]: nginx.service: Failed with result 'exit-code'.
অক্টোবর 19 23:07:47 azizul-Lenovo-ideapad systemd[1]: Failed to start A high performance web server and a reverse proxy server.
dpkg: error processing package nginx-core (--configure):
 installed nginx-core package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of nginx:
 nginx depends on nginx-core (<< 1.14.0-0ubuntu1.1.1~) | nginx-full (<< 1.14.0-0ubuntu1.1.1~) | nginx-light (<< 1.14.0-0ubuntu1.1.1~) | nginx-extras (<< 1.14.0-0ubuntu1.1.1~); however:
  Package nginx-core is not configured yet.
  Package nginx-full is not installed.
  Package nginx-light is not installed.
  Package nginx-extras is not installed.
 nginx depends on nginx-core (>= 1.14.0-0ubuntu1.1) | nginx-full (>= 1.14.0-0ubuntu1.1) | nginx-light (>= 1.14.0-0ubuntu1.1) | nginx-extras (>= 1.14.0-0ubuntu1.1); however:
  Package nginx-core is not configured yet.
  Package nginx-full is not installed.
  Package nginx-light is not installed.
  Package nginx-extras is not installed.

dpkg: error processing package nginx (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                          Errors were encountered while processing:
 nginx-core
 nginx
E: Sub-process /usr/bin/dpkg returned an error code (1)

systemctl status nginx.service shows as below:

● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2018-10-19 23:09:05 +06; 11min ago
     Docs: man:nginx(8)
  Process: 28626 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)

অক্টোবর 19 23:09:05 azizul-Lenovo-ideapad systemd[1]: Starting A high performance web server and a reverse proxy server...
অক্টোবর 19 23:09:05 azizul-Lenovo-ideapad nginx[28626]: nginx: [emerg] "tcp_nopush" directive is duplicate in /etc/nginx/conf.d/ee-plus.conf:6
অক্টোবর 19 23:09:05 azizul-Lenovo-ideapad nginx[28626]: nginx: configuration file /etc/nginx/nginx.conf test failed
অক্টোবর 19 23:09:05 azizul-Lenovo-ideapad systemd[1]: nginx.service: Control process exited, code=exited status=1
অক্টোবর 19 23:09:05 azizul-Lenovo-ideapad systemd[1]: nginx.service: Failed with result 'exit-code'.
অক্টোবর 19 23:09:05 azizul-Lenovo-ideapad systemd[1]: Failed to start A high performance web server and a reverse proxy server.

Any help is highly appreciated.

Thank you.

3 comments
  • Uninstall nginx?

  • Thanks @X40C, uninstalling nginx fix the issue.

    sudo apt-get purge nginx nginx-commoncode
    
    sudo apt-get autoremove
    
  • The nginx.conf file had errors in it so nginx was not able to start but i've no idea why it would affect the installation of other packages.

1 Answer

I had this happen once before and its a huge pain in the ass.
Try running sudo apt update --fix-missing

Have another answer? Share your knowledge.