Update/Migration Failure #9678

Closed
opened 2025-12-29 21:20:45 +01:00 by adam · 1 comment
Owner

Originally created by @schwos on GitHub (May 15, 2024).

Deployment Type

Self-hosted

NetBox Version

v4.0.1

Python Version

3.11

Steps to Reproduce

1.) dump excluding object changes table from old NetBox environment 3.1.8
2.) import sql dump into fresh 4.0.1 environment
3.) Execute the sudo PYTHON=/usr/bin/python3.11 ./upgrade.sh

Expected Behavior

New environment come online.

Observed Behavior

`Applying database migrations (python3 netbox/manage.py migrate)...
Traceback (most recent call last):
File "/opt/netbox-4.0/venv/lib64/python3.11/site-packages/django/db/migrations/loader.py", line 276, in build_graph
self.graph.validate_consistency()
File "/opt/netbox-4.0/venv/lib64/python3.11/site-packages/django/db/migrations/graph.py", line 198, in validate_consistency
[n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
File "/opt/netbox-4.0/venv/lib64/python3.11/site-packages/django/db/migrations/graph.py", line 198, in
[n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
^^^^^^^^^^^^^^^
File "/opt/netbox-4.0/venv/lib64/python3.11/site-packages/django/db/migrations/graph.py", line 60, in raise_error
raise NodeNotFoundError(self.error_message, self.key, origin=self.origin)
django.db.migrations.exceptions.NodeNotFoundError: Migration circuits.0038_squashed_0042 dependencies reference nonexistent parent node ('circuits', '0037_new_cabling_models')

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/opt/netbox-4.0/netbox/manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/opt/netbox-4.0/venv/lib64/python3.11/site-packages/django/core/management/init.py", line 442, in execute_from_command_line
utility.execute()
File "/opt/netbox-4.0/venv/lib64/python3.11/site-packages/django/core/management/init.py", line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/opt/netbox-4.0/venv/lib64/python3.11/site-packages/django/core/management/base.py", line 413, in run_from_argv
self.execute(*args, **cmd_options)
File "/opt/netbox-4.0/venv/lib64/python3.11/site-packages/django/core/management/base.py", line 459, in execute
output = self.handle(*args, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox-4.0/venv/lib64/python3.11/site-packages/django/core/management/base.py", line 107, in wrapper
res = handle_func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox-4.0/venv/lib64/python3.11/site-packages/django/core/management/commands/migrate.py", line 117, in handle
executor = MigrationExecutor(connection, self.migration_progress_callback)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox-4.0/venv/lib64/python3.11/site-packages/django/db/migrations/executor.py", line 18, in init
self.loader = MigrationLoader(self.connection)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox-4.0/venv/lib64/python3.11/site-packages/django/db/migrations/loader.py", line 58, in init
self.build_graph()
File "/opt/netbox-4.0/venv/lib64/python3.11/site-packages/django/db/migrations/loader.py", line 295, in build_graph
raise NodeNotFoundError(
django.db.migrations.exceptions.NodeNotFoundError: Migration circuits.0038_squashed_0042 depends on nonexistent node ('circuits', '0037_new_cabling_models'). Django tried to replace migration circu its.0037_new_cabling_models with any of [circuits.0003_squashed_0037] but wasn't able to because some of the replaced migrations are already applied.
`

Originally created by @schwos on GitHub (May 15, 2024). ### Deployment Type Self-hosted ### NetBox Version v4.0.1 ### Python Version 3.11 ### Steps to Reproduce 1.) dump excluding object changes table from old NetBox environment 3.1.8 2.) import sql dump into fresh 4.0.1 environment 3.) Execute the sudo PYTHON=/usr/bin/python3.11 ./upgrade.sh ### Expected Behavior New environment come online. ### Observed Behavior `Applying database migrations (python3 netbox/manage.py migrate)... Traceback (most recent call last): File "/opt/netbox-4.0/venv/lib64/python3.11/site-packages/django/db/migrations/loader.py", line 276, in build_graph self.graph.validate_consistency() File "/opt/netbox-4.0/venv/lib64/python3.11/site-packages/django/db/migrations/graph.py", line 198, in validate_consistency [n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)] File "/opt/netbox-4.0/venv/lib64/python3.11/site-packages/django/db/migrations/graph.py", line 198, in <listcomp> [n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)] ^^^^^^^^^^^^^^^ File "/opt/netbox-4.0/venv/lib64/python3.11/site-packages/django/db/migrations/graph.py", line 60, in raise_error raise NodeNotFoundError(self.error_message, self.key, origin=self.origin) django.db.migrations.exceptions.NodeNotFoundError: Migration circuits.0038_squashed_0042 dependencies reference nonexistent parent node ('circuits', '0037_new_cabling_models') The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/opt/netbox-4.0/netbox/manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/opt/netbox-4.0/venv/lib64/python3.11/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line utility.execute() File "/opt/netbox-4.0/venv/lib64/python3.11/site-packages/django/core/management/__init__.py", line 436, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/opt/netbox-4.0/venv/lib64/python3.11/site-packages/django/core/management/base.py", line 413, in run_from_argv self.execute(*args, **cmd_options) File "/opt/netbox-4.0/venv/lib64/python3.11/site-packages/django/core/management/base.py", line 459, in execute output = self.handle(*args, **options) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox-4.0/venv/lib64/python3.11/site-packages/django/core/management/base.py", line 107, in wrapper res = handle_func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox-4.0/venv/lib64/python3.11/site-packages/django/core/management/commands/migrate.py", line 117, in handle executor = MigrationExecutor(connection, self.migration_progress_callback) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox-4.0/venv/lib64/python3.11/site-packages/django/db/migrations/executor.py", line 18, in __init__ self.loader = MigrationLoader(self.connection) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox-4.0/venv/lib64/python3.11/site-packages/django/db/migrations/loader.py", line 58, in __init__ self.build_graph() File "/opt/netbox-4.0/venv/lib64/python3.11/site-packages/django/db/migrations/loader.py", line 295, in build_graph raise NodeNotFoundError( django.db.migrations.exceptions.NodeNotFoundError: Migration circuits.0038_squashed_0042 depends on nonexistent node ('circuits', '0037_new_cabling_models'). Django tried to replace migration circu its.0037_new_cabling_models with any of [circuits.0003_squashed_0037] but wasn't able to because some of the replaced migrations are already applied. `
adam closed this issue 2025-12-29 21:20:45 +01:00
Author
Owner

@ziggekatten commented on GitHub (May 15, 2024):

You can't upgrade from 3.1.8 to 4.0

First you need to uppgrade to 3.7, then upgrade to 4.0

@ziggekatten commented on GitHub (May 15, 2024): You can't upgrade from 3.1.8 to 4.0 First you need to uppgrade to 3.7, then upgrade to 4.0
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#9678