0

I am trying to install nginx but I got this error.

ahmed@ahmed-Inspiron-5537:~$ sudo apt-get install nginx
[sudo] password for ahmed: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
nginx is already the newest version (1.10.3-1ubuntu3).
The following packages were automatically installed and are no longer required:
  linux-headers-4.10.0-19 linux-headers-4.10.0-19-generic
  linux-image-4.10.0-19-generic linux-image-extra-4.10.0-19-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.10.3-1ubuntu3) ...
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 2017-06-09 15:49:00 +04; 10ms ago
     Docs: man:nginx(8)
  Process: 13214 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=1/FAILURE)
  Process: 13202 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
      CPU: 26ms

يون 09 15:48:58 ahmed-Inspiron-5537 nginx[13214]: nginx: [emerg] …e)
يون 09 15:48:59 ahmed-Inspiron-5537 nginx[13214]: nginx: [emerg] …e)
يون 09 15:48:59 ahmed-Inspiron-5537 nginx[13214]: nginx: [emerg] …e)
يون 09 15:48:59 ahmed-Inspiron-5537 nginx[13214]: nginx: [emerg] …e)
يون 09 15:48:59 ahmed-Inspiron-5537 nginx[13214]: nginx: [emerg] …e)
يون 09 15:49:00 ahmed-Inspiron-5537 nginx[13214]: nginx: [emerg] …()
يون 09 15:49:00 ahmed-Inspiron-5537 systemd[1]: nginx.service: Co…=1
يون 09 15:49:00 ahmed-Inspiron-5537 systemd[1]: Failed to start A…r.
يون 09 15:49:00 ahmed-Inspiron-5537 systemd[1]: nginx.service: Un…e.
يون 09 15:49:00 ahmed-Inspiron-5537 systemd[1]: nginx.service: Fa…'.
Hint: Some lines were ellipsized, use -l to show in full.
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.10.3-1ubuntu3.1~) | nginx-full (<< 1.10.3-1ubuntu3.1~) | nginx-light (<< 1.10.3-1ubuntu3.1~) | nginx-extras (<< 1.10.3-1ubuntu3.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.10.3-1ubuntu3) | nginx-full (>= 1.10.3-1ubuntu3) | nginx-light (>= 1.10.3-1ubuntu3) | nginx-extras (>= 1.10.3-1ubuntu3); 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)

2 Answers 2

2

You can also try by executing the following command:

  1. Get the list of all Nginx packages installed

    dpkg -l | grep nginx
    
  2. Remove all the packages for nginx by executing the following command:

    apt-get --purge autoremove nginx-* 
    

    or

    apt-get --purge autoremove <packages listed in ouput of 1>
    

The above commands will remove all Nginx dependencies. In addition to that check if /var/lib/nginx and /etc/nginx are deleted or not. If it is not removed, removed the directories by executing the following command:

rm -rf /var/lib/nginx /etc/nginx
0

ahmed@ahmed-Inspiron-5537:~$ sudo apt-get install nginx
[sudo] password for ahmed:
Reading package lists... Done
Building dependency tree
Reading state information... Done
nginx is already the newest version (1.10.3-1ubuntu3).
The following packages were automatically installed and are no longer required:
blah blah

It also says:

2 not fully installed or removed.

So you should try:

sudo apt purge nginx

And then:

sudo apt install nginx

By doing this you completely uninstall nginx and then reinstall it.

Let me know if it works :),
Wessel

You must log in to answer this question.

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