我正在使用 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。