Ugrade from 4.0.11 to 4.1.6 failed with demo data (tested on 2 VM's on 2 different hostsystems) #18030
Unanswered
maxzapp
asked this question in
Help Wanted!
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi to all, i have an upgrade problem
Ugrade from 4.0.11 to 4.1.6 failed with django.db.utils.ProgrammingError: relation "extras_objectchange" does not exist
OS Ubuntu server 24.04.1 LTS
Python3 3.12.3
Netbox 4.0.11
Expected Behavior:
upgrade ends without errors
Observed Behavior:
Upgrade script aborts with permission error during migration section
Change permissions on database according the postgres installation section on netbox docs
and run upgrade.sh again
Upgrade script aborts again with django.db.utils.ProgrammingError:
relation "extras_objectchange" does not exist
Steps to reproduce:
According to the upgrade steps (option A) in netbox documentation
After first sudo ./upgrade.sh
.
Running migrations:
Applying core.0011_move_objectchange... OK
Applying extras.0117_move_objectchange...Traceback (most recent call last):
File "/opt/netbox-4.1.6/venv/lib/python3.12/site-packages/django/db/backends/uti ls.py", line 103, in _execute
return self.cursor.execute(sql)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox-4.1.6/venv/lib/python3.12/site-packages/psycopg/cursor.py", li ne 97, in execute
raise ex.with_traceback(None)
psycopg.errors.InsufficientPrivilege: permission denied for schema public
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/netbox-4.1.6/netbox/manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/opt/netbox-4.1.6/venv/lib/python3.12/site-packages/django/core/management /init.py", line 442, in execute_from_command_line
utility.execute()
File "/opt/netbox-4.1.6/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-4.1.6/venv/lib/python3.12/site-packages/django/core/management /base.py", line 413, in run_from_argv
self.execute(*args, **cmd_options)
File "/opt/netbox-4.1.6/venv/lib/python3.12/site-packages/django/core/management /base.py", line 459, in execute
output = self.handle(*args, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox-4.1.6/venv/lib/python3.12/site-packages/django/core/management /base.py", line 107, in wrapper
res = handle_func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox-4.1.6/venv/lib/python3.12/site-packages/django/core/management /commands/migrate.py", line 356, in handle
post_migrate_state = executor.migrate(
^^^^^^^^^^^^^^^^^
File "/opt/netbox-4.1.6/venv/lib/python3.12/site-packages/django/db/migrations/e xecutor.py", line 135, in migrate
state = self._migrate_all_forwards(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox-4.1.6/venv/lib/python3.12/site-packages/django/db/migrations/e xecutor.py", line 167, in _migrate_all_forwards
state = self.apply_migration(
^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox-4.1.6/venv/lib/python3.12/site-packages/django/db/migrations/e xecutor.py", line 252, in apply_migration
state = migration.apply(state, schema_editor)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox-4.1.6/venv/lib/python3.12/site-packages/django/db/migrations/m igration.py", line 132, in apply
operation.database_forwards(
File "/opt/netbox-4.1.6/venv/lib/python3.12/site-packages/django/db/migrations/o perations/special.py", line 37, in database_forwards
database_operation.database_forwards(
File "/opt/netbox-4.1.6/venv/lib/python3.12/site-packages/django/db/migrations/o perations/models.py", line 559, in database_forwards
schema_editor.alter_db_table(
File "/opt/netbox-4.1.6/venv/lib/python3.12/site-packages/django/db/backends/bas e/schema.py", line 681, in alter_db_table
self.execute(
File "/opt/netbox-4.1.6/venv/lib/python3.12/site-packages/django/db/backends/pos tgresql/schema.py", line 48, in execute
return super().execute(sql, None)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox-4.1.6/venv/lib/python3.12/site-packages/django/db/backends/bas e/schema.py", line 202, in execute
cursor.execute(sql, params)
File "/opt/netbox-4.1.6/venv/lib/python3.12/site-packages/django/db/backends/uti ls.py", line 79, in execute
return self._execute_with_wrappers(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox-4.1.6/venv/lib/python3.12/site-packages/django/db/backends/uti ls.py", line 92, in _execute_with_wrappers
return executor(sql, params, many, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox-4.1.6/venv/lib/python3.12/site-packages/django/db/backends/uti ls.py", line 100, in _execute
with self.db.wrap_database_errors:
File "/opt/netbox-4.1.6/venv/lib/python3.12/site-packages/django/db/utils.py", l ine 91, in exit
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/opt/netbox-4.1.6/venv/lib/python3.12/site-packages/django/db/backends/uti ls.py", line 103, in _execute
return self.cursor.execute(sql)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox-4.1.6/venv/lib/python3.12/site-packages/psycopg/cursor.py", li ne 97, in execute
raise ex.with_traceback(None)
django.db.utils.ProgrammingError: permission denied for schema public
Remembering some tips on the issues pages i went to database installation section
on the doc pages and did this
sudo -u postgres psql
ALTER DATABASE netbox OWNER TO netbox;
\connect netbox;
GRANT CREATE ON SCHEMA public TO netbox;
then run the upgrade again
Applying database migrations (python3 netbox/manage.py migrate)...
Operations to perform:
Apply all migrations: account, auth, circuits, contenttypes, core, dcim, django_rq, extras, ipam, sessions, social_django, taggit, tenancy, users, virtualization, vpn, wireless
Running migrations:
Applying extras.0117_move_objectchange...Traceback (most recent call last):
File "/opt/netbox-4.1.6/venv/lib/python3.12/site-packages/django/db/backends/utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox-4.1.6/venv/lib/python3.12/site-packages/psycopg/cursor.py", line 97, in execute
raise ex.with_traceback(None)
psycopg.errors.UndefinedTable: relation "extras_objectchange" does not exist
LINE 1: ...ct_type_id", "extras_objectchange"."user_id" FROM "extras_ob...
^
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/netbox-4.1.6/netbox/manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/opt/netbox-4.1.6/venv/lib/python3.12/site-packages/django/core/management/init.py", line 442, in execute_from_command_line
utility.execute()
File "/opt/netbox-4.1.6/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-4.1.6/venv/lib/python3.12/site-packages/django/core/management/base.py", line 413, in run_from_argv
self.execute(*args, **cmd_options)
File "/opt/netbox-4.1.6/venv/lib/python3.12/site-packages/django/core/management/base.py", line 459, in execute
output = self.handle(*args, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox-4.1.6/venv/lib/python3.12/site-packages/django/core/management/base.py", line 107, in wrapper
res = handle_func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox-4.1.6/venv/lib/python3.12/site-packages/django/core/management/commands/migrate.py", line 356, in handle
post_migrate_state = executor.migrate(
^^^^^^^^^^^^^^^^^
File "/opt/netbox-4.1.6/venv/lib/python3.12/site-packages/django/db/migrations/executor.py", line 135, in migrate
state = self._migrate_all_forwards(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox-4.1.6/venv/lib/python3.12/site-packages/django/db/migrations/executor.py", line 167, in _migrate_all_forwards
state = self.apply_migration(
^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox-4.1.6/venv/lib/python3.12/site-packages/django/db/migrations/executor.py", line 252, in apply_migration
state = migration.apply(state, schema_editor)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox-4.1.6/venv/lib/python3.12/site-packages/django/db/migrations/migration.py", line 132, in apply
operation.database_forwards(
File "/opt/netbox-4.1.6/venv/lib/python3.12/site-packages/django/db/migrations/operations/special.py", line 193, in database_forwards
self.code(from_state.apps, schema_editor)
File "/opt/netbox-4.1.6/netbox/extras/migrations/0117_move_objectchange.py", line 8, in update_content_types
ContentType.objects.filter(app_label='core', model='objectchange').delete()
File "/opt/netbox-4.1.6/venv/lib/python3.12/site-packages/django/db/models/query.py", line 1187, in delete
collector.collect(del_query)
File "/opt/netbox-4.1.6/venv/lib/python3.12/site-packages/django/db/models/deletion.py", line 348, in collect
if getattr(on_delete, "lazy_sub_objs", False) or sub_objs:
^^^^^^^^
File "/opt/netbox-4.1.6/venv/lib/python3.12/site-packages/django/db/models/query.py", line 414, in bool
self._fetch_all()
File "/opt/netbox-4.1.6/venv/lib/python3.12/site-packages/django/db/models/query.py", line 1928, in _fetch_all
self._result_cache = list(self._iterable_class(self))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox-4.1.6/venv/lib/python3.12/site-packages/django/db/models/query.py", line 91, in iter
results = compiler.execute_sql(
^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox-4.1.6/venv/lib/python3.12/site-packages/django/db/models/sql/compiler.py", line 1562, in execute_sql
cursor.execute(sql, params)
File "/opt/netbox-4.1.6/venv/lib/python3.12/site-packages/django/db/backends/utils.py", line 79, in execute
return self._execute_with_wrappers(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox-4.1.6/venv/lib/python3.12/site-packages/django/db/backends/utils.py", line 92, in _execute_with_wrappers
return executor(sql, params, many, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox-4.1.6/venv/lib/python3.12/site-packages/django/db/backends/utils.py", line 100, in _execute
with self.db.wrap_database_errors:
File "/opt/netbox-4.1.6/venv/lib/python3.12/site-packages/django/db/utils.py", line 91, in exit
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/opt/netbox-4.1.6/venv/lib/python3.12/site-packages/django/db/backends/utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox-4.1.6/venv/lib/python3.12/site-packages/psycopg/cursor.py", line 97, in execute
raise ex.with_traceback(None)
django.db.utils.ProgrammingError: relation "extras_objectchange" does not exist
LINE 1: ...ct_type_id", "extras_objectchange"."user_id" FROM "extras_ob...
so i have no ideas what to do and need some advice.
Manx thanks.
^
Beta Was this translation helpful? Give feedback.
All reactions