homeassistant-addons icon indicating copy to clipboard operation
homeassistant-addons copied to clipboard

Netbox: Not stable, at all

Open theloquitur opened this issue 9 months ago • 1 comments

Hi,

I installed the previous version of Netbox and it just lost the entries that I made into it. The only change that I made to the config was to enter my login credentials. I uninstalled / rebooted/ reinstalled and then I was fine. Netbox was running. I had 90% of my network built out when there was a notification of a Netbox update. I installed it and then I could no longer access my entries. So, I uninstalled / rebooted / reinstalled and it’s unusable now. Once started, it stops within just a few minutes. I can’t even login now. Below are my log entries.

Tx, Ed

2024-05-04 11:59:56,181 WARN exited: netbox (exit status 1; not expected) 2024-05-04 11:59:56,181 WARN received SIGTERM indicating exit request 2024-05-04 11:59:56,181 INFO waiting for postgresql, redis to die 2024-05-04 11:59:57,290 INFO stopped: redis (exit status 0) 2024-05-04 11:59:57,359 INFO stopped: postgresql (exit status 0) 2024-05-04 12:05:45,072 INFO Included extra file "/etc/supervisor/conf.d/netbox.conf" during parsing 2024-05-04 12:05:45,072 INFO Set uid to user 0 succeeded 2024-05-04 12:05:45,074 INFO RPC interface 'supervisor' initialized 2024-05-04 12:05:45,074 INFO supervisord started with pid 7 2024-05-04 12:05:46,078 INFO spawned: 'netbox' with pid 8 Info: Configuring PostgreSQL.. 2024-05-04 12:05:46,085 INFO success: netbox entered RUNNING state, process has stayed up for > than 0 seconds (startsecs) Info: Setting up media usage.. Info: Fixing PostgreSQL permissions.. Info: Restoring secret key.. Info: Starting redis.. 2024-05-04 12:05:46,447 INFO spawned: 'redis' with pid 26 2024-05-04 12:05:46,448 INFO success: redis entered RUNNING state, process has stayed up for > than 0 seconds (startsecs) Info: Redis is ready.. Info: Starting PostgreSQL.. 2024-05-04 12:05:46,587 INFO spawned: 'postgresql' with pid 33 2024-05-04 12:05:47,690 INFO success: postgresql entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) Info: PostgreSQL is ready.. Info: Check if migration is needed.. Netbox: Creating new superuser: admin Traceback (most recent call last): File "/opt/netbox/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 89, in _execute return self.cursor.execute(sql, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.11/site-packages/psycopg/cursor.py", line 732, in execute raise ex.with_traceback(None) psycopg.errors.UniqueViolation: duplicate key value violates unique constraint "auth_user_username_key" DETAIL: Key (username)=(admin) already exists.

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

Traceback (most recent call last): File "/opt/netbox/netbox/manage.py", line 10, in execute_from_command_line(sys.argv) File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/management/init.py", line 442, in execute_from_command_line utility.execute() File "/opt/netbox/venv/lib/python3.11/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.11/site-packages/django/core/management/base.py", line 412, in run_from_argv self.execute(*args, **cmd_options) File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/management/base.py", line 458, in execute output = self.handle(*args, **options) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/management/commands/shell.py", line 117, in handle exec(options["command"], globals()) File "", line 1, in File "/opt/netbox/venv/lib/python3.11/site-packages/django/contrib/auth/models.py", line 172, in create_superuser return self._create_user(username, email, password, **extra_fields) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.11/site-packages/django/contrib/auth/models.py", line 155, in _create_user user.save(using=self._db) File "/opt/netbox/venv/lib/python3.11/site-packages/django/contrib/auth/base_user.py", line 76, in save super().save(*args, **kwargs) File "/opt/netbox/venv/lib/python3.11/site-packages/django/db/models/base.py", line 814, in save self.save_base( File "/opt/netbox/venv/lib/python3.11/site-packages/django/db/models/base.py", line 877, in save_base updated = self._save_table( ^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.11/site-packages/django/db/models/base.py", line 1020, in _save_table results = self._do_insert( ^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.11/site-packages/django/db/models/base.py", line 1061, in _do_insert return manager._insert( ^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.11/site-packages/django/db/models/manager.py", line 87, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.11/site-packages/django/db/models/query.py", line 1805, in _insert return query.get_compiler(using=using).execute_sql(returning_fields) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 1822, in execute_sql cursor.execute(sql, params) File "/opt/netbox/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 67, in execute return self._execute_with_wrappers( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers return executor(sql, params, many, context) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 84, in _execute with self.db.wrap_database_errors: File "/opt/netbox/venv/lib/python3.11/site-packages/django/db/utils.py", line 91, in exit raise dj_exc_value.with_traceback(traceback) from exc_value File "/opt/netbox/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 89, in _execute return self.cursor.execute(sql, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.11/site-packages/psycopg/cursor.py", line 732, in execute raise ex.with_traceback(None) django.db.utils.IntegrityError: duplicate key value violates unique constraint "auth_user_username_key" DETAIL: Key (username)=(admin) already exists. Error: Failed to create superuser 'admin'. Info: Container shutdown in progress.. 2024-05-04 12:05:52,987 WARN received SIGTERM indicating exit request 2024-05-04 12:05:52,987 INFO waiting for netbox, postgresql, redis to die 2024-05-04 12:05:52,987 WARN exited: netbox (exit status 1; not expected) 2024-05-04 12:05:53,108 INFO stopped: redis (exit status 0) 2024-05-04 12:05:53,181 INFO stopped: postgresql (exit status 0)

theloquitur avatar May 04 '24 19:05 theloquitur

The only change that I made to the config was to enter my login credentials.

Error: Failed to create superuser 'admin'.

The user already exists. Remove the credentials and it should work:

https://github.com/casperklein/homeassistant-addons/blob/3704358ab78e7bb3f6a6f519614746fe6c920e11/netbox/README.md?plain=1#L36-L40

PS: Always do a backup before updating. If something doesn't work as expected, you can restore the previous version.

casperklein avatar May 04 '24 22:05 casperklein