1

I've seen similar questions asked mostly not solved. I'm installing nginx after stopping apache server

dpkg: error processing package nginx-core (--configure): subprocess installed post-installation script returned error exit status 1

$ sudo apt install nginx

Reading package lists... Done
Building dependency tree       
Reading state information... Done
nginx is already the newest version (1.9.15-0ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 25 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.9.15-0ubuntu1) ...
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.
dpkg: error processing package nginx-core (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of nginx:
 nginx depends on nginx-core (>= 1.9.15-0ubuntu1) | nginx-full (>= 1.9.15-0ubuntu1) | nginx-light (>= 1.9.15-0ubuntu1) | nginx-extras (>= 1.9.15-0ubuntu1); 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.9.15-0ubuntu1.1~) | nginx-full (<< 1.9.15-0ubuntu1.1~) | nginx-light (<< 1.9.15-0ubuntu1.1~) | nginx-extras (<< 1.9.15-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)

Output after running "systemctl status nginx.service"

nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: en
   Active: failed (Result: exit-code) since Fri 2017-05-26 12:50:30 IST; 3min 27
  Process: 21570 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (cod
  Process: 21566 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process

May 26 12:50:28 infinity nginx[21570]: nginx: [emerg] bind() to 0.0.0.0:80 faile
May 26 12:50:28 infinity nginx[21570]: nginx: [emerg] bind() to 0.0.0.0:80 faile
May 26 12:50:29 infinity nginx[21570]: nginx: [emerg] bind() to 0.0.0.0:80 faile
May 26 12:50:29 infinity nginx[21570]: nginx: [emerg] bind() to 0.0.0.0:80 faile
May 26 12:50:30 infinity nginx[21570]: nginx: [emerg] bind() to 0.0.0.0:80 faile
May 26 12:50:30 infinity nginx[21570]: nginx: [emerg] still could not bind()
May 26 12:50:30 infinity systemd[1]: nginx.service: Control process exited, code
May 26 12:50:30 infinity systemd[1]: Failed to start A high performance web serv
May 26 12:50:30 infinity systemd[1]: nginx.service: Unit entered failed state.
May 26 12:50:30 infinity systemd[1]: nginx.service: Failed with result 'exit-cod
lines 1-16/16 (END)

Output after running "journalctl -xe"

-- 
-- Unit nginx.service has begun starting up.
May 26 12:50:28 infinity nginx[21570]: nginx: [emerg] bind() to 0.0.0.0:80 faile
May 26 12:50:28 infinity nginx[21570]: nginx: [emerg] bind() to 0.0.0.0:80 faile
May 26 12:50:29 infinity nginx[21570]: nginx: [emerg] bind() to 0.0.0.0:80 faile
May 26 12:50:29 infinity nginx[21570]: nginx: [emerg] bind() to 0.0.0.0:80 faile
May 26 12:50:30 infinity nginx[21570]: nginx: [emerg] bind() to 0.0.0.0:80 faile
May 26 12:50:30 infinity nginx[21570]: nginx: [emerg] still could not bind()
May 26 12:50:30 infinity systemd[1]: nginx.service: Control process exited, code
May 26 12:50:30 infinity systemd[1]: Failed to start A high performance web serv
-- Subject: Unit nginx.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit nginx.service has failed.
-- 
-- The result is failed.
May 26 12:50:30 infinity systemd[1]: nginx.service: Unit entered failed state.
May 26 12:50:30 infinity systemd[1]: nginx.service: Failed with result 'exit-cod
May 26 12:50:32 infinity sudo[21514]: pam_unix(sudo:session): session closed for
May 26 12:50:48 infinity pkexec[21608]: pam_unix(polkit-1:session): session open
May 26 12:50:48 infinity pkexec[21608]: pam_systemd(polkit-1:session): Cannot cr
May 26 12:50:48 infinity pkexec[21608]: mayuresh: Executing command [USER=root] 
lines 2095-2117/2117 (END)
3
  • Something is already bound to Port 80. Do you have Apache or another webserver installed in the system? May 26, 2017 at 11:33
  • @ThomasWard I tried this answer: serverfault.com/a/828014/417329
    – YSsdatasks
    May 26, 2017 at 16:46
  • @ThomasWard I had stopped the apache service before trying the way mentioned in the question. Even after uninstalling apache2 I had to first reinstall dpkg(see my answer bellow)
    – YSsdatasks
    May 26, 2017 at 16:53

1 Answer 1

1

I was finally able to install nginx after: I uninstalled apache2 and Reinstalled dpkg following this answer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.