Edge case in the check rake's advice

Summary

I was migrating our Gitlab data to a new disk and rsync failed to maintain the groups on the uploads directory. When running the gitlab:check rake task, it detected this, but gave me a set of commands that didn't solve the problem. It needs to chown the directory to git:gitlab-www instead of just git

Steps to reproduce

Change the group on /var/opt/gitlab/gitlab-rails/uploads to something that is not gitlab-www and run gitlab-rake gitlab:check.

Expected behavior

root@gitlab:~# gitlab-rake gitlab:check
Checking GitLab Shell ...
...
Uploads directory setup correctly? ... no
  Try fixing it:
  sudo chown -R git:gitlab-www /var/opt/gitlab/gitlab-rails/uploads
  sudo find /var/opt/gitlab/gitlab-rails/uploads -type f -exec chmod 0644 {} \;
  sudo find /var/opt/gitlab/gitlab-rails/uploads -type d -not -path /var/opt/gitlab/gitlab-rails/uploads -exec chmod 0700 {} \;
  For more information see:
  doc/install/installation.md in section "GitLab"
  Please fix the error above and rerun the checks.
...

Actual behavior

root@gitlab:~# gitlab-rake gitlab:check
Checking GitLab Shell ...
...
Uploads directory setup correctly? ... no
  Try fixing it:
  sudo chown -R git /var/opt/gitlab/gitlab-rails/uploads
  sudo find /var/opt/gitlab/gitlab-rails/uploads -type f -exec chmod 0644 {} \;
  sudo find /var/opt/gitlab/gitlab-rails/uploads -type d -not -path /var/opt/gitlab/gitlab-rails/uploads -exec chmod 0700 {} \;
  For more information see:
  doc/install/installation.md in section "GitLab"
  Please fix the error above and rerun the checks.
...

Relevant logs and/or screenshots

The permissions on the upload folder initially:

root@gitlab:~# ls -la /var/opt/gitlab/gitlab-rails
total 31
drwxr-xr-x  9 git  root       12 Jan 27 15:56 .
drwxr-xr-x 16 root root       19 Jan 27 15:56 ..
drwx------  2 git  root       12 Jan 27 15:56 etc
-rw-r--r--  1 root root        8 Jan 27 10:01 REVISION
-rw-r--r--  1 root root       58 Jan 17 17:16 RUBY_VERSION
drwxr-x--x  8 git  gitlab-www  8 Jan 23 15:11 shared
drwxr-x---  2 git  gitlab-www  3 Jan 27 15:56 sockets
drwx------  3 git  root        3 May 17  2016 tmp
drwx------  2 git  root       23 Jan 27 10:01 upgrade-status
drwx------ 10 git  root       10 Oct 27 10:24 uploads
-rw-r--r--  1 root root       10 Jan 27 10:01 VERSION
drwx------  2 git  root        2 May 17  2016 working

Output of checks

Results of GitLab application Check

With fixed permissions on the uploads folder:

Checking GitLab Shell ...

GitLab Shell version >= 4.1.1 ? ... OK (4.1.1)
Repo base directory exists?
default... yes
Repo storage directories are symlinks?
default... no
Repo paths owned by git:git?
default... yes
Repo paths access is drwxrws---?
default... yes
hooks directories in repos are links: ... 
17/10 ... ok
17/11 ... ok
22/12 ... ok
19/13 ... ok
19/14 ... ok
20/15 ... ok
17/16 ... ok
20/17 ... ok
20/19 ... ok
22/20 ... ok
17/21 ... ok
17/22 ... ok
19/23 ... ok
22/24 ... ok
17/25 ... ok
22/28 ... ok
14/29 ... ok
20/30 ... ok
20/32 ... ok
17/33 ... ok
20/34 ... ok
17/35 ... ok
20/36 ... ok
17/37 ... ok
17/38 ... ok
20/39 ... ok
17/40 ... ok
17/41 ... ok
25/42 ... ok
26/43 ... ok
25/44 ... ok
19/45 ... ok
20/47 ... ok
22/48 ... ok
26/49 ... ok
17/50 ... ok
Running /opt/gitlab/embedded/service/gitlab-shell/bin/check
Check GitLab API access: OK
Access to /var/opt/gitlab/.ssh/authorized_keys: OK
Send ping to redis server: OK
gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Sidekiq ...

Running? ... yes
Number of Sidekiq processes ... 1

Checking Sidekiq ... Finished

Checking Reply by email ...

Reply by email is disabled in config/gitlab.yml

Checking Reply by email ... Finished

Checking LDAP ...

Server: ldapmain
LDAP authentication... Success
LDAP users with access to your GitLab server (only showing the first 100 results)
[REDACTED]

Checking LDAP ... Finished

Checking GitLab ...

Git configured with autocrlf=input? ... yes
Database config exists? ... yes
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory setup correctly? ... yes
Init script exists? ... skipped (omnibus-gitlab has no init script)
Init script up-to-date? ... skipped (omnibus-gitlab has no init script)
projects have namespace: ... 
17/10 ... yes
17/11 ... yes
22/12 ... yes
19/13 ... yes
19/14 ... yes
20/15 ... yes
17/16 ... yes
20/17 ... yes
20/19 ... yes
22/20 ... yes
17/21 ... yes
17/22 ... yes
19/23 ... yes
22/24 ... yes
17/25 ... yes
22/28 ... yes
14/29 ... yes
20/30 ... yes
20/32 ... yes
17/33 ... yes
20/34 ... yes
17/35 ... yes
20/36 ... yes
17/37 ... yes
17/38 ... yes
20/39 ... yes
17/40 ... yes
17/41 ... yes
25/42 ... yes
26/43 ... yes
25/44 ... yes
19/45 ... yes
20/47 ... yes
22/48 ... yes
26/49 ... yes
17/50 ... yes
Redis version >= 2.8.0? ... yes
Ruby version >= 2.1.0 ? ... yes (2.3.3)
Your git bin path is "/opt/gitlab/embedded/bin/git"
Git version >= 2.7.3 ? ... yes (2.10.2)
Active users: 7

Checking GitLab ... Finished

Results of GitLab environment info

System information
System:		Ubuntu 16.04
Current User:	git
Using RVM:	no
Ruby Version:	2.3.3p222
Gem Version:	2.6.6
Bundler Version:1.13.7
Rake Version:	10.5.0
Sidekiq Version:4.2.7

GitLab information
Version:	8.16.2-ee
Revision:	a019470
Directory:	/opt/gitlab/embedded/service/gitlab-rails
DB Adapter:	PostgreSQL
DB Version:	9.6.1
URL:		https://gitlab.amp
HTTP Clone URL:	https://gitlab.amp/some-group/some-project.git
SSH Clone URL:	git@gitlab.amp:some-group/some-project.git
Elasticsearch:	no
Geo:		no
Using LDAP:	yes
Using Omniauth:	no

GitLab Shell
Version:	4.1.1
Repository storage paths:
- default: 	/var/opt/gitlab/git-data/repositories
Hooks:		/opt/gitlab/embedded/service/gitlab-shell/hooks/
Git:		/opt/gitlab/embedded/bin/git

Possible fixes

Source: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/tasks/gitlab/check.rake#L294

Edited Jun 30, 2025 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading