“Subprocesso / usr / bin / dpkg retornou um código de erro (1)” tentando instalar o nginx

1

Estou tentando instalar nginx , mas estou recebendo a seguinte mensagem de erro:

kurt@kurt-ThinkPad:~$ sudo apt-get install nginx
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  gyp libjs-inherits libjs-node-uuid libuv1 libuv1-dev linux-headers-4.4.0-47
  linux-headers-4.4.0-47-generic linux-image-4.4.0-47-generic
  linux-image-extra-4.4.0-47-generic node-abbrev node-ansi
  node-ansi-color-table node-archy node-async node-block-stream
  node-combined-stream node-cookie-jar node-delayed-stream node-forever-agent
  node-form-data node-fstream node-fstream-ignore node-github-url-from-git
  node-glob node-graceful-fs node-gyp node-inherits node-ini
  node-json-stringify-safe node-lockfile node-lru-cache node-mime
  node-minimatch node-mkdirp node-mute-stream node-node-uuid node-nopt
  node-normalize-package-data node-npmlog node-once node-osenv node-qs
  node-read node-read-package-json node-request node-retry node-rimraf
  node-semver node-sha node-sigmund node-slide node-tar node-tunnel-agent
  node-underscore node-which
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  nginx-common nginx-core
Suggested packages:
  fcgiwrap nginx-doc
The following NEW packages will be installed:
  nginx nginx-common nginx-core
0 upgraded, 3 newly installed, 0 to remove and 9 not upgraded.
Need to get 458 kB of archives.
After this operation, 1482 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://nl.archive.ubuntu.com/ubuntu xenial-updates/main amd64 nginx-common all 1.10.0-0ubuntu0.16.04.4 [26,6 kB]
Get:2 http://nl.archive.ubuntu.com/ubuntu xenial-updates/main amd64 nginx-core amd64 1.10.0-0ubuntu0.16.04.4 [428 kB]
Get:3 http://nl.archive.ubuntu.com/ubuntu xenial-updates/main amd64 nginx all 1.10.0-0ubuntu0.16.04.4 [3498 B]
Fetched 458 kB in 0s (685 kB/s)
Preconfiguring packages ...
Selecting previously unselected package nginx-common.
(Reading database ... 501856 files and directories currently installed.)
Preparing to unpack .../nginx-common_1.10.0-0ubuntu0.16.04.4_all.deb ...
Unpacking nginx-common (1.10.0-0ubuntu0.16.04.4) ...
Selecting previously unselected package nginx-core.
Preparing to unpack .../nginx-core_1.10.0-0ubuntu0.16.04.4_amd64.deb ...
Unpacking nginx-core (1.10.0-0ubuntu0.16.04.4) ...
Selecting previously unselected package nginx.
Preparing to unpack .../nginx_1.10.0-0ubuntu0.16.04.4_all.deb ...
Unpacking nginx (1.10.0-0ubuntu0.16.04.4) ...
Processing triggers for ufw (0.35-0ubuntu2) ...
Processing triggers for ureadahead (0.100.0-19) ...
ureadahead will be reprofiled on next reboot
Processing triggers for systemd (229-4ubuntu12) ...
Setting up nginx-common (1.10.0-0ubuntu0.16.04.4) ...
Setting up nginx-core (1.10.0-0ubuntu0.16.04.4) ...
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.10.0-0ubuntu0.16.04.4) | nginx-full (>= 1.10.0-0ubuntu0.16.04.4) | nginx-light (>= 1.10.0-0ubuntu0.16.04.4) | nginx-extras (>= 1.10.0-0ubuntu0.16.04.4); 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.0-0ubuntu0.16.04.4.1~) | nginx-full (<< 1.10.0-0ubuntu0.16.04.4.1~) | nginx-light (<< 1.10.0-0ubuntu0.16.04.4.1~) | nginx-extras (<< 1.10.0-0ubuntu0.16.04.4.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 No apport report written because the error message indicates its a followup error from a previous failure.
                                                         unconfigured
Processing triggers for systemd (229-4ubuntu12) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for ufw (0.35-0ubuntu2) ...
Errors were encountered while processing:
 nginx-core
 nginx
E: Sub-process /usr/bin/dpkg returned an error code (1)

Aqui está um excerto relevante de /var/log/syslog :

Dec  6 12:04:47 kurt-ThinkPad systemd[1]: Started CUPS Scheduler.
Dec  6 12:04:47 kurt-ThinkPad systemd[1]: Started ACPI event daemon.
Dec  6 12:04:48 kurt-ThinkPad systemd[1]: Reloading.
Dec  6 12:04:48 kurt-ThinkPad systemd[1]: snapd.refresh.timer: Adding 5h 37min 39.335667s random time.
Dec  6 12:04:48 kurt-ThinkPad systemd[1]: Started CUPS Scheduler.
Dec  6 12:04:48 kurt-ThinkPad systemd[1]: Started ACPI event daemon.
Dec  6 12:04:48 kurt-ThinkPad systemd[1]: Reloading.
Dec  6 12:04:49 kurt-ThinkPad systemd[1]: snapd.refresh.timer: Adding 3h 39min 30.123677s random time.
Dec  6 12:04:49 kurt-ThinkPad systemd[1]: Started CUPS Scheduler.
Dec  6 12:04:49 kurt-ThinkPad systemd[1]: Started ACPI event daemon.
Dec  6 12:04:49 kurt-ThinkPad systemd[1]: Starting A high performance web server and a reverse proxy server...
Dec  6 12:04:49 kurt-ThinkPad nginx[6334]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Dec  6 12:04:49 kurt-ThinkPad nginx[6334]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Dec  6 12:04:49 kurt-ThinkPad nginx[6334]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Dec  6 12:04:49 kurt-ThinkPad nginx[6334]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Dec  6 12:04:50 kurt-ThinkPad nginx[6334]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Dec  6 12:04:50 kurt-ThinkPad nginx[6334]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Dec  6 12:04:50 kurt-ThinkPad nginx[6334]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Dec  6 12:04:50 kurt-ThinkPad nginx[6334]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Dec  6 12:04:51 kurt-ThinkPad nginx[6334]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Dec  6 12:04:51 kurt-ThinkPad nginx[6334]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Dec  6 12:04:51 kurt-ThinkPad nginx[6334]: nginx: [emerg] still could not bind()
Dec  6 12:04:51 kurt-ThinkPad systemd[1]: nginx.service: Control process exited, code=exited status=1
Dec  6 12:04:51 kurt-ThinkPad systemd[1]: Failed to start A high performance web server and a reverse proxy server.
Dec  6 12:04:51 kurt-ThinkPad systemd[1]: nginx.service: Unit entered failed state.
Dec  6 12:04:51 kurt-ThinkPad systemd[1]: nginx.service: Failed with result 'exit-code'.

Alguma idéia de por que a instalação não está funcionando? (A resposta para um problema semelhante, E: O subprocesso / usr / bin / dpkg retornou um código de erro (1) [relacionado ao Google Chrome] , sugere que alguns arquivos estão corrompidos).

Atualizar

Aqui está também a mensagem de erro gerada pelo Ubuntu para ser enviada à sua comunidade de desenvolvimento:

    
por Kurt Peek 06.12.2016 / 12:12

1 resposta

3

Veja a linha

nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

Isso significa que já existe um servidor web em execução (escutando na porta 80, que é necessária para o nginx). Tente este comando para identificar qual processo está usando a porta 80:

netstat -tlnp | fgrep -w :80

Desinstale esse servidor ou reconfigure-o para que ele use outra porta diferente de 80.

    
por xhienne 06.12.2016 / 13:11