Netbox upgrade from v4.2.4 to v4.5.2 fails on database migration #21428
-
NetBox EditionNetBox Community NetBox Versionv4.2.4 / v4.5.2 Python Version3.12 Steps to ReproduceUpgrade Ubuntu 22.04 to 24.04 Other dependencies are met as per documentation Stop netbox netbox-rq services Extra info: Expected BehaviorUpgrade migration works without issue and upgrade is finished to v4.5.2 Observed BehaviorApplying database migrations (python3 netbox/manage.py migrate)...
Traceback (most recent call last):
File "/opt/netbox/netbox/manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
utility.execute()
File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/__init__.py", line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/base.py", line 420, in run_from_argv
self.execute(*args, **cmd_options)
File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/base.py", line 464, in execute
output = self.handle(*args, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/base.py", line 111, in wrapper
res = handle_func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/commands/migrate.py", line 114, in handle
executor = MigrationExecutor(connection, self.migration_progress_callback)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/migrations/executor.py", line 18, in __init__
self.loader = MigrationLoader(self.connection)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/migrations/loader.py", line 58, in __init__
self.build_graph()
File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/migrations/loader.py", line 235, in build_graph
self.applied_migrations = recorder.applied_migrations()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/migrations/recorder.py", line 89, in applied_migrations
if self.has_table():
^^^^^^^^^^^^^^^^
File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/migrations/recorder.py", line 63, in has_table
with self.connection.cursor() as cursor:
^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/venv/lib/python3.12/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/backends/base/base.py", line 320, in cursor
return self._cursor()
^^^^^^^^^^^^^^
File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/backends/dummy/base.py", line 20, in complain
raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details. |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments
-
|
Thanks for the report (and for including the full traceback). Could you help us narrow down whether something external is influencing the settings during the upgrade? A couple quick questions/tests:
If you can share the outcome of those two checks (plus any additional traceback/log output, if it changes), this would be great. Thanks! |
Beta Was this translation helpful? Give feedback.
-
|
Can confirm that disabling plugins (PLUGINS = []) is a workaround ! |
Beta Was this translation helpful? Give feedback.
-
|
@pheus Yes, we do have plugins, but before doing anything I did comment them out and add an empty field: I re-pulled git for v.4.5.1. It seems to fail on the same step, now with a different traceback: Extra info of all installed versions: |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for testing and reporting back! This doesn’t look like a DB migration regression in 4.5.2 after all. Your 4.5.1 run is now surfacing the underlying configuration issue:
So the upgrade is failing because both the legacy Given you’ve already had to adjust
If you rebuild from the example, please make sure you bring over all required settings (e.g. Once |
Beta Was this translation helpful? Give feedback.
-
|
I also ran into this issue, though in my case the |
Beta Was this translation helpful? Give feedback.
-
|
Hello @pheus , Thank you for your reply and pointing me in the right direction. To fix I had to remove STORAGE_BACKEND completely, add STORAGES with only default option and make my AWS the options parameters in the configuration.py. After that I upgraded to v4.5.1 and then 4.5.2. I do have an issue with my uploaded images, but not sure if it's related to my STORAGE configuration.. When I click on an image: Maybe I'm still missing a parameter for this in the configuration. |
Beta Was this translation helpful? Give feedback.
-
|
At the end I was unable to fix the S3 storage configuration parameters. I've chosen to comment out the parameters + storages and re-migrate to have it move the images to the local default folder. Now it works ok. |
Beta Was this translation helpful? Give feedback.
At the end I was unable to fix the S3 storage configuration parameters. I've chosen to comment out the parameters + storages and re-migrate to have it move the images to the local default folder. Now it works ok.