Skip to content

Cannot create directory on mounted volume, MACOS

Try to run gitlab on docker using COLIMA runtime with x86_64 setting on MacOS Monterey 12.7.1

https://github.com/abiosoft/colima

Using this docker run command:

sudo docker run -i
--hostname gitlab
--publish 443:443 --publish 80:8080 --publish 2222:22
--name gitlab
--restart always
--volume /Users/gesevilla/gitlab/config:/etc/gitlab
--volume /Users/gesevilla/gitlab/logs:/var/log/gitlab
--volume /Users/gesevilla/gitlab/data:/var/opt/gitlab
gitlab/gitlab-ce:latest

The logs show the following error:

[2023-11-01T04:54:27+00:00] INFO: Generating default secrets
[2023-11-01T04:54:32+00:00] INFO: Generating gitlab-secrets.json file
Recipe: gitlab::default
  * directory[/etc/gitlab] action create

    ================================================================================
    Error executing action `create` on resource 'directory[/etc/gitlab]'
    ================================================================================

    Errno::EACCES
    -------------
    Permission denied @ apply2files - /etc/gitlab

    Cookbook Trace: (most recent call first)
    ----------------------------------------
    /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/default.rb:41:in `from_file'

    Resource Declaration:
    ---------------------
    # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/default.rb

     36: directory "/etc/gitlab" do
     37:   owner "root"
     38:   group "root"
     39:   mode "0775"
     40:   only_if { node['gitlab']['manage_storage_directories']['manage_etc'] }
     41: end.run_action(:create)
     42:
     43: node.default['gitlab']['bootstrap']['enable'] = false if File.exist?("/var/opt/gitlab/bootstrapped")
     44:
     45: directory "Create /var/opt/gitlab" do
     46:   path "/var/opt/gitlab"
     47:   owner "root"
     48:   group "root"
     49:   mode "0755"
     50:   recursive true
     51:   action :create
     52: end
     53:
     54: directory "Create /var/log/gitlab" do
     55:   path "/var/log/gitlab"
     56:   owner "root"
     57:   group "root"
     58:   mode "0755"
     59:   recursive true
     60:   action :create
     61: end
     62:
     63: directory "#{install_dir}/embedded/etc" do
     64:   owner "root"
     65:   group "root"
     66:   mode "0755"
     67:   recursive true
     68:   action :create
     69: end
     70:
     71: template "#{install_dir}/embedded/etc/gitconfig" do
     72:   source "gitconfig-system.erb"
     73:   mode 0755
     74:   variables gitconfig: node.dig('gitlab', 'omnibus_gitconfig', 'system') || {}
     75: end
     76:
     77: # This recipe needs to run before gitlab-rails
     78: # because we add `gitlab-www` user to some groups created by that recipe
     79: include_recipe "gitlab::web-server"
     80:
     81: # We attempt to create and manage users/groups by default. If users wish to
     82: # disable it, they can set `manage_accounts['enable']` to `false`, and
     83: # `account` custom resource will not create them.
     84: include_recipe "gitlab::users"
     85:
     86: include_recipe "gitlab::gitlab-rails" if node['gitlab']['gitlab_rails']['enable']
     87:
     88: include_recipe "gitlab::selinux"

    Compiled Resource:
    ------------------
    # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/default.rb:36:in `from_file'

    directory("/etc/gitlab") do
      action [:create]
      default_guard_interpreter :default
      declared_type :directory
      cookbook_name "gitlab"
      recipe_name "default"
      owner "root"
      group "root"
      mode "0775"
      path "/etc/gitlab"
      only_if { #code block }
    end

    System Info:
    ------------
    chef_version=17.10.0
    platform=ubuntu
    platform_version=22.04
    ruby=ruby 3.0.6p216 (2023-03-30 revision 23a532679b) [x86_64-linux]
    program_name=/opt/gitlab/embedded/bin/cinc-client
    executable=/opt/gitlab/embedded/bin/cinc-client


  ================================================================================
  Recipe Compile Error in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/default.rb
  ================================================================================

  Errno::EACCES
  -------------
  directory[/etc/gitlab] (gitlab::default line 36) had an error: Errno::EACCES: Permission denied @ apply2files - /etc/gitlab

  Cookbook Trace: (most recent call first)
  ----------------------------------------
    /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/default.rb:41:in `from_file'

  Relevant File Content:
  ----------------------
  /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/default.rb:

   34:  include_recipe 'postgresql::directory_locations'
   35:
   36:  directory "/etc/gitlab" do
   37:    owner "root"
   38:    group "root"
   39:    mode "0775"
   40:    only_if { node['gitlab']['manage_storage_directories']['manage_etc'] }
   41>> end.run_action(:create)
   42:
   43:  node.default['gitlab']['bootstrap']['enable'] = false if File.exist?("/var/opt/gitlab/bootstrapped")
   44:
   45:  directory "Create /var/opt/gitlab" do
   46:    path "/var/opt/gitlab"
   47:    owner "root"
   48:    group "root"
   49:    mode "0755"
   50:    recursive true

  System Info:
  ------------
  chef_version=17.10.0
  platform=ubuntu
  platform_version=22.04
  ruby=ruby 3.0.6p216 (2023-03-30 revision 23a532679b) [x86_64-linux]
  program_name=/opt/gitlab/embedded/bin/cinc-client
  executable=/opt/gitlab/embedded/bin/cinc-client


  Running handlers:
[2023-11-01T04:54:33+00:00] ERROR: Running exception handlers
There was an error running gitlab-ctl reconfigure:

directory[/etc/gitlab] (gitlab::default line 36) had an error: Errno::EACCES: Permission denied @ apply2files - /etc/gitlab

  Running handlers complete
[2023-11-01T04:54:33+00:00] ERROR: Exception handlers complete
  Infra Phase failed. 0 resources updated in 20 seconds
[2023-11-01T04:54:33+00:00] FATAL: Stacktrace dumped to /opt/gitlab/embedded/cookbooks/cache/cinc-stacktrace.out
[2023-11-01T04:54:33+00:00] FATAL: ---------------------------------------------------------------------------------------
[2023-11-01T04:54:33+00:00] FATAL: PLEASE PROVIDE THE CONTENTS OF THE stacktrace.out FILE (above) IF YOU FILE A BUG REPORT
[2023-11-01T04:54:33+00:00] FATAL: ---------------------------------------------------------------------------------------
[2023-11-01T04:54:33+00:00] FATAL: Errno::EACCES: directory[/etc/gitlab] (gitlab::default line 36) had an error: Errno::EACCES: Permission denied @ apply2files - /etc/gitlab

Running on:

  • Operating System: MacOS Monteyer 12.7.1
  • Installation Target, remove incorrect values:
    • Other: Macbook Pro M1
  • Installation Type, remove incorrect values:
    • New Installation
  • Is this a single or multiple node installation?
  • Resources
    • CPU: M1 apple silicon
    • Memory total: 8 GB

Configuration details

Yes, I did run

gitlab-ctl reconfigure

But nothing happened. Added the docker group and set read and write to the directories of volumes mounted.

I cannot find a near identical error.

Edited by Simon Knox