Pages not loading after upgrade. #749

Closed
opened 2025-12-29 16:25:25 +01:00 by adam · 7 comments
Owner

Originally created by @Fyzzle on GitHub (Mar 6, 2017).

Bug Report

I just ran an upgrade following the instructions here: https://netbox.readthedocs.io/en/stable/installation/upgrading/

After running the upgrade I can no longer view a lot of my data, on the main page I see the proper counts but on some pages when I click into the page nothing is displayed. On other I get an error. Including screenshots.

2017-03-06 10_57_09-server error
2017-03-06 10_57_25-netbox - sites
2017-03-06 10_56_46-netbox - home

Python 2.7.12
Netbox v1.9.0-r1

Originally created by @Fyzzle on GitHub (Mar 6, 2017). Bug Report I just ran an upgrade following the instructions here: https://netbox.readthedocs.io/en/stable/installation/upgrading/ After running the upgrade I can no longer view a lot of my data, on the main page I see the proper counts but on some pages when I click into the page nothing is displayed. On other I get an error. Including screenshots. ![2017-03-06 10_57_09-server error](https://cloud.githubusercontent.com/assets/22641145/23624779/cbd7a160-025b-11e7-81fa-65b8e10a409e.png) ![2017-03-06 10_57_25-netbox - sites](https://cloud.githubusercontent.com/assets/22641145/23624778/cbd7602e-025b-11e7-9caf-b50e96eaafbe.png) ![2017-03-06 10_56_46-netbox - home](https://cloud.githubusercontent.com/assets/22641145/23624780/cbd8bd98-025b-11e7-9733-94af6ca66a8d.png) Python 2.7.12 Netbox v1.9.0-r1
adam closed this issue 2025-12-29 16:25:25 +01:00
Author
Owner

@jeremystretch commented on GitHub (Mar 6, 2017):

It looks like you didn't run database migrations. What version are you upgrading from? And can you try running ./manage.py migrate please?

@jeremystretch commented on GitHub (Mar 6, 2017): It looks like you didn't run database migrations. What version are you upgrading from? And can you try running `./manage.py migrate` please?
Author
Owner

@Fyzzle commented on GitHub (Mar 6, 2017):

Hi Jeremy, thanks for the reply.

I'm a horrible admin, I didn't check version before upgrading.

I ran the command restarted netbox and no luck, same behavior. Here was the output:

netbox@PDX-Netbox-1:/opt/netbox/netbox$ sudo ./manage.py migrate
[sudo] password for netbox:
Operations to perform:
Apply all migrations: admin, auth, circuits, contenttypes, dcim, extras, ipam, secrets, sessions, tenancy
Running migrations:
Applying dcim.0022_color_names_to_rgb...Traceback (most recent call last):
File "./manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/init.py", line 367, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/init.py", line 359, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 294, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 345, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/migrate.py", line 204, in handle
fake_initial=fake_initial,
File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/executor.py", line 115, in migrate
state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/executor.py", line 145, in _migrate_all_forwards
state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/executor.py", line 250, in apply_migration
self.recorder.record_applied(migration.app_label, migration.name)
File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/recorder.py", line 73, in record_applied
self.migration_qs.create(app=app, name=name)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 399, in create
obj.save(force_insert=True, using=self.db)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 796, in save
force_update=force_update, update_fields=update_fields)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 824, in save_base
updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 908, in _save_table
result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 947, in _do_insert
using=using, raw=raw)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 1045, in _insert
return query.get_compiler(using=using).execute_sql(return_id)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 1054, in execute_sql
cursor.execute(sql, params)
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 94, in exit
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
django.db.utils.IntegrityError: duplicate key value violates unique constraint "django_migrations_pkey"
DETAIL: Key (id)=(56) already exists.

