ICU error when running upgrade.sh #11572

Closed
opened 2025-12-29 21:47:01 +01:00 by adam · 2 comments
Owner

Originally created by @egoepfert on GitHub (Sep 5, 2025).

Deployment Type

Self-hosted

NetBox Version

v4.3.6

Python Version

3.12

Steps to Reproduce

PYTHON=/opt/app/python/bin/python ./upgrade.sh

Expected Behavior

Errorless database migration

Observed Behavior

Upgrading to 4.3.6 from 4.0.5.

Ran the upgrade.sh script and get:

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 dcim.0197_natural_sort_collation...Traceback (most recent call last):
  File "/opt/app/netbox-4.3.6/venv/lib/python3.12/site-packages/django/db/backends/utils.py", line 103, in _execute
    return self.cursor.execute(sql)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/app/netbox-4.3.6/venv/lib/python3.12/site-packages/psycopg/cursor.py", line 97, in execute
    raise ex.with_traceback(None)
psycopg.errors.FeatureNotSupported: ICU is not supported in this build

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

Traceback (most recent call last):
  File "/opt/app/netbox-4.3.6/netbox/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/opt/app/netbox-4.3.6/venv/lib/python3.12/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/opt/app/netbox-4.3.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/app/netbox-4.3.6/venv/lib/python3.12/site-packages/django/core/management/base.py", line 416, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/opt/app/netbox-4.3.6/venv/lib/python3.12/site-packages/django/core/management/base.py", line 460, in execute
    output = self.handle(*args, **options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/app/netbox-4.3.6/venv/lib/python3.12/site-packages/django/core/management/base.py", line 107, in wrapper
    res = handle_func(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/app/netbox-4.3.6/venv/lib/python3.12/site-packages/django/core/management/commands/migrate.py", line 353, in handle
    post_migrate_state = executor.migrate(
                         ^^^^^^^^^^^^^^^^^
  File "/opt/app/netbox-4.3.6/venv/lib/python3.12/site-packages/django/db/migrations/executor.py", line 135, in migrate
    state = self._migrate_all_forwards(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/app/netbox-4.3.6/venv/lib/python3.12/site-packages/django/db/migrations/executor.py", line 167, in _migrate_all_forwards
    state = self.apply_migration(
            ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/app/netbox-4.3.6/venv/lib/python3.12/site-packages/django/db/migrations/executor.py", line 255, in apply_migration
    state = migration.apply(state, schema_editor)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/app/netbox-4.3.6/venv/lib/python3.12/site-packages/django/db/migrations/migration.py", line 132, in apply
    operation.database_forwards(
  File "/opt/app/netbox-4.3.6/venv/lib/python3.12/site-packages/django/contrib/postgres/operations.py", line 226, in database_forwards
    self.create_collation(schema_editor)
  File "/opt/app/netbox-4.3.6/venv/lib/python3.12/site-packages/django/contrib/postgres/operations.py", line 200, in create_collation
    schema_editor.execute(
  File "/opt/app/netbox-4.3.6/venv/lib/python3.12/site-packages/django/db/backends/postgresql/schema.py", line 48, in execute
    return super().execute(sql, None)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/app/netbox-4.3.6/venv/lib/python3.12/site-packages/django/db/backends/base/schema.py", line 204, in execute
    cursor.execute(sql, params)
  File "/opt/app/netbox-4.3.6/venv/lib/python3.12/site-packages/django/db/backends/utils.py", line 79, in execute
    return self._execute_with_wrappers(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/app/netbox-4.3.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/app/netbox-4.3.6/venv/lib/python3.12/site-packages/django/db/backends/utils.py", line 100, in _execute
    with self.db.wrap_database_errors:
  File "/opt/app/netbox-4.3.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/app/netbox-4.3.6/venv/lib/python3.12/site-packages/django/db/backends/utils.py", line 103, in _execute
    return self.cursor.execute(sql)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/app/netbox-4.3.6/venv/lib/python3.12/site-packages/psycopg/cursor.py", line 97, in execute
    raise ex.with_traceback(None)
django.db.utils.NotSupportedError: ICU is not supported in this build

Database is all UTF-8 after going through the process I found in: https://github.com/netbox-community/netbox/issues/18416#issuecomment-2601697068

[root@pv2mednetbox1 bin]# sudo -u svcpostgres ./psql --list
                                                      List of databases
   Name    |    Owner    | Encoding |   Collate   |    Ctype    | ICU Locale | Locale Provider |      Access privileges      
-----------+-------------+----------+-------------+-------------+------------+-----------------+-----------------------------
 netbox    | netbox      | UTF8     | en_US.UTF-8 | en_US.UTF-8 |            | libc            | 
 postgres  | svcpostgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |            | libc            | 
 template0 | svcpostgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |            | libc            | =c/svcpostgres             +
           |             |          |             |             |            |                 | svcpostgres=CTc/svcpostgres
 template1 | svcpostgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |            | libc            | 
(4 rows)
Originally created by @egoepfert on GitHub (Sep 5, 2025). ### Deployment Type Self-hosted ### NetBox Version v4.3.6 ### Python Version 3.12 ### Steps to Reproduce PYTHON=/opt/app/python/bin/python ./upgrade.sh ### Expected Behavior Errorless database migration ### Observed Behavior Upgrading to 4.3.6 from 4.0.5. Ran the upgrade.sh script and get: ``` 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 dcim.0197_natural_sort_collation...Traceback (most recent call last): File "/opt/app/netbox-4.3.6/venv/lib/python3.12/site-packages/django/db/backends/utils.py", line 103, in _execute return self.cursor.execute(sql) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/app/netbox-4.3.6/venv/lib/python3.12/site-packages/psycopg/cursor.py", line 97, in execute raise ex.with_traceback(None) psycopg.errors.FeatureNotSupported: ICU is not supported in this build The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/opt/app/netbox-4.3.6/netbox/manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/opt/app/netbox-4.3.6/venv/lib/python3.12/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line utility.execute() File "/opt/app/netbox-4.3.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/app/netbox-4.3.6/venv/lib/python3.12/site-packages/django/core/management/base.py", line 416, in run_from_argv self.execute(*args, **cmd_options) File "/opt/app/netbox-4.3.6/venv/lib/python3.12/site-packages/django/core/management/base.py", line 460, in execute output = self.handle(*args, **options) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/app/netbox-4.3.6/venv/lib/python3.12/site-packages/django/core/management/base.py", line 107, in wrapper res = handle_func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/app/netbox-4.3.6/venv/lib/python3.12/site-packages/django/core/management/commands/migrate.py", line 353, in handle post_migrate_state = executor.migrate( ^^^^^^^^^^^^^^^^^ File "/opt/app/netbox-4.3.6/venv/lib/python3.12/site-packages/django/db/migrations/executor.py", line 135, in migrate state = self._migrate_all_forwards( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/app/netbox-4.3.6/venv/lib/python3.12/site-packages/django/db/migrations/executor.py", line 167, in _migrate_all_forwards state = self.apply_migration( ^^^^^^^^^^^^^^^^^^^^^ File "/opt/app/netbox-4.3.6/venv/lib/python3.12/site-packages/django/db/migrations/executor.py", line 255, in apply_migration state = migration.apply(state, schema_editor) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/app/netbox-4.3.6/venv/lib/python3.12/site-packages/django/db/migrations/migration.py", line 132, in apply operation.database_forwards( File "/opt/app/netbox-4.3.6/venv/lib/python3.12/site-packages/django/contrib/postgres/operations.py", line 226, in database_forwards self.create_collation(schema_editor) File "/opt/app/netbox-4.3.6/venv/lib/python3.12/site-packages/django/contrib/postgres/operations.py", line 200, in create_collation schema_editor.execute( File "/opt/app/netbox-4.3.6/venv/lib/python3.12/site-packages/django/db/backends/postgresql/schema.py", line 48, in execute return super().execute(sql, None) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/app/netbox-4.3.6/venv/lib/python3.12/site-packages/django/db/backends/base/schema.py", line 204, in execute cursor.execute(sql, params) File "/opt/app/netbox-4.3.6/venv/lib/python3.12/site-packages/django/db/backends/utils.py", line 79, in execute return self._execute_with_wrappers( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/app/netbox-4.3.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/app/netbox-4.3.6/venv/lib/python3.12/site-packages/django/db/backends/utils.py", line 100, in _execute with self.db.wrap_database_errors: File "/opt/app/netbox-4.3.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/app/netbox-4.3.6/venv/lib/python3.12/site-packages/django/db/backends/utils.py", line 103, in _execute return self.cursor.execute(sql) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/app/netbox-4.3.6/venv/lib/python3.12/site-packages/psycopg/cursor.py", line 97, in execute raise ex.with_traceback(None) django.db.utils.NotSupportedError: ICU is not supported in this build ``` Database is all UTF-8 after going through the process I found in: https://github.com/netbox-community/netbox/issues/18416#issuecomment-2601697068 ``` [root@pv2mednetbox1 bin]# sudo -u svcpostgres ./psql --list List of databases Name | Owner | Encoding | Collate | Ctype | ICU Locale | Locale Provider | Access privileges -----------+-------------+----------+-------------+-------------+------------+-----------------+----------------------------- netbox | netbox | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | libc | postgres | svcpostgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | libc | template0 | svcpostgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | libc | =c/svcpostgres + | | | | | | | svcpostgres=CTc/svcpostgres template1 | svcpostgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | libc | (4 rows) ```
adam added the type: bug label 2025-12-29 21:47:01 +01:00
adam closed this issue 2025-12-29 21:47:02 +01:00
Author
Owner

@bctiemann commented on GitHub (Sep 5, 2025):

This error indicates that your PostgreSQL instance was compiled without ICU support. The standard distributions of PostgreSQL are built with ICU (I believe); if you are compiling it from source, please be sure to configure it with the --with-icu flag.

@bctiemann commented on GitHub (Sep 5, 2025): This error indicates that your PostgreSQL instance was compiled without ICU support. The standard distributions of PostgreSQL are built with ICU (I believe); if you are compiling it from source, please be sure to configure it with the `--with-icu` flag.
Author
Owner

@egoepfert commented on GitHub (Sep 5, 2025):

This error indicates that your PostgreSQL instance was compiled without ICU support. The standard distributions of PostgreSQL are built with ICU (I believe); if you are compiling it from source, please be sure to configure it with the --with-icu flag.

Ah, that makes perfect sense. Thank you!

@egoepfert commented on GitHub (Sep 5, 2025): > This error indicates that your PostgreSQL instance was compiled without ICU support. The standard distributions of PostgreSQL are built with ICU (I believe); if you are compiling it from source, please be sure to configure it with the `--with-icu` flag. Ah, that makes perfect sense. Thank you!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11572