3

i want to reinstall nginx and i get this error when purge or install.

sudo service nginx start
Job for nginx.service failed because the control process exited with 
error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
alson@Alson:~$ sudo apt purge nginx
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
nginx*
0 upgraded, 0 newly installed, 1 to remove and 1 not upgraded.
2 not fully installed or removed.
After this operation, 37,9 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 197124 files and directories currently installed.)
Removing nginx (1.10.3-0ubuntu0.16.04.2) ...
Setting up nginx-core (1.10.3-0ubuntu0.16.04.2) ...
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 Jum 2017-09-22 10:32:36 WIB; 12ms ago
Process: 13157 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
Main PID: 2996 (code=exited, status=0/SUCCESS)

Sep 22 10:32:36 Alson systemd[1]: Starting A high performance web server and a reverse proxy server...
Sep 22 10:32:36 Alson nginx[13157]: nginx: [emerg] open() "/etc/nginx/nginx.conf" failed (2: No such file or directory)
Sep 22 10:32:36 Alson nginx[13157]: nginx: configuration file /etc/nginx/nginx.conf test failed
Sep 22 10:32:36 Alson systemd[1]: nginx.service: Control process exited, code=exited status=1
Sep 22 10:32:36 Alson systemd[1]: Failed to start A high performance web server and a reverse proxy server.
Sep 22 10:32:36 Alson systemd[1]: nginx.service: Unit entered failed state.
Sep 22 10:32:36 Alson systemd[1]: nginx.service: Failed with result 'exit-code'.
dpkg: error processing package nginx-core (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
nginx-core
E: Sub-process /usr/bin/dpkg returned an error code (1)
1

You seem to have unconfigured packages (2 not fully installed or removed.).

So you should deal with those first by doing sudo apt install -f. Afterwards you can retry to purge (sudo apt purge nginx). Depending on your situation, I would recommend to remove nginx sub-components using sudo apt autoremove --purge to purge leftover nginx dependencies to have a clean reinstall.

If all of that works out, you can reinstall nginx (sudo apt install nginx).

Edit:

Since the problem can't be resolved this way and the problem is caused by nginx-core you can try to manually fix the problem by doing:

sudo apt -f remove nginx-core

This tells apt to fix the problem using your provided instruction, which is to just remove nginx-core.

Edit 2:

Since the last failing package is nginx-full (see line 29 in your log) you have to remove that as well.

To do so: sudo apt -f remove nginx-full

Work through through the steps above afterwards, starting with sudo apt autoremove --purge.

9
  • I've done all the above from the beginning before I made the post, but nobody can. is there any other way? – Alson Sep 22 '17 at 8:11
  • @Alson I edited my answer. – FatalMerlin Sep 22 '17 at 8:22
  • not work. this frustrates me, is there any other way? – Alson Sep 22 '17 at 8:38
  • @Alson Can you provide logs? What happened when you tried to remove nginx-core? – FatalMerlin Sep 22 '17 at 8:59
  • when remove nginx-core i get this error pastebin.com/TF1cd7FQ – Alson Sep 22 '17 at 9:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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