Today I was trying to install netbox on a Linux server. I have done it before but just for testing and never connected it to apache or nginx for a production enviorment. I used the guide supplied in the official manual but I managed for some reason to fail completely. Not sure where the error was if I just did something completely stupid orthe manual was just incomplete. You can check the manual here if you need.
My issue was that when all the commands I had to run for the HTTPS server according to the manual I still got an error. The lovely 503 Service unavailable.
Service Unavailable The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later. Apache/2.4.41 (Ubuntu) Server at netbox.example.com Port 443
When I checked the service I got the following response:
manager@ubuntults:~$ systemctl status netbox ● netbox.service - NetBox WSGI Service Loaded: loaded (/etc/systemd/system/netbox.service; enabled; vendor preset> Active: activating (auto-restart) (Result: exit-code) since Tue 2020-05-26> Docs: https://netbox.readthedocs.io/en/stable/ Process: 1217 ExecStart=/usr/local/bin/gunico --pid /var/tmp/netbox.pid --p> Main PID: 1217 (code=exited, status=203/EXEC) lines 1-6/6 (END)
In the active section you can see that it says activating and not activated and Main PID: gives me: (code=exited, status=203/EXEC)
This tells me that the system has issues executing the files for starting the service. I followed this up by going to the service file where all the settings are made for the service.
sudo nano /etc/systemd/system/netbox.service
I then continued to look at the execution parameters for the service.
ExecStart=/opt/netbox/venv/bin/gunicorn --pid /var/tmp/netbox.pid --pythonpath /opt/netbox/netbox --config /opt/netbox/gunicorn.py netbox.wsgi
When I checked for the gunicorn file in the filesystem I couldn’t find the file gunicorn in /opt/netbox/venv/bin/. Therefor I entered the command “which gunicorn” that returns the correct path for gunicorn to me.
manager@ubuntults:~$ which gunicorn /usr/local/bin/gunicorn
The correct syntax would then be:
ExecStart=/usr/local/bin/gunicorn --pid /var/tmp/netbox.pid --pythonpath /opt/netbox/netbox --config /opt/netbox/gunicorn.py netbox.wsgi
When you have done the change you need to update the service like I have done below:
manager@ubuntults:~$ sudo nano /etc/systemd/system/netbox.service [sudo] password for manager: manager@ubuntults:~$ sudo nano /etc/systemd/system/netbox.service manager@ubuntults:~$ systemctl daemon-reload ==== AUTHENTICATING FOR org.freedesktop.systemd1.reload-daemon === Authentication is required to reload the systemd state. Authenticating as: manager Password: ==== AUTHENTICATION COMPLETE === manager@ubuntults:~$ systemctl restart netbox ==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units === Authentication is required to restart 'netbox.service'. Authenticating as: manager Password: ==== AUTHENTICATION COMPLETE === manager@ubuntults:~$
Now the server should work perfectly 🙂
I couldn’t have solved it hadn’t it been for this post and the answer from Russell Molimock. That put me on the correct track for finding the issue 🙂
3 thoughts on “Issues installing Netbox web service”
I must thank you for this! I was having issues and didn’t notice the gunicorn path.