Fix Gitlab won’t start, database system is shut down, failed to load.

GitLabHow toTroubleshooting

When you have issues with GitLab you will want to check the status to see which component of gitlab is not working as expected. Do this using the following command:

sudo gitlab-ctl status

Verify the log files of the component to obtain details about the failure. Log files for Omnibus installation of gitlab are located under.

/var/log/gitlab/

Within this location there are several subfolders that container log files.

You will can to examine the file that is named current for the component.

Example, suppose we are fixing database is shutdown error.

sudo nano /var/log/gitlab/postgresql/current

When we examine this log file we discover there is an issue with reading the cacert.pem file. This is causing the database to be unable to startup.

 FATAL: could not load root certificate file "/opt/gitlab/embedded/ssl/certs/cacert.pem": No such file or directory
 LOG: database system is shut down

If the file is missing then you need to restore it from your backups.

If the file is there the error could be caused by a permission error.

Change the files permission  using the commands below and restart gitlab.

sudo chmod 644 /opt/gitlab/embedded/ssl/certs/cacert.pem
sudo gitlab-ctl restart

Verify that gitlab is started correctly

sudo gitlab-ctl status

 

 

References:

https://forum.gitlab.com/t/postgresql-ssl-certificate-issues/16606

https://about.gitlab.com/2015/04/23/gitlab-7-dot-10-dot-0-omnibus-patch-release/