gunicorn - HTTP: failed to make connection to backend

383 views
Skip to first unread message

Jeronimo

unread,
Mar 6, 2020, 1:06:06 PM3/6/20
to netbox-...@googlegroups.com
Hi all,

Tried to install NetBox on Ubuntu 18.04 and having the following error:

root@netbox-01:~# tail -f /var/log/apache2/error.log -n2
[Fri Mar 06 17:58:15.432412 2020] [proxy:error] [pid 990:tid 140661772769024] (111)Connection refused: AH00957: HTTP: attempt to connect to 127.0.0.1:8001 (127.0.0.1) failed
[Fri Mar 06 17:58:15.432461 2020] [proxy_http:error] [pid 990:tid 140661772769024] [client 192.168.1.131:57208] AH01114: HTTP: failed to make connection to backend: 127.0.0.1

When I try to run gunicorn directly from command line have following error:

# gunicorn3 netbox
[2020-03-06 18:01:34 +0000] [1801] [INFO] Starting gunicorn 19.7.1
[2020-03-06 18:01:34 +0000] [1801] [INFO] Listening at: http://127.0.0.1:8000 (1801)
[2020-03-06 18:01:34 +0000] [1801] [INFO] Using worker: sync
[2020-03-06 18:01:34 +0000] [1820] [INFO] Booting worker with pid: 1820
[2020-03-06 18:01:34 +0000] [1820] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/gunicorn/arbiter.py", line 578, in spawn_worker
    worker.init_process()
  File "/usr/lib/python3/dist-packages/gunicorn/workers/base.py", line 126, in init_process
    self.load_wsgi()
  File "/usr/lib/python3/dist-packages/gunicorn/workers/base.py", line 135, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/usr/lib/python3/dist-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/usr/lib/python3/dist-packages/gunicorn/app/wsgiapp.py", line 65, in load
    return self.load_wsgiapp()
  File "/usr/lib/python3/dist-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/usr/lib/python3/dist-packages/gunicorn/util.py", line 377, in import_app
    __import__(module)
ModuleNotFoundError: No module named 'netbox'
[2020-03-06 18:01:34 +0000] [1820] [INFO] Worker exiting (pid: 1820)
[2020-03-06 18:01:34 +0000] [1801] [INFO] Shutting down: Master
[2020-03-06 18:01:34 +0000] [1801] [INFO] Reason: Worker failed to boot.


The status of Netbox:

root@netbox-01:~# systemctl status netbox
● netbox.service - NetBox WSGI Service
   Loaded: loaded (/etc/systemd/system/netbox.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Fri 2020-03-06 18:02:34 UTC; 24s ago
     Docs: https://netbox.readthedocs.io/en/stable/
  Process: 1887 ExecStart=/usr/bin/gunicorn --pid /var/tmp/netbox.pid --pythonpath /opt/netbox/netbox --config /opt/netbox/gunicorn.py netbox.wsgi (code=exited, status=203/EXEC)
 Main PID: 1887 (code=exited, status=203/EXEC)


Running netbox from test server of django it's all right:

root@netbox-01:/opt/netbox/netbox# python3 manage.py runserver 0.0.0.0:8000 --insecure
Performing system checks...

System check identified no issues (0 silenced).
March 06, 2020 - 18:04:26
Django version 2.2.11, using settings 'netbox.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.
[06/Mar/2020 18:04:30] "GET / HTTP/1.1" 200 56346


Any help?

Thanks,

Jeronimo

Jeremy Stretch

unread,
Mar 6, 2020, 1:15:06 PM3/6/20
to Jeronimo, NetBox
What does "journalctl -xe" show after you attempt to start the gunicorn service?

--
You received this message because you are subscribed to the Google Groups "NetBox" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netbox-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/netbox-discuss/CACf9Un-T0noqQ2c%2Bo054jy%3D9QhRKK1LuhQfBVC2tntOkud794w%40mail.gmail.com.


--
Jeremy Stretch
Sr. Network Automation Engineer
Network to Code, LLC

Jeronimo

unread,
Mar 6, 2020, 2:44:36 PM3/6/20
to Jeremy Stretch, NetBox
Hi Jeremy,

the output of "journalctl -xe" is

root@netbox-01:/opt/netbox# journalctl -xe
Mar 06 19:42:09 netbox-01 kernel: floppy: error 10 while reading block 0
Mar 06 19:42:11 netbox-01 systemd[1]: netbox-rq.service: Service hold-off time over, scheduling restart.
Mar 06 19:42:11 netbox-01 systemd[1]: netbox-rq.service: Scheduled restart job, restart counter is at 188.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Automatic restarting of the unit netbox-rq.service has been scheduled, as the result for
-- the configured Restart= setting for the unit.
Mar 06 19:42:11 netbox-01 systemd[1]: Stopped NetBox Request Queue Worker.
-- Subject: Unit netbox-rq.service has finished shutting down
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit netbox-rq.service has finished shutting down.
Mar 06 19:42:11 netbox-01 systemd[1]: Started NetBox Request Queue Worker.
-- Subject: Unit netbox-rq.service has finished start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit netbox-rq.service has finished starting up.
--
-- The start-up result is RESULT.
Mar 06 19:42:12 netbox-01 systemd[1]: Stopped NetBox WSGI Service.
-- Subject: Unit netbox.service has finished shutting down
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit netbox.service has finished shutting down.
Mar 06 19:42:13 netbox-01 systemd[1]: Started NetBox WSGI Service.
-- Subject: Unit netbox.service has finished start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit netbox.service has finished starting up.
--
-- The start-up result is RESULT.
Mar 06 19:42:13 netbox-01 systemd[11326]: netbox.service: Failed to execute command: Permission denied
Mar 06 19:42:13 netbox-01 systemd[11326]: netbox.service: Failed at step EXEC spawning /usr/lib/python3/dist-packages/gunicorn: Permission denied
-- Subject: Process /usr/lib/python3/dist-packages/gunicorn could not be executed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- The process /usr/lib/python3/dist-packages/gunicorn could not be executed and failed.
--
-- The error number returned by this process is 13.
Mar 06 19:42:13 netbox-01 systemd[1]: netbox.service: Main process exited, code=exited, status=203/EXEC
Mar 06 19:42:13 netbox-01 systemd[1]: netbox.service: Failed with result 'exit-code'.
Mar 06 19:42:13 netbox-01 python3[11303]: Error 111 connecting to 192.168.1.5:1234. Connection refused.
Mar 06 19:42:14 netbox-01 systemd[1]: netbox-rq.service: Main process exited, code=exited, status=1/FAILURE
Mar 06 19:42:14 netbox-01 systemd[1]: netbox-rq.service: Failed with result 'exit-code'.

Any idea?

Jeronimo

Jeronimo

unread,
Mar 6, 2020, 2:56:42 PM3/6/20
to Jeremy Stretch, NetBox
Sorry jeremy,

please desconsider last email.

Follow the asked output:

Mar 06 19:54:32 netbox-01 systemd[1]: Stopped NetBox Request Queue Worker.

-- Subject: Unit netbox-rq.service has finished shutting down
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit netbox-rq.service has finished shutting down.
Mar 06 19:54:32 netbox-01 systemd[1]: Started NetBox Request Queue Worker.

-- Subject: Unit netbox-rq.service has finished start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit netbox-rq.service has finished starting up.
--
-- The start-up result is RESULT.
Mar 06 19:54:34 netbox-01 python3[12675]: Error 111 connecting to 192.168.1.5:1234. Connection refused.
Mar 06 19:54:34 netbox-01 systemd[1]: netbox-rq.service: Main process exited, code=exited, status=1/FAILURE
Mar 06 19:54:34 netbox-01 systemd[1]: netbox-rq.service: Failed with result 'exit-code'.


Jeronimo
Reply all
Reply to author
Forward
0 new messages