@Fyzzle commented on GitHub (Mar 6, 2017): Hi Jeremy, thanks for the reply. I'm a horrible admin, I didn't check version before upgrading. I ran the command restarted netbox and no luck, same behavior. Here was the output: >netbox@PDX-Netbox-1:/opt/netbox/netbox$ sudo ./manage.py migrate [sudo] password for netbox: Operations to perform: Apply all migrations: admin, auth, circuits, contenttypes, dcim, extras, ipam, secrets, sessions, tenancy Running migrations: Applying dcim.0022_color_names_to_rgb...Traceback (most recent call last): File "./manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 367, in execute_from_command_line utility.execute() File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 359, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 294, in run_from_argv self.execute(*args, **cmd_options) File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 345, in execute output = self.handle(*args, **options) File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/migrate.py", line 204, in handle fake_initial=fake_initial, File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/executor.py", line 115, in migrate state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial) File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/executor.py", line 145, in _migrate_all_forwards state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial) File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/executor.py", line 250, in apply_migration self.recorder.record_applied(migration.app_label, migration.name) File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/recorder.py", line 73, in record_applied self.migration_qs.create(app=app, name=name) File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 399, in create obj.save(force_insert=True, using=self.db) File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 796, in save force_update=force_update, update_fields=update_fields) File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 824, in save_base updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields) File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 908, in _save_table result = self._do_insert(cls._base_manager, using, fields, update_pk, raw) File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 947, in _do_insert using=using, raw=raw) File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py", line 85, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 1045, in _insert return query.get_compiler(using=using).execute_sql(return_id) File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 1054, in execute_sql cursor.execute(sql, params) File "/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py", line 64, in execute return self.cursor.execute(sql, params) File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 94, in __exit__ six.reraise(dj_exc_type, dj_exc_value, traceback) File "/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py", line 64, in execute return self.cursor.execute(sql, params) django.db.utils.IntegrityError: duplicate key value violates unique constraint "django_migrations_pkey" DETAIL: Key (id)=(56) already exists.
Author
Owner

@jeremystretch commented on GitHub (Mar 6, 2017):

It looks like your database migration failed during the upgrade; maybe it was terminated before finishing? I'm not sure how you could have ended up with a duplicate entry in the migrations table.

Your best is probably to restore from backup and run the upgrade again.

@jeremystretch commented on GitHub (Mar 6, 2017): It looks like your database migration failed during the upgrade; maybe it was terminated before finishing? I'm not sure how you could have ended up with a duplicate entry in the migrations table. Your best is probably to restore from backup and run the upgrade again.
Author
Owner

@Fyzzle commented on GitHub (Mar 6, 2017):

Ok this is interesting. I just ran "./manage.py migrate" instead of "sudo ./manage.py migrate" and it worked.

netbox@PDX-Netbox-1:/opt/netbox/netbox$ ./manage.py migrate
Operations to perform:
Apply all migrations: admin, auth, circuits, contenttypes, dcim, extras, ipam, secrets, sessions, tenancy
Running migrations:
Applying dcim.0022_color_names_to_rgb... OK
Applying circuits.0006_terminations... OK
Applying circuits.0007_circuit_add_description... OK
Applying dcim.0023_devicetype_comments... OK
Applying dcim.0024_site_add_contact_fields... OK
Applying dcim.0025_devicetype_add_interface_ordering... OK
Applying dcim.0026_add_rack_reservations... OK
Applying dcim.0027_device_add_site... OK
Applying dcim.0028_device_copy_rack_to_site... OK
Applying dcim.0029_allow_rackless_devices... OK
Applying dcim.0030_interface_add_lag... OK
Applying dcim.0031_regions... OK
Applying dcim.0032_device_increase_name_length... OK
Applying ipam.0011_rir_add_is_private... OK
Applying ipam.0012_services... OK
Applying ipam.0013_prefix_add_is_pool... OK
Applying ipam.0014_ipaddress_status_add_deprecated... OK
Applying ipam.0015_global_vlans... OK
netbox@PDX-Netbox-1:/opt/netbox/netbox$

It's fixed now! Interesting fix.

@Fyzzle commented on GitHub (Mar 6, 2017): Ok this is interesting. I just ran "./manage.py migrate" instead of "sudo ./manage.py migrate" and it worked. > netbox@PDX-Netbox-1:/opt/netbox/netbox$ ./manage.py migrate Operations to perform: Apply all migrations: admin, auth, circuits, contenttypes, dcim, extras, ipam, secrets, sessions, tenancy Running migrations: Applying dcim.0022_color_names_to_rgb... OK Applying circuits.0006_terminations... OK Applying circuits.0007_circuit_add_description... OK Applying dcim.0023_devicetype_comments... OK Applying dcim.0024_site_add_contact_fields... OK Applying dcim.0025_devicetype_add_interface_ordering... OK Applying dcim.0026_add_rack_reservations... OK Applying dcim.0027_device_add_site... OK Applying dcim.0028_device_copy_rack_to_site... OK Applying dcim.0029_allow_rackless_devices... OK Applying dcim.0030_interface_add_lag... OK Applying dcim.0031_regions... OK Applying dcim.0032_device_increase_name_length... OK Applying ipam.0011_rir_add_is_private... OK Applying ipam.0012_services... OK Applying ipam.0013_prefix_add_is_pool... OK Applying ipam.0014_ipaddress_status_add_deprecated... OK Applying ipam.0015_global_vlans... OK netbox@PDX-Netbox-1:/opt/netbox/netbox$ It's fixed now! Interesting fix.
Author
Owner

@jeremystretch commented on GitHub (Mar 6, 2017):

Hmm, are you running NetBox in a virtualenv? The sudo command exits the virtualenv, so that could make sense. I guess.

Oh well, hooray!

@jeremystretch commented on GitHub (Mar 6, 2017): Hmm, are you running NetBox in a virtualenv? The `sudo` command exits the virtualenv, so that could make sense. I guess. Oh well, hooray!
Author
Owner

@Fyzzle commented on GitHub (Mar 6, 2017):

Oh crud, yeah I am.

@Fyzzle commented on GitHub (Mar 6, 2017): Oh crud, yeah I am.
Author
Owner

@jjavierweb commented on GitHub (Aug 28, 2018):

Im having kinda the same issue here, I have migrated the database and here is the result
python3 ../netbox/netbox/manage.py migrate Operations to perform: Apply all migrations: admin, auth, circuits, contenttypes, dcim, extras, ipam, secrets, sessions, taggit, tenancy, users, virtualization Running migrations: Applying auth.0009_alter_user_last_name_max_length... OK Applying taggit.0001_initial... OK Applying taggit.0002_auto_20150616_2121... OK Applying circuits.0011_tags... OK Applying circuits.0012_change_logging... OK Applying dcim.0056_django2... OK Applying dcim.0057_tags... OK Applying dcim.0058_relax_rack_naming_constraints... OK Applying dcim.0059_site_latitude_longitude... OK Applying dcim.0060_change_logging... OK Applying dcim.0061_platform_napalm_args... OK Applying dcim.0062_interface_mtu... OK Applying tenancy.0004_tags... OK Applying tenancy.0005_change_logging... OK Applying extras.0011_django2... OK Applying extras.0012_webhooks... OK Applying extras.0013_objectchange... OK Applying extras.0014_configcontexts... OK Applying ipam.0022_tags... OK Applying ipam.0023_change_logging... OK Applying secrets.0004_tags... OK Applying secrets.0005_change_logging... OK Applying virtualization.0005_django2... OK Applying virtualization.0006_tags... OK Applying virtualization.0007_change_logging... OK root@netbox-server:/opt/netbox# supervisorctl restart netbox netbox: stopped netbox: started
it all seems fine but when I login the devices wont show at all
image
image

Please help!

@jjavierweb commented on GitHub (Aug 28, 2018): Im having kinda the same issue here, I have migrated the database and here is the result ` python3 ../netbox/netbox/manage.py migrate Operations to perform: Apply all migrations: admin, auth, circuits, contenttypes, dcim, extras, ipam, secrets, sessions, taggit, tenancy, users, virtualization Running migrations: Applying auth.0009_alter_user_last_name_max_length... OK Applying taggit.0001_initial... OK Applying taggit.0002_auto_20150616_2121... OK Applying circuits.0011_tags... OK Applying circuits.0012_change_logging... OK Applying dcim.0056_django2... OK Applying dcim.0057_tags... OK Applying dcim.0058_relax_rack_naming_constraints... OK Applying dcim.0059_site_latitude_longitude... OK Applying dcim.0060_change_logging... OK Applying dcim.0061_platform_napalm_args... OK Applying dcim.0062_interface_mtu... OK Applying tenancy.0004_tags... OK Applying tenancy.0005_change_logging... OK Applying extras.0011_django2... OK Applying extras.0012_webhooks... OK Applying extras.0013_objectchange... OK Applying extras.0014_configcontexts... OK Applying ipam.0022_tags... OK Applying ipam.0023_change_logging... OK Applying secrets.0004_tags... OK Applying secrets.0005_change_logging... OK Applying virtualization.0005_django2... OK Applying virtualization.0006_tags... OK Applying virtualization.0007_change_logging... OK root@netbox-server:/opt/netbox# supervisorctl restart netbox netbox: stopped netbox: started ` it all seems fine but when I login the devices wont show at all ![image](https://user-images.githubusercontent.com/12855611/44744901-dac18a00-aacb-11e8-87e3-d9ec731e4eed.png) ![image](https://user-images.githubusercontent.com/12855611/44744927-e8770f80-aacb-11e8-81a2-5f8162e0e9af.png) Please help!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#749