Gunicorn - unhandled exception

684 views
Skip to first unread message

Rob Coote

unread,
Aug 21, 2017, 5:31:43 PM8/21/17
to NetBox
Hi,

First time installing NetBox, and running into a Bad Gateway error after following the instructions.  Trying to run the gunicorn path manually returns the following:

netbox@oeg-srv20:~$ gunicorn -c /opt/netbox/gunicorn_config.py netbox.wsgi
[2017-08-21 15:27:28 -0600] [18205] [INFO] Starting gunicorn 19.7.1
[2017-08-21 15:27:28 -0600] [18205] [INFO] Listening at: http://127.0.0.1:8001 (18205)
[2017-08-21 15:27:28 -0600] [18205] [INFO] Using worker: sync
[2017-08-21 15:27:28 -0600] [18205] [INFO] Unhandled exception in main loop
Traceback (most recent call last):
  File "/home/netbox/.local/lib/python3.5/site-packages/gunicorn/arbiter.py", line 202, in run
    self.manage_workers()
  File "/home/netbox/.local/lib/python3.5/site-packages/gunicorn/arbiter.py", line 544, in manage_workers
    self.spawn_workers()
  File "/home/netbox/.local/lib/python3.5/site-packages/gunicorn/arbiter.py", line 611, in spawn_workers
    self.spawn_worker()
  File "/home/netbox/.local/lib/python3.5/site-packages/gunicorn/arbiter.py", line 564, in spawn_worker
    self.cfg, self.log)
  File "/home/netbox/.local/lib/python3.5/site-packages/gunicorn/workers/base.py", line 57, in __init__
    self.tmp = WorkerTmp(cfg)
  File "/home/netbox/.local/lib/python3.5/site-packages/gunicorn/workers/workertmp.py", line 26, in __init__
    util.chown(name, cfg.uid, cfg.gid)
  File "/home/netbox/.local/lib/python3.5/site-packages/gunicorn/util.py", line172, in chown
    os.chown(path, uid, gid)
PermissionError: [Errno 1] Operation not permitted: '/tmp/wgunicorn-u_z68whl'

Any suggestions would be welcome.

Thanks!
Rob

Jeremy Stretch

unread,
Aug 21, 2017, 5:43:02 PM8/21/17
to Rob Coote, NetBox
I think this is happening because gunicorn wants to start processes as the www-data user (or whichever user you specified in the config), which requires root. Try running the command with sudo.

Jeremy

--
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-discuss+unsubscribe@googlegroups.com.
To post to this group, send email to netbox-discuss@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/netbox-discuss/6821108c-f893-47ee-a568-1f14bfc88f92%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Rob Coote

unread,
Aug 21, 2017, 5:57:36 PM8/21/17
to NetBox
netbox@oeg-srv20:~$ sudo gunicorn -c /opt/netbox/gunicorn_config.py netbox.wsgi
[sudo] password for netbox:
sudo: gunicorn: command not found

Rob Coote

unread,
Aug 22, 2017, 10:27:18 AM8/22/17
to NetBox
So I went back and re-installed everything as root, and it's now working. Apparently under Ubuntu Server 16.04, using sudo for the installation doesn't work.


On Monday, August 21, 2017 at 3:31:43 PM UTC-6, Rob Coote wrote:
Reply all
Reply to author
Forward
0 new messages