Permission denied @ rb _sysopen

Hi everyone,

I recently updated the gitlab community edition to 11.1.2 runnig into an error when calling:

gitlab-ctl reconfigure

There seems to be some permission error, which I can not resolve:

> 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 `<top (required)>'
>               /opt/gitlab/embedded/bin/bundle:23:in `load'
>               /opt/gitlab/embedded/bin/bundle:23:in `<main>'
>               
>               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 `<top (required)>'
>               /opt/gitlab/embedded/bin/bundle:23:in `load'
>               /opt/gitlab/embedded/bin/bundle:23:in `<main>'
>               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 `<top (required)>'
>     /opt/gitlab/embedded/bin/bundle:23:in `load'
>     /opt/gitlab/embedded/bin/bundle:23:in `<main>'
>     
>     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 `<top (required)>'
>     /opt/gitlab/embedded/bin/bundle:23:in `load'
>     /opt/gitlab/embedded/bin/bundle:23:in `<main>'
>     Tasks: TOP => gitlab:db:configure => environment
>     (See full trace by running task with --trace)

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 git user, which is changed back by the reconfiguration step.

Thanks for any suggestions.

I recently worked on it,

the problem seems to be in the gitlab-rails data migration. If I change the file via chmod

/var/opt/gitlab/gitlab-rails/etc/database.yml

to 705 and then I call

gitlab-rake db:migrate

migration works fine. The problem is, that the reconfiguration step of gitlab-ctl automatically changes the permission back to 640.

Is there any workaround?

Thanks in advance

Hi @Chucky,

I have got exactly the same issue.

Any solution ? Is there an issue opened for that ?

Thanks

Hi @alexisd,

I have not a solution for that, yet. And I was not sure to open an issue for that…

Hi @Chucky,

I have opened https://gitlab.com/gitlab-org/omnibus-gitlab/issues/3721

:wink: