restart the gunicorn and RQ services

1,211 views
Skip to first unread message

joseph de los santos

unread,
Sep 21, 2020, 1:13:34 AM9/21/20
to NetBox
Hi,

I have a Python Virtual Environment but when I try to execute 
image.png

I get 
image.png

Brian Candler

unread,
Sep 21, 2020, 3:23:20 AM9/21/20
to NetBox
That's because you haven't installed the files netbox.service or netbox-rq.service.

Here's the step in the installation instructions that you must have missed:

joseph de los santos

unread,
Sep 21, 2020, 5:36:27 AM9/21/20
to Brian Candler, NetBox
Ok, Do I need to continue all the way to HTTP server setup even though this is an upgrade? (using the upgrade script), Even past LDAP?

Thanks

--
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/ffabb954-024a-4adb-806b-29709fbdf839o%40googlegroups.com.

Brian Candler

unread,
Sep 21, 2020, 5:54:41 AM9/21/20
to NetBox
If this is an upgrade rather than a new install, then I'm guessing you are currently running with supervisord.

This means you have two choices:
1. Continue running with supervisord.  Obviously, instead of "systemctl restart netbox..." you would issue the relevant supervisord command to restart netbox.
2. Migrate your netbox installation from supervisord to systemd.

The second option is what the screenshot you posted before said:

It's possible you are still using supervisord instead of systemd. If so, please see the instructions for migrating to systemd.

joseph de los santos

unread,
Sep 22, 2020, 1:45:59 AM9/22/20
to Brian Candler, NetBox
Hi, I am not able to start netbox service properly

image.png

--
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.

Brian Candler

unread,
Sep 22, 2020, 2:50:51 AM9/22/20
to NetBox
https://stackoverflow.com/questions/48176240/how-to-debug-a-failed-systemctl-service-code-exited-status-217-user

It means you have referenced a nonexistent username in your systemd configuration.  You might, for example, have told it to run netbox as user "netbox" when you haven't created that user.

Please don't paste images if you can avoid it.  Simple copy-paste of text is much easier to read.

joseph de los santos

unread,
Sep 22, 2020, 4:13:34 AM9/22/20
to Brian Candler, NetBox
I can't find the defined user in system.conf or user.conf undre /etc/systemd, where should I go look for this user?



--
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.

joseph de los santos

unread,
Sep 22, 2020, 4:33:42 AM9/22/20
to Brian Candler, NetBox
I created a test user netbox, looks like the error changed

[root@netbox netbox]# systemctl status netbox
● netbox.service - NetBox WSGI Service
   Loaded: loaded (/etc/systemd/system/netbox.service; enabled; vendor preset: disabled)
   Active: activating (auto-restart) (Result: exit-code) since Tue 2020-09-22 18:26:46 AEST; 24s ago
     Docs: https://netbox.readthedocs.io/en/stable/
  Process: 26058 ExecStart=/opt/netbox/venv/bin/gunicorn --pid /var/tmp/netbox.pid --pythonpath /opt/netbox/netbox --config /opt/netbox/gunicorn.py netbox.wsgi (code=exited, status=1/FAILURE)
 Main PID: 26058 (code=exited, status=1/FAILURE)
   CGroup: /system.slice/netbox.service

Sep 22 18:26:46 netbox.belong.local systemd[1]: netbox.service: main process exited, code=exited, status=1/FAILURE
Sep 22 18:26:46 netbox.belong.local systemd[1]: Unit netbox.service entered failed state.
Sep 22 18:26:46 netbox.belong.local systemd[1]: netbox.service failed.
[root@netbox netbox

Brian Candler

unread,
Sep 22, 2020, 4:36:07 AM9/22/20
to NetBox
This isn't really an "introduction to Linux" forum.

If you are not yet comfortable with Linux system administration, then I suggest you make a fresh installation of Netbox from scratch, following the clear step-by-step instructions given here:

You'll note that one of those steps includes creating the system user that Netbox will run as:

Once you've done this, you can either migrate the data from your old installation to the new one:
or you can use your new, working system as a reference to work out what needs applying to the old one to fix it.

joseph de los santos

unread,
Sep 22, 2020, 5:59:09 AM9/22/20
to Brian Candler, NetBox
Thanks, I'll try a fresh install.

--
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.

joseph de los santos

unread,
Sep 23, 2020, 9:01:54 PM9/23/20
to Brian Candler, NetBox
I've installed a fresh one, I'm almost done- I have an issue with gunicorn, I think the path is wrong and I am trying to correct it but my syntax maybe wrong.
netbox.service - NetBox WSGI Service
   Loaded: loaded (/etc/systemd/system/netbox.service; enabled; vendor preset: disabled)
   Active: activating (auto-restart) (Result: exit-code) since Wed 2020-09-23 20:06:17 EDT; 15s ago
     Docs: https://netbox.readthedocs.io/en/stable/
  Process: 16905 ExecStart=/opt/netbox/venv/bin/gunicorn --pid /var/tmp/netbox.pid --pythonpath /opt/netbox/netbox --config />
 Main PID: 16905 (code=exited, status=203/EXEC)
   
Sep 23 20:28:28 netbox-dev systemd[17571]: netbox.service: Failed to execute command: No such file or directory
Sep 23 20:28:28 netbox-dev systemd[17571]: netbox.service: Failed at step EXEC spawning /opt/netbox/venv/bin/gunicorn: No suc>
Sep 23 20:28:28 netbox-dev systemd[1]: netbox.service: Main process exited, code=exited, status=203/EXEC
Sep 23 20:28:28 netbox-dev systemd[1]: netbox.service: Failed with result 'exit-code'.
Sep 23 20:28:28 netbox-dev systemd[17572]: netbox-rq.service: Failed to execute command: No such file or directory
Sep 23 20:28:28 netbox-dev systemd[17572]: netbox-rq.service: Failed at step EXEC spawning /opt/netbox/venv/bin/python3: No s>
Sep 23 20:28:28 netbox-dev systemd[1]: netbox-rq.service: Main process exited, code=exited, status=203/EXEC
Sep 23 20:28:28 netbox-dev systemd[1]: netbox-rq.service: Failed with result 'exit-code'.


ExecStart=/opt/netbox/netbox/venv/bin/gunicorn --pid /var/tmp/netbox.pid --pythonpath /opt/netbox/netbox/venv/bin --config /opt/netbox/netbox/netbox/netbox/gunicorn.py netbox.wsgi


Thanks

joseph de los santos

unread,
Sep 23, 2020, 11:51:42 PM9/23/20
to Brian Candler, NetBox
Ok, I modified /etc/systemd/system/netbox.service to point to the correct directory but now it looks like its trying to use python 3.6 but I have python3 installed

+++SNIPPET++++++
Sep 23 23:46:37 netbox-dev gunicorn[23478]: ModuleNotFoundError: No module named 'netbox.wsgi'
Sep 23 23:46:37 netbox-dev gunicorn[23478]: [2020-09-23 23:46:37 -0400] [23481] [INFO] Worker exiting (pid: 23481)
Sep 23 23:46:37 netbox-dev gunicorn[23478]: [2020-09-23 23:46:37 -0400] [23482] [INFO] Booting worker with pid: 23482
Sep 23 23:46:37 netbox-dev gunicorn[23478]: [2020-09-23 23:46:37 -0400] [23482] [ERROR] Exception in worker process
Sep 23 23:46:37 netbox-dev gunicorn[23478]: Traceback (most recent call last):
Sep 23 23:46:37 netbox-dev gunicorn[23478]:   File "/opt/netbox/netbox/venv/lib64/python3.6/site-packages/gunicorn/arbiter.py>
Sep 23 23:46:37 netbox-dev gunicorn[23478]:     worker.init_process()
Sep 23 23:46:37 netbox-dev gunicorn[23478]:   File "/opt/netbox/netbox/venv/lib64/python3.6/site-packages/gunicorn/workers/gt>
Sep 23 23:46:37 netbox-dev gunicorn[23478]:     super().init_process()
Sep 23 23:46:37 netbox-dev gunicorn[23478]:   File "/opt/netbox/netbox/venv/lib64/python3.6/site-packages/gunicorn/workers/ba>
Sep 23 23:46:37 netbox-dev gunicorn[23478]:     self.load_wsgi()
Sep 23 23:46:37 netbox-dev gunicorn[23478]:   File "/opt/netbox/netbox/venv/lib64/python3.6/site-packages/gunicorn/workers/ba>
Sep 23 23:46:37 netbox-dev gunicorn[23478]:     self.wsgi = self.app.wsgi()
Sep 23 23:46:37 netbox-dev gunicorn[23478]:   File "/opt/netbox/netbox/venv/lib64/python3.6/site-packages/gunicorn/app/base.p>
Sep 23 23:46:37 netbox-dev gunicorn[23478]:     self.callable = self.load()
Sep 23 23:46:37 netbox-dev gunicorn[23478]:   File "/opt/netbox/netbox/venv/lib64/python3.6/site-packages/gunicorn/app/wsgiap>
Sep 23 23:46:37 netbox-dev gunicorn[23478]:     return self.load_wsgiapp()
Sep 23 23:46:37 netbox-dev gunicorn[23478]:   File "/opt/netbox/netbox/venv/lib64/python3.6/site-packages/gunicorn/app/wsgiap>
Sep 23 23:46:37 netbox-dev gunicorn[23478]:     return util.import_app(self.app_uri)
Sep 23 23:46:37 netbox-dev gunicorn[23478]:   File "/opt/netbox/netbox/venv/lib64/python3.6/site-packages/gunicorn/util.py", >
Sep 23 23:46:37 netbox-dev gunicorn[23478]:     mod = importlib.import_module(module)
Sep 23 23:46:37 netbox-dev gunicorn[23478]:   File "/usr/lib64/python3.6/importlib/__init__.py", line 126, in import_module
Sep 23 23:46:37 netbox-dev gunicorn[23478]:     return _bootstrap._gcd_import(name[level:], package, level)
Sep 23 23:46:37 netbox-dev gunicorn[23478]:   File "<frozen importlib._bootstrap>", line 994, in _gcd_import
Sep 23 23:46:37 netbox-dev gunicorn[23478]:   File "<frozen importlib._bootstrap>", line 971, in _find_and_load
Sep 23 23:46:37 netbox-dev gunicorn[23478]:   File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
Sep 23 23:46:37 netbox-dev gunicorn[23478]: ModuleNotFoundError: No module named 'netbox.wsgi'
Sep 23 23:46:37 netbox-dev gunicorn[23478]: [2020-09-23 23:46:37 -0400] [23482] [INFO] Worker exiting (pid: 23482)
Sep 23 23:46:37 netbox-dev gunicorn[23478]: [2020-09-23 23:46:37 -0400] [23478] [INFO] Shutting down: Master
Sep 23 23:46:37 netbox-dev gunicorn[23478]: [2020-09-23 23:46:37 -0400] [23478] [INFO] Reason: Worker failed to boot.
Sep 23 23:46:37 netbox-dev systemd[1]: netbox.service: Main process exited, code=exited, status=3/NOTIMPLEMENTED
Sep 23 23:46:37 netbox-dev systemd[1]: netbox.service: Failed with result 'exit-code'.
Sep 23 23:46:37 netbox-dev dnf[23454]: PostgreSQL 9.6 for RHEL/CentOS 8 - x86_64       1.5 kB/s | 3.8 kB     00:02
Sep 23 23:46:38 netbox-dev dnf[23454]: Metadata cache created.
Sep 23 23:46:38 netbox-dev systemd[1]: Started dnf makecache.
lines 10171-10202/10202 (END)

joseph de los santos

unread,
Sep 24, 2020, 12:06:35 AM9/24/20
to Brian Candler, NetBox
Sorry, I think its because netbox module netbox.wsgi is missing.. how do I find it?
Reply all
Reply to author
Forward
0 new messages