Internal Server Error, Upgrading from 2.1.2 to Master Branch 2.2.4

523 views
Skip to first unread message

ckuper...@gmail.com

unread,
Nov 1, 2017, 4:04:23 PM11/1/17
to NetBox

Issue type

[ ] Feature request
[ X ] Bug report
[ ] Documentation


Environment

  • Python version: 2.7.13
  • NetBox version: 2.1.2 Upgrading to v2.2.4 main branch via GIT
    Ubuntu LTS 16.04

We had a couple custom fields added via Django administration, running everything as root and configured as per the documentation via GIT. Using NGINX for reverse proxying the HTTPS requests.
We also had a couple public keys for the "secrets" section, but didn't really use it.


Description

While upgrading from 2.1.2 to latest master branch via GIT as per this documentation:
http://netbox.readthedocs.io/en/stable/installation/upgrading/
Starting from "Option B"

After finishing the last step of "supervisorctl restart netbox",
going to the site gives a straight "Internal Server Error"


Logs from /var/log/supervisor/netbox-stderr.....log:
https://pastebin.com/EMBkdeVc

netbox-stderr---supervisor-K3pyDn.log

Jeremy Stretch

unread,
Nov 1, 2017, 4:40:05 PM11/1/17
to ckuper...@gmail.com, NetBox
This error:

> ImportError: Could not import 'utilities.api.TokenAuthentication' for API setting 'DEFAULT_AUTHENTICATION_CLASSES'

suggests that you are still running old code. (TokenAuthentication was recently moved to netbox/api.py.)

What does "grep -e ^VERSION netbox/netbox/settings.py" give you?

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/d1623b18-319c-49ff-a919-4bb2c06bd8ea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Message has been deleted

ckuper...@gmail.com

unread,
Nov 1, 2017, 5:14:09 PM11/1/17
to NetBox
VERSION = '2.1.2'

My settings.py is at /opt/netbox/netbox/netbox/settings.py

root@hostname:/opt/netbox# ls
CONTRIBUTING.md  docs  gunicorn_config.py  LICENSE.txt  mkdocs.yml  netbox  README.md  requirements.txt  scripts  ssl  upgrade.sh
root@hostname:/opt/netbox# ls netbox/
circuits  dcim  extras  generate_secret_key.py  ipam  manage.py  media  netbox  project-static  secrets  static  templates  tenancy  users  utilities
root@hostname:/opt/netbox# ls netbox/netbox/
configuration.docker.py  configuration.example.py  configuration.py  configuration.pyc  forms.py  __init__.py  __init__.pyc  settings.py  settings.pyc  urls.py  urls.pyc  views.py  wsgi.py  wsgi.pyc
root@hostname:/opt/netbox#
To unsubscribe from this group and stop receiving emails from it, send an email to netbox-discus...@googlegroups.com.
To post to this group, send email to netbox-...@googlegroups.com.

Jeremy Stretch

unread,
Nov 1, 2017, 5:24:26 PM11/1/17
to ckuper...@gmail.com, NetBox
> VERSION = '2.1.2'

Ok, so you're still running the old code base. You'll need to pull down the new code ("git pull origin master"), run upgrade.sh, and then restart the WSGI service.

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/98aafa34-c470-4a60-bb0c-f8e8d6e79079%40googlegroups.com.

ckuper...@gmail.com

unread,
Nov 1, 2017, 5:40:34 PM11/1/17
to NetBox
I don't use git all that often, and it asks me to commit my changes/stash before merging and aborts.

ckuper...@gmail.com

unread,
Nov 1, 2017, 5:44:13 PM11/1/17
to NetBox
root@hostname:/opt/netbox# git pull origin master
 * branch            master     -> FETCH_HEAD
