How to fix Gitlab Redis boot loop: Fatal error loading the DB: Permission denied. Exiting.
Problem
When starting your dockerized Gitlab instance, you see Redis failing to start with the following error message:
==> /var/log/gitlab/redis/current <==
2024-09-18_00:21:51.72811 3025:C 18 Sep 2024 00:21:51.728 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
2024-09-18_00:21:51.72817 3025:C 18 Sep 2024 00:21:51.728 # Redis version=7.0.15, bits=64, commit=f35f36a2, modified=1, pid=3025, just started
2024-09-18_00:21:51.72818 3025:C 18 Sep 2024 00:21:51.728 # Configuration loaded
2024-09-18_00:21:51.72868 3025:M 18 Sep 2024 00:21:51.728 * monotonic clock: POSIX clock_gettime
2024-09-18_00:21:51.72924 _._
2024-09-18_00:21:51.72925 _.-``__ ''-._
2024-09-18_00:21:51.72927 _.-`` `. `_. ''-._ Redis 7.0.15 (f35f36a2/1) 64 bit
2024-09-18_00:21:51.72927 .-`` .-```. ```\/ _.,_ ''-._
2024-09-18_00:21:51.72927 ( ' , .-` | `, ) Running in standalone mode
2024-09-18_00:21:51.72928 |`-._`-...-` __...-.``-._|'` _.-'| Port: 0
2024-09-18_00:21:51.72928 | `-._ `._ / _.-' | PID: 3025
2024-09-18_00:21:51.72928 `-._ `-._ `-./ _.-' _.-'
2024-09-18_00:21:51.72928 |`-._`-._ `-.__.-' _.-'_.-'|
2024-09-18_00:21:51.72929 | `-._`-._ _.-'_.-' | https://redis.io
2024-09-18_00:21:51.72929 `-._ `-._`-.__.-'_.-' _.-'
2024-09-18_00:21:51.72929 |`-._`-._ `-.__.-' _.-'_.-'|
2024-09-18_00:21:51.72929 | `-._`-._ _.-'_.-' |
2024-09-18_00:21:51.72930 `-._ `-._`-.__.-'_.-' _.-'
2024-09-18_00:21:51.72930 `-._ `-.__.-' _.-'
2024-09-18_00:21:51.72930 `-._ _.-'
2024-09-18_00:21:51.72931 `-.__.-'
2024-09-18_00:21:51.72931
2024-09-18_00:21:51.72937 3025:M 18 Sep 2024 00:21:51.729 # Server initialized
2024-09-18_00:21:51.73210 3025:M 18 Sep 2024 00:21:51.731 # Fatal error loading the DB: Permission denied. Exiting.
==> /var/log/gitlab/sidekiq/current <==
{"severity":"INFO","time":"2024-09-18T00:21:51.755Z","message":"A worker terminated, shutting down the cluster"}
Solution
The issue here is that the permissions for the Redis data directory are not correct.
Fix that by executing the built-in fix-permissions
script in the Gitlab container:
docker-compose run gitlab update-permissions