Installation or upgrade fails if accessing Redis over UNIX socket #330

Closed
opened 2026-04-05 16:26:14 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @koratfood on 2/18/2026

NetBox Edition

NetBox Community

NetBox Version

v4.5.3

Python Version

3.12

Steps to Reproduce

  1. Install a new instance of NetBox, following docs/installation as usual, while accessing Redis over a UNIX socket instead of TCP/IP as documented in docs/configuration/required-parameters.md#unix-socket-support:
REDIS = {
    'tasks': {
        'URL': 'unix:///run/redis-netbox/redis.sock?db=0'
    },
    'caching': {
        'URL': 'unix:///run/redis-netbox/redis.sock?db=1'
    },
}
  1. Observe output when running upgrade.sh

Alternatively, with an already-existing and working installation:

  1. Run NetBox Community v4.5.2 and access Redis over its UNIX socket, with the following already present in configuration.py:
REDIS = {
    'tasks': {
        'URL': 'unix:///run/redis-netbox/redis.sock?db=0'
    },
    'caching': {
        'URL': 'unix:///run/redis-netbox/redis.sock?db=1'
    },
}
  1. Attempt upgrade to v4.5.3, following instructions in docs/installation/upgrading.md
  2. Observe output when running upgrade.sh

Expected Behavior

upgrade.sh completes successfully.

Observed Behavior

upgrade.sh exits with error when running database migrations, with the following output:

Applying database migrations (python3 netbox/manage.py migrate)...
Traceback (most recent call last):
  File "/opt/netbox/venv/lib/python3.12/site-packages/redis/client.py", line 748, in _execute_command
    server_port=conn.port,
                ^^^^^^^^^
AttributeError: 'UnixDomainSocketConnection' object has no attribute 'port'

