Waiting on DB after upgrade to 3.5.0 due SECRET_KEY length #7987

Closed
opened 2025-12-29 20:30:53 +01:00 by adam · 3 comments
Owner

Originally created by @mburgholte on GitHub (May 3, 2023).

NetBox version

v3.5.0

Python version

3.10

Steps to Reproduce

Hi there!
After the upgrade to 3.5.0, my Netbox unfortunately no longer starts. The start-up is stuck at "Waiting on DB". The SECRET_KEY stored in the netbox.env has a length of 51 characters.

cat env/netbox.env | grep SECRET_KEY | sed -e 's/SECRET_KEY=//g' | wc -c
51

The script "generate_secret_key.py" also only delivers a key of 51 characters.
docker compose exec netbox /opt/netbox/netbox/generate_secret_key.py | wc -c
51

Expected Behavior

The tool "generate_secret_key.py" should provide the correct count. Potentially, in my case, the documentation does not fit. It is written that "A minimum length of 50 characters is now enforced for the SECRET_KEY configuration parameter."

Observed Behavior

The original SECRET_KEY from the git repo includes the following count.

cat env/netbox.env | grep SECRET_KEY | sed -e 's/SECRET_KEY=//g' | wc -c
61

With the longer key, the Netbox instance starts.

Originally created by @mburgholte on GitHub (May 3, 2023). ### NetBox version v3.5.0 ### Python version 3.10 ### Steps to Reproduce Hi there! After the upgrade to 3.5.0, my Netbox unfortunately no longer starts. The start-up is stuck at "Waiting on DB". The SECRET_KEY stored in the netbox.env has a length of 51 characters. cat env/netbox.env | grep SECRET_KEY | sed -e 's/SECRET_KEY=//g' | wc -c 51 The script "generate_secret_key.py" also only delivers a key of 51 characters. docker compose exec netbox /opt/netbox/netbox/generate_secret_key.py | wc -c 51 ### Expected Behavior The tool "generate_secret_key.py" should provide the correct count. Potentially, in my case, the documentation does not fit. It is written that "A minimum length of 50 characters is now enforced for the SECRET_KEY configuration parameter." ### Observed Behavior The original SECRET_KEY from the git repo includes the following count. cat env/netbox.env | grep SECRET_KEY | sed -e 's/SECRET_KEY=//g' | wc -c 61 With the longer key, the Netbox instance starts.
adam closed this issue 2025-12-29 20:30:54 +01:00
Author
Owner

@jeremystretch commented on GitHub (May 3, 2023):

This repo is for issues pertaining to the core NetBox application. As your problem relates specifically to the Docker container, please raise an issue against the netbox-docker repository. Thanks!

@jeremystretch commented on GitHub (May 3, 2023): This repo is for issues pertaining to the core NetBox application. As your problem relates specifically to the Docker container, please raise an issue against the [netbox-docker](https://github.com/netbox-community/netbox-docker) repository. Thanks!
Author
Owner

@mburgholte commented on GitHub (May 3, 2023):

Hi Jeremy,
I did it. Tobias told me to open an issue here...
https://github.com/netbox-community/netbox-docker/issues/1003
Btw. thanks for your work! ;)

@mburgholte commented on GitHub (May 3, 2023): Hi Jeremy, I did it. Tobias told me to open an issue here... https://github.com/netbox-community/netbox-docker/issues/1003 Btw. thanks for your work! ;)
Author
Owner

@jeremystretch commented on GitHub (May 3, 2023):

I'm afraid it must be something related to the Docker environment. I can confirm that the generate_secret_key.py script produces a 50-character key as intended. (Piping the key to wc -c is counting the newline character to get 51.)

$ ./generate_secret_key.py 
rXr015B6c%vEBcoN_XS%2zxX1e6f+OVu++NrbekUY&PyajBiOk
$ python3
Python 3.8.14 (default, Sep  8 2022, 00:02:10) 
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> len('rXr015B6c%vEBcoN_XS%2zxX1e6f+OVu++NrbekUY&PyajBiOk')
50

And that NetBox starts successfully after setting this value for SECRET_KEY in configuration.py.

@jeremystretch commented on GitHub (May 3, 2023): I'm afraid it must be something related to the Docker environment. I can confirm that the `generate_secret_key.py` script produces a 50-character key as intended. (Piping the key to `wc -c` is counting the newline character to get 51.) ``` $ ./generate_secret_key.py rXr015B6c%vEBcoN_XS%2zxX1e6f+OVu++NrbekUY&PyajBiOk $ python3 Python 3.8.14 (default, Sep 8 2022, 00:02:10) [GCC 7.5.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> len('rXr015B6c%vEBcoN_XS%2zxX1e6f+OVu++NrbekUY&PyajBiOk') 50 ``` And that NetBox starts successfully after setting this value for `SECRET_KEY` in `configuration.py`.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#7987