Upgrade failed from 2.5.12 to the latest #3310

Closed
opened 2025-12-29 18:27:36 +01:00 by adam · 3 comments
Owner

Originally created by @hrv231 on GitHub (Feb 11, 2020).

Environment

  • Python version: 3.6.8
  • NetBox version: 2.5.12
  • OS: CentOS 7 Core

Steps to Reproduce

  1. I followed the same steps as readthedocs
  2. I tried several times, and

Expected Behavior

Upgrade successfully

Observed Behavior

Applying database migrations (python3 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 extras.0019_tag_taggeditem... OK
  Applying circuits.0015_custom_tag_models... OK
  Applying circuits.0016_3569_circuit_fields... OK
  Applying circuits.0017_circuittype_description... OK
  Applying tenancy.0006_custom_tag_models... OK
  Applying virtualization.0009_custom_tag_models... OK
  Applying secrets.0006_custom_tag_models... OK
  Applying ipam.0025_custom_tag_models... OK
  Applying dcim.0070_custom_tag_models... OK
  Applying extras.0020_tag_data_squashed_0021_add_color_comments_changelog_to_tag... OK
  Applying dcim.0071_device_components_add_description_squashed_0088_powerfeed_available_power...
Updating cable device terminations...
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
psycopg2.errors.ObjectInUse: cannot ALTER TABLE "dcim_devicetype" because it has pending trigger events


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

Traceback (most recent call last):
  File "netbox/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 323, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 364, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 83, in wrapped
    res = handle_func(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 234, in handle
    fake_initial=fake_initial,
  File "/usr/local/lib/python3.6/site-packages/django/db/migrations/executor.py", line 117, in migrate
    state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
  File "/usr/local/lib/python3.6/site-packages/django/db/migrations/executor.py", line 147, in _migrate_all_forwards
    state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
  File "/usr/local/lib/python3.6/site-packages/django/db/migrations/executor.py", line 245, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/usr/local/lib/python3.6/site-packages/django/db/migrations/migration.py", line 124, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "/usr/local/lib/python3.6/site-packages/django/db/migrations/operations/fields.py", line 249, in database_forwards
    schema_editor.alter_field(from_model, from_field, to_field)
  File "/usr/local/lib/python3.6/site-packages/django/db/backends/base/schema.py", line 535, in alter_field
    old_db_params, new_db_params, strict)
  File "/usr/local/lib/python3.6/site-packages/django/db/backends/postgresql/schema.py", line 124, in _alter_field
    new_db_params, strict,
  File "/usr/local/lib/python3.6/site-packages/django/db/backends/base/schema.py", line 705, in _alter_field
    params,
  File "/usr/local/lib/python3.6/site-packages/django/db/backends/base/schema.py", line 137, in execute
    cursor.execute(sql, params)
  File "/usr/local/lib/python3.6/site-packages/cacheops/transaction.py", line 99, in execute
    result = self._no_monkey.execute(self, sql, params)
  File "/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py", line 67, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python3.6/site-packages/django/db/utils.py", line 89, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
django.db.utils.OperationalError: cannot ALTER TABLE "dcim_devicetype" because it has pending trigger events

Removing stale content types (python3 netbox/manage.py remove_stale_contenttypes --no-input)...
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
psycopg2.errors.UndefinedColumn: column dcim_cable._termination_a_device_id does not exist
LINE 1: ...cable"."length_unit", "dcim_cable"."_abs_length", "dcim_cabl...
                                                             ^


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

Traceback (most recent call last):
  File "netbox/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 323, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 364, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python3.6/site-packages/django/contrib/contenttypes/management/commands/remove_stale_contenttypes.py", line 69, in handle
    ct.delete()
  File "/usr/local/lib/python3.6/site-packages/django/db/models/base.py", line 918, in delete
    collector.collect([self], keep_parents=keep_parents)
  File "/usr/local/lib/python3.6/site-packages/django/db/models/deletion.py", line 223, in collect
    elif sub_objs:
  File "/usr/local/lib/python3.6/site-packages/django/db/models/query.py", line 278, in __bool__
    self._fetch_all()
  File "/usr/local/lib/python3.6/site-packages/cacheops/query.py", line 318, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "/usr/local/lib/python3.6/site-packages/django/db/models/query.py", line 55, in __iter__
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
  File "/usr/local/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1133, in execute_sql
    cursor.execute(sql, params)
  File "/usr/local/lib/python3.6/site-packages/cacheops/transaction.py", line 99, in execute
    result = self._no_monkey.execute(self, sql, params)
  File "/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py", line 67, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python3.6/site-packages/django/db/utils.py", line 89, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: column dcim_cable._termination_a_device_id does not exist
LINE 1: ...cable"."length_unit", "dcim_cable"."_abs_length", "dcim_cabl...
                                                             ^

Collecting static files (python3 netbox/manage.py collectstatic --no-input)...
```
Originally created by @hrv231 on GitHub (Feb 11, 2020). <!-- NOTE: IF YOUR ISSUE DOES NOT FOLLOW THIS TEMPLATE, IT WILL BE CLOSED. This form is only for reproducible bugs. If you need assistance with NetBox installation, or if you have a general question, DO NOT open an issue. Instead, post to our mailing list: https://groups.google.com/forum/#!forum/netbox-discuss Please describe the environment in which you are running NetBox. Be sure that you are running an unmodified instance of the latest stable release before submitting a bug report. --> ### Environment * Python version: 3.6.8 * NetBox version: 2.5.12 * OS: CentOS 7 Core <!-- Describe in detail the exact steps that someone else can take to reproduce this bug using the current stable release of NetBox (or the current beta release where applicable). Begin with the creation of any necessary database objects and call out every operation being performed explicitly. If reporting a bug in the REST API, be sure to reconstruct the raw HTTP request(s) being made: Don't rely on a wrapper like pynetbox. --> ### Steps to Reproduce 1. I followed the same steps as readthedocs 2. I tried several times, and 3. <!-- What did you expect to happen? --> ### Expected Behavior Upgrade successfully <!-- What happened instead? --> ### Observed Behavior ```` Applying database migrations (python3 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 extras.0019_tag_taggeditem... OK Applying circuits.0015_custom_tag_models... OK Applying circuits.0016_3569_circuit_fields... OK Applying circuits.0017_circuittype_description... OK Applying tenancy.0006_custom_tag_models... OK Applying virtualization.0009_custom_tag_models... OK Applying secrets.0006_custom_tag_models... OK Applying ipam.0025_custom_tag_models... OK Applying dcim.0070_custom_tag_models... OK Applying extras.0020_tag_data_squashed_0021_add_color_comments_changelog_to_tag... OK Applying dcim.0071_device_components_add_description_squashed_0088_powerfeed_available_power... Updating cable device terminations... Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) psycopg2.errors.ObjectInUse: cannot ALTER TABLE "dcim_devicetype" because it has pending trigger events The above exception was the direct cause of the following exception: Traceback (most recent call last): File "netbox/manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line utility.execute() File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 323, in run_from_argv self.execute(*args, **cmd_options) File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 364, in execute output = self.handle(*args, **options) File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 83, in wrapped res = handle_func(*args, **kwargs) File "/usr/local/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 234, in handle fake_initial=fake_initial, File "/usr/local/lib/python3.6/site-packages/django/db/migrations/executor.py", line 117, in migrate state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial) File "/usr/local/lib/python3.6/site-packages/django/db/migrations/executor.py", line 147, in _migrate_all_forwards state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial) File "/usr/local/lib/python3.6/site-packages/django/db/migrations/executor.py", line 245, in apply_migration state = migration.apply(state, schema_editor) File "/usr/local/lib/python3.6/site-packages/django/db/migrations/migration.py", line 124, in apply operation.database_forwards(self.app_label, schema_editor, old_state, project_state) File "/usr/local/lib/python3.6/site-packages/django/db/migrations/operations/fields.py", line 249, in database_forwards schema_editor.alter_field(from_model, from_field, to_field) File "/usr/local/lib/python3.6/site-packages/django/db/backends/base/schema.py", line 535, in alter_field old_db_params, new_db_params, strict) File "/usr/local/lib/python3.6/site-packages/django/db/backends/postgresql/schema.py", line 124, in _alter_field new_db_params, strict, File "/usr/local/lib/python3.6/site-packages/django/db/backends/base/schema.py", line 705, in _alter_field params, File "/usr/local/lib/python3.6/site-packages/django/db/backends/base/schema.py", line 137, in execute cursor.execute(sql, params) File "/usr/local/lib/python3.6/site-packages/cacheops/transaction.py", line 99, in execute result = self._no_monkey.execute(self, sql, params) File "/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py", line 67, in execute return self._execute_with_wrappers(sql, params, many=False, executor=self._execute) File "/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers return executor(sql, params, many, context) File "/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) File "/usr/local/lib/python3.6/site-packages/django/db/utils.py", line 89, in __exit__ raise dj_exc_value.with_traceback(traceback) from exc_value File "/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) django.db.utils.OperationalError: cannot ALTER TABLE "dcim_devicetype" because it has pending trigger events Removing stale content types (python3 netbox/manage.py remove_stale_contenttypes --no-input)... Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) psycopg2.errors.UndefinedColumn: column dcim_cable._termination_a_device_id does not exist LINE 1: ...cable"."length_unit", "dcim_cable"."_abs_length", "dcim_cabl... ^ The above exception was the direct cause of the following exception: Traceback (most recent call last): File "netbox/manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line utility.execute() File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 323, in run_from_argv self.execute(*args, **cmd_options) File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 364, in execute output = self.handle(*args, **options) File "/usr/local/lib/python3.6/site-packages/django/contrib/contenttypes/management/commands/remove_stale_contenttypes.py", line 69, in handle ct.delete() File "/usr/local/lib/python3.6/site-packages/django/db/models/base.py", line 918, in delete collector.collect([self], keep_parents=keep_parents) File "/usr/local/lib/python3.6/site-packages/django/db/models/deletion.py", line 223, in collect elif sub_objs: File "/usr/local/lib/python3.6/site-packages/django/db/models/query.py", line 278, in __bool__ self._fetch_all() File "/usr/local/lib/python3.6/site-packages/cacheops/query.py", line 318, in _fetch_all self._result_cache = list(self._iterable_class(self)) File "/usr/local/lib/python3.6/site-packages/django/db/models/query.py", line 55, in __iter__ results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size) File "/usr/local/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1133, in execute_sql cursor.execute(sql, params) File "/usr/local/lib/python3.6/site-packages/cacheops/transaction.py", line 99, in execute result = self._no_monkey.execute(self, sql, params) File "/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py", line 67, in execute return self._execute_with_wrappers(sql, params, many=False, executor=self._execute) File "/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers return executor(sql, params, many, context) File "/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) File "/usr/local/lib/python3.6/site-packages/django/db/utils.py", line 89, in __exit__ raise dj_exc_value.with_traceback(traceback) from exc_value File "/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) django.db.utils.ProgrammingError: column dcim_cable._termination_a_device_id does not exist LINE 1: ...cable"."length_unit", "dcim_cable"."_abs_length", "dcim_cabl... ^ Collecting static files (python3 netbox/manage.py collectstatic --no-input)... ```
adam closed this issue 2025-12-29 18:27:36 +01:00
Author
Owner

@DanSheps commented on GitHub (Feb 11, 2020):

Thank you for your interest in NetBox. GitHub issues are intended for reporting reproducible bugs and requesting features, and must be submitted using one of the templates provided here. For general discussion, questions, or assistance with installation issues, please post to our mailing list instead.

@DanSheps commented on GitHub (Feb 11, 2020): Thank you for your interest in NetBox. GitHub issues are intended for reporting reproducible bugs and requesting features, and must be submitted using one of the templates provided [here](https://github.com/digitalocean/netbox/issues/new/choose). For general discussion, questions, or assistance with installation issues, please post to our [mailing list](https://groups.google.com/forum/#!forum/netbox-discuss) instead.
Author
Owner

@hrv231 commented on GitHub (Feb 12, 2020):

Hello,

I followed the template as you said, can you please look into this, I believe this is a bug.

I haven't manipulated at all my database and I'm seeing the same error, no matter how many times I try.

@hrv231 commented on GitHub (Feb 12, 2020): Hello, I followed the template as you said, can you please look into this, I believe this is a bug. I haven't manipulated at all my database and I'm seeing the same error, no matter how many times I try.
Author
Owner

@ghost commented on GitHub (Apr 26, 2020):

Since this issue got closed but people might get here with the same problem (like hrv231):

  • Dont do a major skip version like 2.5 to 2.8; get all the versions in-between and upgrade to 2.6 and 2.7 before going the 2.8 way.
@ghost commented on GitHub (Apr 26, 2020): Since this issue got closed but people might get here with the same problem (like hrv231): * Dont do a major skip version like 2.5 to 2.8; get all the versions in-between and upgrade to 2.6 and 2.7 before going the 2.8 way.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#3310