Updating fa7b728..f945216
error: Your local changes to the following files would be overwritten by merge:
        .github/ISSUE_TEMPLATE.md
        .gitignore
        .travis.yml
        README.md
        docs/api/examples.md
        docs/api/overview.md
        docs/configuration/optional-settings.md
        docs/data-model/ipam.md
        docs/index.md
        docs/installation/ldap.md
        docs/installation/netbox.md
        docs/installation/postgresql.md
        docs/installation/web-server.md
        docs/shell/intro.md
        mkdocs.yml
        netbox/circuits/api/serializers.py
        netbox/circuits/api/urls.py
        netbox/circuits/api/views.py
        netbox/circuits/filters.py
        netbox/circuits/forms.py
        netbox/circuits/models.py
        netbox/circuits/tables.py
        netbox/circuits/urls.py
        netbox/circuits/views.py
        netbox/dcim/api/serializers.py
        netbox/dcim/api/urls.py
        netbox/dcim/api/views.py
        netbox/dcim/constants.py
        netbox/dcim/filters.py
        netbox/dcim/forms.py
        netbox/dcim/models.py
        netbox/dcim/tables.py
        netbox/dcim/tests/test_models.py
        netbox/dcim/urls.py
        netbox/dcim/views.py
        netbox/extras/admin.py
        netbox/extras/api/customfields.py
        netbox/extras/api/serializers.py
        netbox/extras/api/urls.py
        netbox/extras/api/views.py
        netbox/extras/constants.py
        netbox/extras/filters.py
        netbox/extras/management/commands/nbshell.py
        netbox/extras/models.py
        netbox/extras/rpc.py
        netbox/extras/urls.py
        netbox/extras/views.py
        netbox/ipam/api/serializers.py
        netbox/ipam/api/urls.py
        netbox/ipam/api/views.py
        netbox/ipam/constants.py
        netbox/ipam/filters.py
        netbox/ipam/fixtures/ipam.json
        netbox/ipam/forms.py
        netbox/ipam/lookups.py
        netbox/ipam/models.py
        netbox/ipam/tables.py
        netbox/ipam/urls.py
        netbox/ipam/views.py
        netbox/netbox/configuration.docker.py
        netbox/netbox/configuration.example.py
        netbox/netbox/forms.py
        netbox/netbox/settings.py
        netbox/netbox/urls.py
        netbox/netbox/views.py
        netbox/project-static/css/base.css
        netbox/project-static/js/forms.js
        netbox/project-static/js/secrets.js
        netbox/secrets/api/serializers.py
        netbox/secrets/api/urls.py
        netbox/secrets/api/views.py
        netbox/secrets/forms.py
        netbox/secrets/models.py
        netbox/secrets/urls.py
        netbox/secrets/views.py
        netbox/templates/500.html
        netbox/templates/_base.html
        netbox/templates/circuits/circuit.html
        netbox/templates/circuits/circuit_edit.html
        netbox/templates/circuits/circuittermination_edit.html
        netbox/templates/circuits/inc/circuit_termination.html
        netbox/templates/dcim/device.html
        netbox/templates/dcim/device_bulk_add_component.html
        netbox/templates/dcim/device_lldp_neighbors.html
        netbox/templates/dcim/device_status.html
        netbox/templates/dcim/devicetype.html
        netbox/templates/dcim/devicetype_list.html
        netbox/templates/dcim/inc/consoleserverport.html
        netbox/templates/dcim/inc/interface.html
        netbox/templates/dcim/inc/rack_elevation.html
        netbox/templates/dcim/inc/service.html
        netbox/templates/dcim/manufacturer_list.html
        netbox/templates/dcim/rack.html
        netbox/templates/dcim/rack_edit.html
        netbox/templates/dcim/rack_list.html
        netbox/templates/dcim/rackgroup_list.html
        netbox/templates/dcim/rackreservation_list.html
        netbox/templates/dcim/region_list.html
        netbox/templates/home.html
        netbox/templates/inc/table.html
        netbox/templates/ipam/aggregate_list.html
        netbox/templates/ipam/inc/prefix_header.html
        netbox/templates/ipam/ipaddress.html
        netbox/templates/ipam/ipaddress_assign.html
        netbox/templates/ipam/ipaddress_bulk_add.html
        netbox/templates/ipam/ipaddress_edit.html
        netbox/templates/ipam/ipaddress_unassign.html
        netbox/templates/ipam/role_list.html
        netbox/templates/ipam/service_edit.html
        netbox/templates/login.html
        netbox/templates/secrets/secret_import.html
        netbox/templates/tenancy/tenant.html
        netbox/templates/utilities/confirmation_form.html
        netbox/templates/utilities/obj_bulk_delete.html
        netbox/templates/utilities/obj_bulk_edit.html
        netbox/templates/utilities/obj_edit.html
        netbox/templates/utilities/obj_import.html
        netbox/tenancy/api/serializers.py
        netbox/tenancy/api/urls.py
        netbox/tenancy/api/views.py
        netbox/tenancy/filters.py
        netbox/tenancy/forms.py
        netbox/tenancy/urls.py
        netbox/tenancy/views.py
        netbox/utilities/api.py
        netbox/utilities/filters.py
        netbox/utilities/forms.py
        netbox/utilities/tables.py
        netbox/utilities/templatetags/helpers.py
        netbox/utilities/views.py
        requirements.txt
Please commit your changes or stash them before you merge.
Aborting

ckuper...@gmail.com

unread,
Nov 1, 2017, 6:01:18 PM11/1/17
to NetBox
Solution:

/opt/netbox# git stash
/opt/netbox# ./upgrade.sh -2
/opt/netbox# supervisorctl restart netbox

Not sure why, but I just stashed any changes and was able to pull down the main branch. Upgrading went smoothly and was just fine.

Attached is the log from upgrade.sh
upgrade.sh log

Brian Candler

unread,
Nov 3, 2017, 4:03:29 AM11/3/17
to NetBox
I don't know why git thought you had made local changes to such a large number of files - I presume you hadn't.  "git stash" has saved those changes in a temporary location (the stash) and reverted to the code as it was before the changes.  "git stash show" will show you what the differences were, which might help you understand how it got into this state.

The purpose of the stash is to preserve your local changes.  If you've changed a few Netbox source files, you can preserve them across updates:

/opt/netbox# git stash
/opt/netbox# ./upgrade.sh -2
/opt/netbox# git stash apply
/opt/netbox# supervisorctl restart netbox

This will work as long as they don't conflict with any of the changes upstream.  If they do, "git stash apply" will complain, and you'll have to merge your changes by hand.
Reply all
Reply to author
Forward
0 new messages