Skip to content

gitlab-ctl reconfigure fails on sysctl because /sys is readonly

If you try to install gitlab in a lxc container it fails as /sys is readonly.

This is a similiar issue as #788 (closed) which has been marked as closed. I'm not sure, how the correct procedure is but as #788 (closed) is quite old and I can't reopen it, I decided to open this ticket. Please close as duplicate if feasible.

Recipe: gitlab::unicorn
  * execute[load sysctl conf] action run
    [execute] sysctl: setting key "kernel.shmall": Read-only file system
              sysctl: setting key "kernel.shmmax": Read-only file system

    ================================================================================
    Error executing action `run` on resource 'execute[load sysctl conf]'
    ================================================================================

    Mixlib::ShellOut::ShellCommandFailed
    ------------------------------------
    Expected process to exit with [0], but received '255'
    ---- Begin output of cat /etc/sysctl.conf /etc/sysctl.d/*.conf  | sysctl -e -p - ----
    STDOUT:
    STDERR: sysctl: setting key "kernel.shmall": Read-only file system
    sysctl: setting key "kernel.shmmax": Read-only file system
    ---- End output of cat /etc/sysctl.conf /etc/sysctl.d/*.conf  | sysctl -e -p - ----
    Ran cat /etc/sysctl.conf /etc/sysctl.d/*.conf  | sysctl -e -p - returned 255

    Resource Declaration:
    ---------------------
    # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/definitions/sysctl.rb

     52:   execute "load sysctl conf" do
     53:     command "cat /etc/sysctl.conf /etc/sysctl.d/*.conf  | sysctl -e -p -"
     54:     action :nothing
     55:   end
     56: end

    Compiled Resource:
    ------------------
    # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/definitions/sysctl.rb:52:in `block in from_file'

    execute("load sysctl conf") do
      params {:value=>1024, :name=>"net.core.somaxconn"}
      action [:nothing]
      retries 0
      retry_delay 2
      default_guard_interpreter :execute
      command "cat /etc/sysctl.conf /etc/sysctl.d/*.conf  | sysctl -e -p -"
      backup 5
      returns 0
      declared_type :execute
      cookbook_name "gitlab"
      recipe_name "unicorn"
    end