저는 gitlab 버전 7.10.4를 사용하고 있으며 설치를 업그레이드하려고 합니다. 그런데 백업을 만들려고 하면 이런 메시지가 나타납니다.
gitlab-rake gitlab:backup:create
Errno::EPERM: Operation not permitted @ chmod_internal - db
Errno::EPERM: Operation not permitted @ chmod_internal - db
/opt/gitlab/embedded/lib/ruby/2.1.0/fileutils.rb:1354:in `chmod'
/opt/gitlab/embedded/lib/ruby/2.1.0/fileutils.rb:1354:in `chmod'
/opt/gitlab/embedded/lib/ruby/2.1.0/fileutils.rb:997:in `block in chmod'
/opt/gitlab/embedded/lib/ruby/2.1.0/fileutils.rb:996:in `each'
/opt/gitlab/embedded/lib/ruby/2.1.0/fileutils.rb:996:in `chmod'
/opt/gitlab/embedded/service/gitlab-rails/lib/backup/manager.rb:19:in `block in pack'
/opt/gitlab/embedded/service/gitlab-rails/lib/backup/manager.rb:13:in `chdir'
/opt/gitlab/embedded/service/gitlab-rails/lib/backup/manager.rb:13:in `pack'
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/backup.rake:16:in `block (3 levels) in <top (required)>'
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `call'
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/opt/gitlab/embedded/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task'
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level'
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.4.2/bin/rake:33:in `<top (required)>'
/opt/gitlab/embedded/service/gem/ruby/2.1.0/bin/rake:23:in `load'
/opt/gitlab/embedded/service/gem/ruby/2.1.0/bin/rake:23:in `<main>'
Tasks: TOP => gitlab:backup:create
이 문제를 해결하도록 도와주세요.
답변1
첫째, gitlab 문서에서는 명령을 실행하려면 sudo를 사용해야 한다고 생각하는 것 같습니다.
https://github.com/gitlabhq/gitlabhq/blob/7-10-stable/doc/raketasks/backup_restore.md
코드를 기반으로:
https://github.com/gitlabhq/gitlabhq/blob/7-10-stable/lib/backup/manager.rb
구성된 백업 디렉터리(Gitlab.config.backup.path)의 3개 디렉터리(저장소, 데이터베이스, 업로드)에서 chmod 700을 실행하는 것 같습니다(데이터베이스에서는 실패함). 설명서에 따르면 Gitlab.config.backup.path 변수는 config/gitlab.yml에서 추출됩니다. 구성 파일을 찾을 수 없는 경우 임시로 /opt/gitlab/embedded/service/gitlab-rails/lib/backup/manager.rb:19에 줄을 추가하여 백업 디렉터리를 인쇄할 수 있습니다.
puts("Backup dir is: #{Gitlab.config.backup.path}")
strace 명령을 사용하여 동일한 정보를 얻을 수도 있습니다.
$ strace -f gitlab-rake gitlab:backup:create 2>&1 | grep "^chdir\|^fchdir"
백업 디렉터리를 찾은 후 해당 디렉터리에 있는 db 디렉터리를 확인합니다. 표준 Linux 권한 문제 해결을 적용해야 합니다. 어떤 사용자로 명령을 실행하고 있으며 디렉터리에 어떤 권한 세트가 있습니까? 필요에 따라 Sudo chmod/chown.