gitlab-ctl reconfigure failed with permission denied at /opt/gitlab/embedded/service/gitlab-rails/config/database.yml
I recently updated the gitlab community edition to 11.1.2-ce.0 running into an error when calling: gitlab-ctl reconfigure
AS a consequence, I also can not upgrade gitlab to the latest version.
It seems to be some permission error, which I can not resolve. See the log below.
I tried to change the acces to the file /opt/gitlab/embedded/service/gitlab-rails/config/database.yml
manually to readable and executable to the gitlab (I've changed default gitlab user from git
to gitlab
) user, which is changed back by the reconfiguration step.
The problem is, that the reconfiguration step of gitlab-ctl automatically changes the user to root and permission back to 640.
Relevant Log
gitlab-ctl reconfigure
output
> Recipe: gitlab::database_migrations > * bash[migrate gitlab-rails database] action run > [execute] rake aborted! > Errno::EACCES: Cannot load `Rails.application.database_configuration`: > Permission denied @ rb_sysopen - /opt/gitlab/embedded/service/gitlab-rails/config/database.yml > /opt/gitlab/embedded/service/gitlab-rails/config/environment.rb:11:in `' > /opt/gitlab/embedded/bin/bundle:23:in `load' > /opt/gitlab/embedded/bin/bundle:23:in `' > > Caused by: > Errno::EACCES: Permission denied @ rb_sysopen - /opt/gitlab/embedded/service/gitlab-rails/config/database.yml > /opt/gitlab/embedded/service/gitlab-rails/config/environment.rb:11:in `' > /opt/gitlab/embedded/bin/bundle:23:in `load' > /opt/gitlab/embedded/bin/bundle:23:in `' > Tasks: TOP => gitlab:db:configure => environment > (See full trace by running task with --trace) > > ================================================================================ > Error executing action `run` on resource 'bash[migrate gitlab-rails database]' > ================================================================================ > > Mixlib::ShellOut::ShellCommandFailed > ------------------------------------ > Expected process to exit with [0], but received '1' > ---- Begin output of "bash" "/tmp/chef-script20180802-19164-462i34" ---- > STDOUT: rake aborted! > Errno::EACCES: Cannot load `Rails.application.database_configuration`: > Permission denied @ rb_sysopen - /opt/gitlab/embedded/service/gitlab-rails/config/database.yml > /opt/gitlab/embedded/service/gitlab-rails/config/environment.rb:11:in `' > /opt/gitlab/embedded/bin/bundle:23:in `load' > /opt/gitlab/embedded/bin/bundle:23:in `' > > Caused by: > Errno::EACCES: Permission denied @ rb_sysopen - /opt/gitlab/embedded/service/gitlab-rails/config/database.yml > /opt/gitlab/embedded/service/gitlab-rails/config/environment.rb:11:in `' > /opt/gitlab/embedded/bin/bundle:23:in `load' > /opt/gitlab/embedded/bin/bundle:23:in `' > Tasks: TOP => gitlab:db:configure => environment > (See full trace by running task with --trace)
Details of package version
gitlab-ce 11.1.2-ce.0 amd64 GitLab Community Edition (including NGINX, Postgres, Redis)
Environment details
- Operating System: Linux 4.9.0-6-amd64 SMP Debian 4.9.88-1+deb9u1 (2018-05-07) x86_64 GNU/Linux
Configuration details
Relevant sections of `/etc/gitlab/gitlab.rb`
user['username'] = "gitlab" gitlab_rails['gitlab_username_changing_enabled'] = false gitlab_rails['lfs_enabled'] = true gitlab_rails['backup_path'] = "/home/gitlab/backups" git_data_dirs({ "default" => { "path" => "/home/gitlab/git-data" } }) web_server['external_users'] = ['www-data'] nginx['enable'] = false
Edited by Alexis Duque