During handling of the above exception, another exception occurred:

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 461, in execute
    self.check(**check_kwargs)
  File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/base.py", line 496, in check
    all_issues = checks.run_checks(
                 ^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/checks/registry.py", line 89, in run_checks
    new_errors = check(app_configs=app_configs, databases=databases)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/checks/urls.py", line 136, in check_custom_error_handlers
    handler = resolver.resolve_error_handler(status_code)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/django/urls/resolvers.py", line 732, in resolve_error_handler
    callback = getattr(self.urlconf_module, "handler%s" % view_type, None)
                       ^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/django/utils/functional.py", line 47, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
                                         ^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/django/urls/resolvers.py", line 711, in urlconf_module
    return import_module(self.urlconf_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/opt/netbox/netbox/netbox/urls.py", line 26, in <module>
    path('circuits/', include('circuits.urls')),
                      ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/django/urls/conf.py", line 39, in include
    urlconf_module = import_module(urlconf_module)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/opt/netbox/netbox/circuits/urls.py", line 4, in <module>
    from . import views
  File "/opt/netbox/netbox/circuits/views.py", line 2, in <module>
    from dcim.views import PathTraceView
  File "/opt/netbox/netbox/dcim/views.py", line 46, in <module>
    from .ui import panels
  File "/opt/netbox/netbox/dcim/ui/panels.py", line 6, in <module>
    class SitePanel(panels.ObjectAttributesPanel):
  File "/opt/netbox/netbox/dcim/ui/panels.py", line 15, in SitePanel
    physical_address = attrs.AddressAttr('physical_address', map_url=True)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/netbox/netbox/ui/attrs.py", line 264, in __init__
    self.map_url = get_config().MAPS_URL
                   ^^^^^^^^^^^^
  File "/opt/netbox/netbox/netbox/config/__init__.py", line 28, in get_config
    _thread_locals.config = Config()
                            ^^^^^^^^
  File "/opt/netbox/netbox/netbox/config/__init__.py", line 48, in __init__
    self._populate_from_cache()
  File "/opt/netbox/netbox/netbox/config/__init__.py", line 71, in _populate_from_cache
    self.config = cache.get('config') or {}
                  ^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/django_redis/cache.py", line 92, in get
    value = self._get(key, default, version, client)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/django_redis/cache.py", line 29, in _decorator
    return method(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/django_redis/cache.py", line 99, in _get
    return self.client.get(key, default=default, version=version, client=client)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/django_redis/client/default.py", line 298, in get
    value = client.get(key)
            ^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/redis/commands/core.py", line 2069, in get
    return self.execute_command("GET", name, keys=[name])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/redis/client.py", line 716, in execute_command
    return self._execute_command(*args, **options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/redis/client.py", line 755, in _execute_command
    server_port=conn.port,
                ^^^^^^^^^
AttributeError: 'UnixDomainSocketConnection' object has no attribute 'port'

One way to work around this is to access Redis over TCP/IP, as primarily suggested in docs/configuration/required-parameters.md#redis. Using our example config block above, we would change it to the following:

REDIS = {
    'tasks': {
        'HOST': 'localhost',
        'PORT': 6379,
        'USERNAME': '',
        'PASSWORD': '',
        'DATABASE': 0,
        'SSL': False,
    },
    'caching': {
        'HOST': 'localhost',
        'PORT': 6379,
        'USERNAME': '',
        'PASSWORD': '',
        'DATABASE': 1,
        'SSL': False,
    }
}
*Originally created by @koratfood on 2/18/2026* ### NetBox Edition NetBox Community ### NetBox Version v4.5.3 ### Python Version 3.12 ### Steps to Reproduce 1. Install a new instance of NetBox, following [docs/installation](https://github.com/netbox-community/netbox/tree/main/docs/installation) as usual, while accessing Redis over a UNIX socket instead of TCP/IP as documented in [docs/configuration/required-parameters.md#unix-socket-support](https://github.com/netbox-community/netbox/blob/main/docs/configuration/required-parameters.md#unix-socket-support): ``` REDIS = { 'tasks': { 'URL': 'unix:///run/redis-netbox/redis.sock?db=0' }, 'caching': { 'URL': 'unix:///run/redis-netbox/redis.sock?db=1' }, } ``` 2. Observe output when running upgrade.sh Alternatively, with an already-existing and working installation: 1. Run NetBox Community v4.5.2 and access Redis over its UNIX socket, with the following already present in configuration.py: ``` REDIS = { 'tasks': { 'URL': 'unix:///run/redis-netbox/redis.sock?db=0' }, 'caching': { 'URL': 'unix:///run/redis-netbox/redis.sock?db=1' }, } ``` 2. Attempt upgrade to v4.5.3, following instructions in [docs/installation/upgrading.md](https://github.com/netbox-community/netbox/blob/main/docs/installation/upgrading.md) 3. Observe output when running upgrade.sh ### Expected Behavior upgrade.sh completes successfully. ### Observed Behavior upgrade.sh exits with error when running database migrations, with the following output: ``` Applying database migrations (python3 netbox/manage.py migrate)... Traceback (most recent call last): File "/opt/netbox/venv/lib/python3.12/site-packages/redis/client.py", line 748, in _execute_command server_port=conn.port, ^^^^^^^^^ AttributeError: 'UnixDomainSocketConnection' object has no attribute 'port' During handling of the above exception, another exception occurred: 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 461, in execute self.check(**check_kwargs) File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/base.py", line 496, in check all_issues = checks.run_checks( ^^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/checks/registry.py", line 89, in run_checks new_errors = check(app_configs=app_configs, databases=databases) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/checks/urls.py", line 136, in check_custom_error_handlers handler = resolver.resolve_error_handler(status_code) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.12/site-packages/django/urls/resolvers.py", line 732, in resolve_error_handler callback = getattr(self.urlconf_module, "handler%s" % view_type, None) ^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.12/site-packages/django/utils/functional.py", line 47, in __get__ res = instance.__dict__[self.name] = self.func(instance) ^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.12/site-packages/django/urls/resolvers.py", line 711, in urlconf_module return import_module(self.urlconf_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/importlib/__init__.py", line 90, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<frozen importlib._bootstrap>", line 1387, in _gcd_import File "<frozen importlib._bootstrap>", line 1360, in _find_and_load File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 935, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 995, in exec_module File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed File "/opt/netbox/netbox/netbox/urls.py", line 26, in <module> path('circuits/', include('circuits.urls')), ^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.12/site-packages/django/urls/conf.py", line 39, in include urlconf_module = import_module(urlconf_module) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/importlib/__init__.py", line 90, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<frozen importlib._bootstrap>", line 1387, in _gcd_import File "<frozen importlib._bootstrap>", line 1360, in _find_and_load File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 935, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 995, in exec_module File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed File "/opt/netbox/netbox/circuits/urls.py", line 4, in <module> from . import views File "/opt/netbox/netbox/circuits/views.py", line 2, in <module> from dcim.views import PathTraceView File "/opt/netbox/netbox/dcim/views.py", line 46, in <module> from .ui import panels File "/opt/netbox/netbox/dcim/ui/panels.py", line 6, in <module> class SitePanel(panels.ObjectAttributesPanel): File "/opt/netbox/netbox/dcim/ui/panels.py", line 15, in SitePanel physical_address = attrs.AddressAttr('physical_address', map_url=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/netbox/netbox/ui/attrs.py", line 264, in __init__ self.map_url = get_config().MAPS_URL ^^^^^^^^^^^^ File "/opt/netbox/netbox/netbox/config/__init__.py", line 28, in get_config _thread_locals.config = Config() ^^^^^^^^ File "/opt/netbox/netbox/netbox/config/__init__.py", line 48, in __init__ self._populate_from_cache() File "/opt/netbox/netbox/netbox/config/__init__.py", line 71, in _populate_from_cache self.config = cache.get('config') or {} ^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.12/site-packages/django_redis/cache.py", line 92, in get value = self._get(key, default, version, client) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.12/site-packages/django_redis/cache.py", line 29, in _decorator return method(self, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.12/site-packages/django_redis/cache.py", line 99, in _get return self.client.get(key, default=default, version=version, client=client) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.12/site-packages/django_redis/client/default.py", line 298, in get value = client.get(key) ^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.12/site-packages/redis/commands/core.py", line 2069, in get return self.execute_command("GET", name, keys=[name]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.12/site-packages/redis/client.py", line 716, in execute_command return self._execute_command(*args, **options) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.12/site-packages/redis/client.py", line 755, in _execute_command server_port=conn.port, ^^^^^^^^^ AttributeError: 'UnixDomainSocketConnection' object has no attribute 'port' ``` One way to work around this is to access Redis over TCP/IP, as primarily suggested in [docs/configuration/required-parameters.md#redis](https://github.com/netbox-community/netbox/blob/main/docs/configuration/required-parameters.md#redis). Using our example config block above, we would change it to the following: ``` REDIS = { 'tasks': { 'HOST': 'localhost', 'PORT': 6379, 'USERNAME': '', 'PASSWORD': '', 'DATABASE': 0, 'SSL': False, }, 'caching': { 'HOST': 'localhost', 'PORT': 6379, 'USERNAME': '', 'PASSWORD': '', 'DATABASE': 1, 'SSL': False, } } ```
MrUnknownDE added the netboxnetboxnetboxnetboxstatus: blockedtype: bugnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxnetboxtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bugtype: bug labels 2026-04-05 16:26:18 +02:00
Sign in to join this conversation.
No Label netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox netbox status: blocked type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug type: bug
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/netbox#330