Skip to content

Initial Root Password ignored

Summary

Setting gitlab_initial_root_password in gitlab.rb does not actually create a password.

ZD (internal)

Steps to reproduce

The steps were taken from here: https://docs.gitlab.com/omnibus/settings/database.html#seed-the-database-fresh-installs-only

gitlab_rails['initial_root_password'] = 'nonstandardpassword'
sudo gitlab-rake gitlab:setup

What is the current bug behavior?

The output after running sudo gitlab-rake gitlab:setup is:

password: You'll be prompted to create one on your first visit.

What is the expected correct behavior?

It should set a password that the root user can update after the initial login

Relevant logs and/or screenshots

(Paste any relevant logs - please use code blocks (```) to format console output, logs, and code as it's tough to read otherwise.)

Possible fixes

Line 8 checks for a GITLAB_ROOT_PASSWORD ENV variable:

if ENV['GITLAB_ROOT_PASSWORD'].blank?
  user_args[:password_automatically_set] = true
  user_args[:force_random_password] = true
else
  user_args[:password] = ENV['GITLAB_ROOT_PASSWORD']
end

***
 if user_args.key?(:password)
    puts "password: #{user_args[:password]}".color(:green)
  else
    puts "password: You'll be prompted to create one on your first visit.".color(:green)
  end
  puts
else
  puts "Could not create the default administrator account:".color(:red)
  puts
  user.errors.full_messages.map do |message|
    puts "--> #{message}".color(:red)
  end
  puts

  exit 1
end

The current workaround is to run:

sudo -i GITLAB_ROOT_PASSWORD="nonstandardpassword" gitlab-rake gitlab:setup
Edited by Justin Farmiloe