【问题标题】:Permission issues with external ntfs HDD, gitlab-ctl reconfigure changing permissions: "Operation not permitted"外部 ntfs 硬盘的权限问题,gitlab-ctl 重新配置更改权限:“不允许操作”
【发布时间】:2018-08-25 07:02:32
【问题描述】:

我在 rasberry pi 模型 3 B 上使用 gitlab。以下关于我的 设置 (sudo gitlab-rake gitlab:env:info) 的一些信息

System information
System:         Raspbian 8.0
Current User:   git
Using RVM:      no
Ruby Version:   2.3.6p384
Gem Version:    2.6.13
Bundler Version:1.13.7
Rake Version:   12.3.0
Redis Version:  3.2.11
Git Version:    2.14.3
Sidekiq Version:5.0.5
Go Version:     go1.3.3 linux/arm

GitLab information
Version:        10.6.0-rc3
Revision:       52fa89e
Directory:      /opt/gitlab/embedded/service/gitlab-rails
DB Adapter:     postgresql
URL:            http://gitlab.example.com
HTTP Clone URL: http://gitlab.example.com/some-group/some-project.git
SSH Clone URL:  git@gitlab.example.com:some-group/some-project.git
Using LDAP:     no
Using Omniauth: no

GitLab Shell
Version:        6.0.3
Repository storage paths:
- default:      /mnt/SeagateExpansion/GitLab/repositories
Hooks:          /opt/gitlab/embedded/service/gitlab-shell/hooks
Git:            /opt/gitlab/embedded/bin/git

在 gitlab 更新到版本 10.6.0 后,我需要再次更改 url,但是当我在 /etc/gitlab/gitlab.rb 中进行必要的更改并运行 sudo nano gitlab-ctl reconfigure 时,我收到以下 错误消息

  ========================================================================
  Error executing action `run` on resource 'ruby_block[directory resource: 
  /mnt/SeagateExpansion/GitLab]'
  ========================================================================

============================================================================
Error executing action `create` on resource 
'storage_directory[/mnt/SeagateExpansion/GitLab]'
============================================================================

结果信息说:

There was an error running gitlab-ctl reconfigure:

storage_directory[/mnt/SeagateExpansion/GitLab] (gitlab::gitlab-rails line 42) had an error: Mixlib::ShellOut::ShellCommandFailed: ruby_block[directory resource: /mnt/SeagateExpansion/GitLab] (/opt/gitlab/embedded/cookbooks/cache/cookbooks/package/resources/storage_directory.rb line 33) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of chmod 00700 /mnt/SeagateExpansion/GitLab ----
STDOUT:
STDERR: chmod: changing permissions of ‘/mnt/SeagateExpansion/GitLab’: Operation not permitted
---- End output of chmod 00700 /mnt/SeagateExpansion/GitLab ----
Ran chmod 00700 /mnt/SeagateExpansion/GitLab returned 1

所以问题似乎是,在资源存储上执行 runcreate 命令(外部上的 GitLab 文件夹HDD [HDD = SeagateExpansion]) 期望权限为 700,对吧?
根据这个错误我试图改变权限 外部硬盘文件夹/mnt/SeagateExpansion/GitLabls -l 输出:

drwxrwxrwx 1 root GitLabUser        0 Jan  4 17:55 GitLab

this帖子的帮助下,我尝试使用以下命令更改权限:

sudo find /mnt/SeagateExpansion/GitLab -type d -exec chmod 700 {} \;

到所需的权限 700。但更改不会生效。我还尝试了chmod -R 700 /mnt/SeagateExpansion/GitLab 并以 root 身份执行了命令,但更改没有生效。即使在重新启动树莓派之后。我做错了什么?

我还尝试将/etc/fstab 中硬盘的选项 设置/标志更改为user,但这对以太没有帮助。

感谢每一个提示和回答:)。

最好的问候,

布雷乔

【问题讨论】:

    标签: unix gitlab chmod gitlab-omnibus


    【解决方案1】:

    我终于明白了。解决方案是更改/etc/fstab 中的挂载设置。因为如果您有错误的选项设置(请参阅:https://en.wikipedia.org/wiki/Fstab),您将无法更改权限,因为它是一个ntfs 文件系统。

    所以我的 fstab 条目是这样的:

    UUID=FE820568820526AD   /mnt/SeagateExpansion   ntfs defaults,gid=GitLabUser   0       0
    

    新的条目是这样的:

     UUID=FE820568820526AD   /mnt/SeagateExpansion   ntfs-3g permissions   0       0
    

    请注意,您需要安装 ntfs-3g 才能在fstab 中使用它。 permissions 选项仅随 ntfs-3g 提供。见:https://www.tuxera.com/community/ntfs-3g-advanced/ownership-and-permissions/

    在此更改后我再次执行:

    sudo gitlab-ctl reconfigure
    

    现在错误消失了,可以设置文件夹/mnt/SeagateExpansion/GitLab的权限700。我还注意到GitLab文件夹的所有者在重新配置后也更改为用户git

    drwx------ 1 git  root        0 Jan  4 17:55 GitLab
    

    那是因为我不再需要选项gid=GitLabUser
    现在一切都恢复正常了 :)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-21
      • 1970-01-01
      • 1970-01-01
      • 2020-03-26
      • 2017-06-11
      • 1970-01-01
      相关资源
      最近更新 更多