ValueError: Unable to configure handler 'netbox_auth_log' during upgrade from 2.11.12 to 3.2.1 #6398

Closed
opened 2025-12-29 19:40:14 +01:00 by adam · 1 comment
Owner

Originally created by @Chewie9999 on GitHub (Apr 23, 2022).

NetBox version

v3.2.1

Python version

3.8

Steps to Reproduce

  1. Netbox 2.11.12 running fine before upgrade, even after reboots.
  2. Run update.sh

Expected Behavior

There shouldn't be file system errors as netbox was working before the upgrade.

Observed Behavior

The following error is shown:

Traceback (most recent call last):
  File "/usr/lib/python3.8/logging/config.py", line 563, in configure
    handler = self.configure_handler(handlers[name])
  File "/usr/lib/python3.8/logging/config.py", line 744, in configure_handler
    result = factory(**kwargs)
  File "/usr/lib/python3.8/logging/handlers.py", line 148, in __init__
    BaseRotatingHandler.__init__(self, filename, mode, encoding, delay)
  File "/usr/lib/python3.8/logging/handlers.py", line 55, in __init__
    logging.FileHandler.__init__(self, filename, mode, encoding, delay)
  File "/usr/lib/python3.8/logging/__init__.py", line 1147, in __init__
    StreamHandler.__init__(self, self._open())
  File "/usr/lib/python3.8/logging/__init__.py", line 1176, in _open
    return open(self.baseFilename, self.mode, encoding=self.encoding)
FileNotFoundError: [Errno 2] No such file or directory: '/opt/netbox/logs/django-ldap-debug.log'

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 "/opt/netbox-3.2.1/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
    utility.execute()
  File "/opt/netbox-3.2.1/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 420, in execute
    django.setup()
  File "/opt/netbox-3.2.1/venv/lib/python3.8/site-packages/django/__init__.py", line 19, in setup
    configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
  File "/opt/netbox-3.2.1/venv/lib/python3.8/site-packages/django/utils/log.py", line 76, in configure_logging
    logging_config_func(logging_settings)
  File "/usr/lib/python3.8/logging/config.py", line 808, in dictConfig
    dictConfigClass(config).configure()
  File "/usr/lib/python3.8/logging/config.py", line 570, in configure
    raise ValueError('Unable to configure handler '
ValueError: Unable to configure handler 'netbox_auth_log'

The directory /opt/netbox/logs doesn't even exist.
Creating the directory allows the upgrade.sh script to get further.

Either the log directory should exist in the distribution .tar.gz file, or the upgrade script should check for it's existence.

#6535 mentions this same problem for an earlier version

Originally created by @Chewie9999 on GitHub (Apr 23, 2022). ### NetBox version v3.2.1 ### Python version 3.8 ### Steps to Reproduce 1. Netbox 2.11.12 running fine before upgrade, even after reboots. 2. Run update.sh ### Expected Behavior There shouldn't be file system errors as netbox was working before the upgrade. ### Observed Behavior The following error is shown: ``` Applying database migrations (python3 netbox/manage.py migrate)... Traceback (most recent call last): File "/usr/lib/python3.8/logging/config.py", line 563, in configure handler = self.configure_handler(handlers[name]) File "/usr/lib/python3.8/logging/config.py", line 744, in configure_handler result = factory(**kwargs) File "/usr/lib/python3.8/logging/handlers.py", line 148, in __init__ BaseRotatingHandler.__init__(self, filename, mode, encoding, delay) File "/usr/lib/python3.8/logging/handlers.py", line 55, in __init__ logging.FileHandler.__init__(self, filename, mode, encoding, delay) File "/usr/lib/python3.8/logging/__init__.py", line 1147, in __init__ StreamHandler.__init__(self, self._open()) File "/usr/lib/python3.8/logging/__init__.py", line 1176, in _open return open(self.baseFilename, self.mode, encoding=self.encoding) FileNotFoundError: [Errno 2] No such file or directory: '/opt/netbox/logs/django-ldap-debug.log' 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 "/opt/netbox-3.2.1/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line utility.execute() File "/opt/netbox-3.2.1/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 420, in execute django.setup() File "/opt/netbox-3.2.1/venv/lib/python3.8/site-packages/django/__init__.py", line 19, in setup configure_logging(settings.LOGGING_CONFIG, settings.LOGGING) File "/opt/netbox-3.2.1/venv/lib/python3.8/site-packages/django/utils/log.py", line 76, in configure_logging logging_config_func(logging_settings) File "/usr/lib/python3.8/logging/config.py", line 808, in dictConfig dictConfigClass(config).configure() File "/usr/lib/python3.8/logging/config.py", line 570, in configure raise ValueError('Unable to configure handler ' ValueError: Unable to configure handler 'netbox_auth_log' ``` The directory `/opt/netbox/logs` doesn't even exist. Creating the directory allows the `upgrade.sh` script to get further. Either the `log` directory should exist in the distribution `.tar.gz file`, or the upgrade script should check for it's existence. #6535 mentions this same problem for an earlier version
adam closed this issue 2025-12-29 19:40:14 +01:00
Author
Owner

@kkthxbye-code commented on GitHub (Apr 24, 2022):

Not a bug, you have added the loghandler yourself while debugging LDAP I assume. It is used as an example in the LDAP troubleshooting section. Remove the section from your config if you do not need it anymore.

At most I guess the documentation here:

https://netbox.readthedocs.io/en/stable/installation/6-ldap/

Could be changed to pass the mode "a+" or "w+" to the file handler.

@kkthxbye-code commented on GitHub (Apr 24, 2022): Not a bug, you have added the loghandler yourself while debugging LDAP I assume. It is used as an example in the LDAP troubleshooting section. Remove the section from your config if you do not need it anymore. At most I guess the documentation here: https://netbox.readthedocs.io/en/stable/installation/6-ldap/ Could be changed to pass the mode "a+" or "w+" to the file handler.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#6398