-2

In file /etc/gitlab/gitlab.rb I change (need)

user['username'] = "gitlab"
user['group'] = "gitlab"

on

user['username'] = "git"
user['group'] = "git"

and sudo gitlab-ctl reconfigure

After this nginx output: 502 GitLab is not responding

$ gitlab-ctl tail
find: `/var/log/gitlab/postgresql': Permission denied
find: `/var/log/gitlab/nginx': Permission denied
find: `/var/log/gitlab/redis': Permission denied
find: `/var/log/gitlab/logrotate': Permission denied
==> /var/log/gitlab/unicorn/unicorn_stderr.log.15.gz <==
....
7
==> /var/log/gitlab/gitlab-rails/production.log.19.gz <==
,▒UPuTTYPuTTYPuTTY
==> /var/log/gitlab/unicorn/current <==
2015-04-15_03:12:45.26369 starting new unicorn master
PuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTYPuTTY2015-04-15_03:12:45.90614 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:732:in `initialize': Permission denied @ rb_sysopen - /var/log/gitlab/unicorn/unicorn_stderr.log (Errno::EACCES)
2015-04-15_03:12:45.90634       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:732:in `open'
2015-04-15_03:12:45.90639       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:732:in `redirect_io'
2015-04-15_03:12:45.90644       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:177:in `stderr_path='
2015-04-15_03:12:45.90650       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/configurator.rb:111:in `block in commit!'
2015-04-15_03:12:45.90655       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/configurator.rb:108:in `each'
2015-04-15_03:12:45.90660       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/configurator.rb:108:in `commit!'
2015-04-15_03:12:45.90665       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:121:in `initialize'
2015-04-15_03:12:45.90670       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/bin/unicorn:126:in `new'
2015-04-15_03:12:45.90675       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/bin/unicorn:126:in `<top (required)>'
2015-04-15_03:12:45.90679       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/bin/unicorn:23:in `load'
2015-04-15_03:12:45.90684       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/bin/unicorn:23:in `<main>'
2015-04-15_03:12:45.91888 master failed to start, check stderr log for details
2015-04-15_03:12:46.92327 failed to start a new unicorn master
2015-04-15_03:12:46.92788 starting new unicorn master
2015-04-15_03:12:47.65414 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:732:in `initialize': Permission denied @ rb_sysopen - /var/log/gitlab/unicorn/unicorn_stderr.log (Errno::EACCES)
2015-04-15_03:12:47.65671       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:732:in `open'
2015-04-15_03:12:47.65677       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:732:in `redirect_io'
2015-04-15_03:12:47.65682       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:177:in `stderr_path='
2015-04-15_03:12:47.65687       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/configurator.rb:111:in `block in commit!'
2015-04-15_03:12:47.65695       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/configurator.rb:108:in `each'
2015-04-15_03:12:47.65700       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/configurator.rb:108:in `commit!'
2015-04-15_03:12:47.65705       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:121:in `initialize'
2015-04-15_03:12:47.65710       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/bin/unicorn:126:in `new'
2015-04-15_03:12:47.65715       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/bin/unicorn:126:in `<top (required)>'
2015-04-15_03:12:47.65719       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/bin/unicorn:23:in `load'
2015-04-15_03:12:47.65724       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/bin/unicorn:23:in `<main>'
2015-04-15_03:12:47.67322 master failed to start, check stderr log for details
2015-04-15_03:12:48.67926 failed to start a new unicorn master
2015-04-15_03:12:48.68379 starting new unicorn master
2015-04-15_03:12:49.35816 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:732:in `initialize': Permission denied @ rb_sysopen - /var/log/gitlab/unicorn/unicorn_stderr.log (Errno::EACCES)
2015-04-15_03:12:49.35835       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:732:in `open'
2015-04-15_03:12:49.35841       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:732:in `redirect_io'
2015-04-15_03:12:49.35846       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:177:in `stderr_path='
2015-04-15_03:12:49.35851       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/configurator.rb:111:in `block in commit!'
2015-04-15_03:12:49.35856       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/configurator.rb:108:in `each'
2015-04-15_03:12:49.35860       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/configurator.rb:108:in `commit!'
2015-04-15_03:12:49.35865       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:121:in `initialize'
2015-04-15_03:12:49.35870       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/bin/unicorn:126:in `new'
2015-04-15_03:12:49.35875       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/bin/unicorn:126:in `<top (required)>'
2015-04-15_03:12:49.35880       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/bin/unicorn:23:in `load'
2015-04-15_03:12:49.35884       from /opt/gitlab/embedded/service/gem/ruby/2.1.0/bin/unicorn:23:in `<main>'
2015-04-15_03:12:49.37041 master failed to start, check stderr log for details
2015-04-15_03:12:50.37502 failed to start a new unicorn master
2015-04-15_03:12:50.37905 starting new unicorn master
Nikolay
  • 111
  • 1
  • 4
  • Did you at any point change the ownership of the relevant files from `gitlab` to `git`? – Jenny D Apr 16 '15 at 12:48
  • Many people use old repo(when user was name `git`) with ssh link begining `git@...git`. When I update gitlab, user renamed to `gitlab` ssh link begining `gitlab@.....git`. Too much repo need rename. – Nikolay Apr 16 '15 at 13:01

2 Answers2

2

Your error message shows you that after the change, gitlab-ctl doesn't have the proper permissions to access the repositories.

There are a few alternative things you can do to fix this. Choose one, choose wisely...

  1. You can change only the username but keep the old group. If the group has the requisite permissions, you won't need to change anything else.

  2. You can change ownership on all the files previously owned by github so that they are now owned by git instead. You can do this quite easily by running

find /var/log/gitlab -user github -exec chown git:git {} \;
  1. Instead of changing all the ownerships, you can keep the same old UID/GID but just change the name to git instead of github. You can do this by editing /etc/passwd.

  2. You can keep both usernames with the same UID and path to home dir, etc. That way it won't matter which username the users login with. This will make for a fairly confusing system, though, so I wouldn't recommend it if any of the other methods works.

Jenny D
  • 27,780
  • 21
  • 75
  • 114
1

I don't no why, but when I change permissions to /var/log/gitlab/unicorn and gitlab worked: sudo chown -R git:git /var/log/gitlab/unicorn

Nikolay
  • 111
  • 1
  • 4