Saturday, August 29, 2015

Gitlab No authentication methods configured, psql: could not connect to server: No such file or directory

Before jumping into any details, here are two most import directories you need to know for debugging:
    /var/opt/gitlab  -- important data, configuration and repositories
    /var/log/gitlab -- log files

On my new Gitlab install (Redhat/CentOS 6), while messing around with login, I locked myself (everyone else) out!

On the main page, it merely says: "No authentication methods configured."  It cost me nearly a day to finally re-install and get back to square one. 

At issue is that PostgreSQL remembered some configuration and I just couldn't reset it, even by re-run rpm package. 

I first merely ran "gitlab-ctl uninstall", then run "rpm -Uvh --force xxx.rpm". The install obviously re-uses the old DB. 

When I tried to connect DB from command line, I got this error:

 psql: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

status check "sudo gitlab-rake gitlab:check" didn't reveal any problem either.

I just could figure out how to connect to the DB. After much frustration, here is how i forced the issue:

1. ps auxw |grep post

From here, I found many PostgreSQL processes and much needed information of where the DB data is stored:

root      2508  runsv postgresql
root      2509  svlogd -tt /var/log/gitlab/postgresql
492       2510  /opt/gitlab/embedded/bin/postgres -D /var/opt/gitlab/postgresql/data
492       2517  postgres: checkpointer process                        
492       2518  postgres: writer process                              
492       2519  postgres: wal writer process                          
492       2520  postgres: autovacuum launcher process                
492       2521  postgres: stats collector process                    
492       2613  postgres: gitlab gitlabhq_production [local] idle    

2. I ran "gitlab-ctl uninstall"
3. I ran "kill -9 2508" to stop "runsv" (not sure if this step is necessary)
4. I renamed "/var/opt/gitlab/postgresql" to "postgresql.bak". So old DB is invisible to the installer.
5. I blew away "/opt/gitlab" (i don't think this step is necessary, i just want to do it clean)
6. finally, i run " rpm -Uvh --force gitlab-ce-7.14.1-ce.0.el6.x86_64.rpm".
7. after that, i ran "gitlab-ctl reconfigure".

That brought me back to the fresh starting point.

BTW, the default GitLab login is "root/5iveL!fe".

If you also had previous accounts, you may need to clean up data under "/var/opt/gitlab/git-data/repositories", otherwise, you'll see some strange behavior when you re-create the same user account, and using it to create new project. It may fail and complain gitlab-shell error.

No comments:

Post a Comment