authentik
authentik copied to clipboard
Upgrade to 2024 version issue - database error
Describe the bug I can’t update Authentik from 2023.10.7 version to all 2024 versions.
To Reproduce Update image version in a docker-compose.yml file from 2023.10.7 to 2024.2.3.
Both Authentik containers are always restarting.
Expected behavior Authentik installation is updated.
Logs
On the Authentik container:
{"event": "Loaded config", "level": "debug", "logger": "authentik.lib.config", "timestamp": 1713782770.2166803, "file": "/authentik/lib/default.yml"}
{"event": "Loaded environment variables", "level": "debug", "logger": "authentik.lib.config", "timestamp": 1713782770.2171273, "count": 16}
{"event": "Starting authentik bootstrap", "level": "info", "logger": "authentik.lib.config", "timestamp": 1713782770.2172852}
{"event": "PostgreSQL connection successful", "level": "info", "logger": "authentik.lib.config", "timestamp": 1713782770.229641}
{"event": "Redis Connection successful", "level": "info", "logger": "authentik.lib.config", "timestamp": 1713782770.2304037}
{"event": "Finished authentik bootstrap", "level": "info", "logger": "authentik.lib.config", "timestamp": 1713782770.2304265}
{"event": "Loaded config", "level": "debug", "logger": "authentik.lib.config", "timestamp": 1713782771.0442314, "file": "/authentik/lib/default.yml"}
{"event": "Loaded environment variables", "level": "debug", "logger": "authentik.lib.config", "timestamp": 1713782771.0445805, "count": 16}
2024-04-22 10:46:11 [info ] waiting to acquire database lock
2024-04-22 10:46:11 [info ] Migration needs to be applied migration=tenant_to_brand.py
2024-04-22 10:46:11 [info ] releasing database lock
Traceback (most recent call last):
File "/lifecycle/migrate.py", line 99, in
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "
I have the same logs on the worker container
On the pgsql container ostgreSQL Database directory appears to contain a database; Skipping initialization
2024-04-22 10:46:08.869 UTC [1] LOG: starting PostgreSQL 12.17 on x86_64-pc-linux-musl, compiled by gcc (Alpine 12.2.1_git20220924-r10) 12.2.1 20220924, 64-bit
2024-04-22 10:46:08.869 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
2024-04-22 10:46:08.869 UTC [1] LOG: listening on IPv6 address "::", port 5432
2024-04-22 10:46:08.871 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2024-04-22 10:46:08.880 UTC [22] LOG: database system was shut down at 2024-04-22 10:41:57 UTC
2024-04-22 10:46:08.884 UTC [1] LOG: database system is ready to accept connections
2024-04-22 10:46:11.062 UTC [31] WARNING: there is already a transaction in progress
2024-04-22 10:46:11.063 UTC [31] ERROR: could not read block 1 in file "base/16384/16403": read only 0 of 8192 bytes
2024-04-22 10:46:11.063 UTC [31] STATEMENT:
BEGIN TRANSACTION;
ALTER TABLE authentik_tenants_tenant RENAME TO authentik_brands_brand;
UPDATE django_migrations SET app = replace(app, 'authentik_tenants', 'authentik_brands');
UPDATE django_content_type SET app_label = replace(app_label, 'authentik_tenants', 'authentik_brands');
COMMIT;
2024-04-22 10:46:11.064 UTC [31] ERROR: current transaction is aborted, commands ignored until end of transaction block
Version and Deployment (please complete the following information):
- authentik version: 2024.10.2
- Deployment: [e.g. docker-compose, helm]
Additional context I tested with the 2023.10.6 version 2024.2.1 and from 2023.10.7 to 2024.2.2 and 2024.2.3.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I am also having this issue using a k8s cluster on DigitalOcean, and a Postgres 16.1 HA setup.
psycopg.errors.DataCorrupted: could not read block 1 in file "base/16384/16403": read only 0 of 8192 bytes
Looks like your database is corrupted. I'd recommend restoring from a backup.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.