I have a Gitlab EE version 16.0.1.ee running on production. but i planned to migrate the whole instance from one server to another server. While trying to logged in as root user on new server got the error 500 message “/profile/two_factor_auth,” for GitLab through web browser. It means that two-factor authentication (2FA) is enabled for the root user account.
On existing server i configured two factor authentication for some user and root user as well. I took a complete backup of the old system without receiving any error message. Then i moved it to the new system for backup restoration, however when restored into a fresh Gitlab server. The users with 2FA fail to login and the system throws a 500 error.
From system log file /var/log/gitlab/gitlab-rails/production.log found some valid error message for two factor Authentication.
Troubleshoot:
Here are some steps you can take to troubleshoot and resolve the problem:
- Clear your browser cache and cookies:
- Check GitLab service status:
- Check the GitLab logs:
- Disable two way factor:
How to disable global 2FA policy with CLI?
I found the following command but it only disable all users’s 2FA to resolve error 500 in GitLab.
gitlab-rake gitlab:two_factor:disable_for_all_users
Solution:
Here i will explain step by step how i resolved the issue Gitlab Error-500 Login for 2FA users in my case.
I forgot to copy file “/etc/gitlab/gitlab-secrets.json” from existing server to new server. I’m using gitlab-omnibus on both machines, and it seems the backup is not copying these two files (everything else seems good though).
To fix the issue, you need to copy the file /etc/gitlab/gitlab-secrets.json from the existing server to the new server where the backup was restored.
when i copy the file from old Gitlab server to new server then able to login successfully. so we resolved Gitlab Error-500 Login for 2FA users.
Read Related Topics:
Reset GitLab EE root Password in Linux
Step-by-Step Guide: Migrating Your GitLab Server Backup to a New Server