Linux – gitlab-ctl reconfigure error when creating user/group on initial install

gitgitlablinuxredhatrhel7

I'm trying to run Gitlab CE on RHEL 7.2 (Maipo). I've completed the Gitlab install. However I'm unable to run sudo gitlab-ctl reconfigure. The error, environment details and what I've tried is outlined below. Does anyone know what I'm missing or doing wrong?

Error

================================================================================
Error executing action `create` on resource 'user[Webserver user and group]'
================================================================================

Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '6'
---- Begin output of ["usermod", "-s", "/bin/false", "-d", "/var/opt/gitlab/nginx", "gitlab-www"] ----
STDOUT:
STDERR: usermod: user 'gitlab-www' does not exist in /etc/passwd
---- End output of ["usermod", "-s", "/bin/false", "-d", "/var/opt/gitlab/nginx", "gitlab-www"] ----
Ran ["usermod", "-s", "/bin/false", "-d", "/var/opt/gitlab/nginx", "gitlab-www"] returned 6

Environment

RHEL 7.2 (Maipo), Chef Client, version 12.12.15 (taken for the gitlab-ctl reconfigure output)

What I've tried

  • Followed install steps here for RHEL 7.
  • Manually add the gitlab-www user: When executing this sudo useradd -s /bin/false -d /var/opt/gitlab/nginx gitlab-www I get the error useradd: user 'gitlab-www' already exists. However I verified a record for gitlab-www doesn't exist in /etc/passwd.
  • Renamed users in gitlab.rb: I renamed the following users in /etc/gitlab/gitlab.rb [git, gitlab-www, git-redis, and gitlab-psql]. That does allow me to run gitlab-ctl reconfigure successfully but this seems like a super hack and I don't know what the impact is to the Gitlab installation. I had to rename all those users because after renaming gitlab-www I would get the same error with the user git, then git-redis and so on.

Best Answer

When a user is created properly, it gets added to two files - /etc/passwd and /etc/shadow. The former contains info about the home directory, login shell etc; the latter contains the encrypted password for the user.

From your description, I should guess that the user exists in /etc/shadow but not in /etc/passwd.

The simplest solution is to either edit /etc/shadow (using sudo) and remove the line that looks something like

gitlab-www:!!:12345::::::

Another possibility is to manually add the user to /etc/passwd. First, find the UID in the shadow file:

[jenny@finch ~]$ sudo grep gitlab-www /etc/shadow | cut -d: -f3
12345
[jenny@finch ~]$ sudo vi + /etc/passwd

Then add the following line:

 gitlab-www:x:12345:12345:Gitlab WWW user:/var/opt/gitlab/nginx:/bin/false