Skip to content

Instantly share code, notes, and snippets.

@trytuna
Last active July 5, 2022 09:47
Show Gist options
  • Save trytuna/77dda7e55a6b3e4bc795df6afa3a1ae9 to your computer and use it in GitHub Desktop.
Save trytuna/77dda7e55a6b3e4bc795df6afa3a1ae9 to your computer and use it in GitHub Desktop.
GitLab on Strato VServer: Resource temporarily unavailable
$ apt-get update && apt-get upgrade -y
$ uname -a
Linux 4.9.0 #1 SMP Mon Mar 16 15:39:59 MSK 2020 x86_64 GNU/Linux
# Install docker based on these instruction https://docs.docker.com/engine/install/debian/
$ apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
$ curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
$ add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/debian \
$(lsb_release -cs) \
stable"
$ apt-get update && apt-get install -y docker-ce
$ docker --version
Docker version 19.03.8, build afacb8b7f0
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 9.12 (stretch)
Release: 9.12
Codename: stretch
$ docker run --rm -p 8080:80 gitlab/gitlab-ce:12.9.4-ce.0
@trytuna
Copy link
Author

trytuna commented Apr 22, 2020

$ cat /proc/user_beancounters

Screenshot 2020-04-22 at 18 04 21

@trytuna
Copy link
Author

trytuna commented Apr 22, 2020

$ systemctl show --property=DefaultTasksMax
DefaultTasksMax=18446744073709551615

@trytuna
Copy link
Author

trytuna commented Apr 22, 2020

* execute[/opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8] action run
    [execute] popen failure: Resource temporarily unavailable
              The program "postgres" is needed by initdb but was not found in the
              same directory as "/opt/gitlab/embedded/postgresql/10/bin/initdb".
              Check your installation.
    
    ================================================================================
    Error executing action `run` on resource 'execute[/opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8]'
    ================================================================================
    
    Mixlib::ShellOut::ShellCommandFailed
    ------------------------------------
    Expected process to exit with [0], but received '1'
    ---- Begin output of /opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8 ----
    STDOUT: 
    STDERR: popen failure: Resource temporarily unavailable
    The program "postgres" is needed by initdb but was not found in the
    same directory as "/opt/gitlab/embedded/postgresql/10/bin/initdb".
    Check your installation.
    ---- End output of /opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8 ----
    Ran /opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8 returned 1
    
    Resource Declaration:
    ---------------------
    # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/postgresql/recipes/enable.rb
    
     85: execute "/opt/gitlab/embedded/bin/initdb -D #{node['postgresql']['data_dir']} -E UTF8" do
     86:   user postgresql_username
     87:   not_if { pg_helper.bootstrapped? }
     88: end
     89: 
    
    Compiled Resource:
    ------------------
    # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/postgresql/recipes/enable.rb:85:in `from_file'
    
    execute("/opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8") do
      action [:run]
      default_guard_interpreter :execute
      command "/opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8"
      backup 5
      declared_type :execute
      cookbook_name "postgresql"
      recipe_name "enable"
      domain nil
      user "gitlab-psql"
      not_if { #code block }
    end
    
    System Info:
    ------------
    chef_version=14.14.29
    platform=ubuntu
    platform_version=16.04
    ruby=ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]
    program_name=/opt/gitlab/embedded/bin/chef-client
    executable=/opt/gitlab/embedded/bin/chef-client
    
Recipe: gitlab::gitlab-rails
  * execute[clear the gitlab-rails cache] action run
    [execute] /opt/gitlab/bin/gitlab-rake: 34: /opt/gitlab/bin/gitlab-rake: Cannot fork
    
    ================================================================================
    Error executing action `run` on resource 'execute[clear the gitlab-rails cache]'
    ================================================================================
    
    Mixlib::ShellOut::ShellCommandFailed
    ------------------------------------
    Expected process to exit with [0], but received '2'
    ---- Begin output of /opt/gitlab/bin/gitlab-rake cache:clear ----
    STDOUT: 
    STDERR: /opt/gitlab/bin/gitlab-rake: 34: /opt/gitlab/bin/gitlab-rake: Cannot fork
    ---- End output of /opt/gitlab/bin/gitlab-rake cache:clear ----
    Ran /opt/gitlab/bin/gitlab-rake cache:clear returned 2
    
    Resource Declaration:
    ---------------------
    # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/gitlab-rails.rb
    
    409: execute "clear the gitlab-rails cache" do
    410:   command "/opt/gitlab/bin/gitlab-rake cache:clear"
    411:   action :nothing
    412:   not_if { omnibus_helper.not_listening?('redis') || !node['gitlab']['gitlab-rails']['rake_cache_clear'] }
    413: end
    414: 
    
    Compiled Resource:
    ------------------
    # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/gitlab-rails.rb:409:in `from_file'
    
    execute("clear the gitlab-rails cache") do
      action [:nothing]
      default_guard_interpreter :execute
      command "/opt/gitlab/bin/gitlab-rake cache:clear"
      backup 5
      declared_type :execute
      cookbook_name "gitlab"
      recipe_name "gitlab-rails"
      domain nil
      user nil
      not_if { #code block }
    end
    
    System Info:
    ------------
    chef_version=14.14.29
    platform=ubuntu
    platform_version=16.04
    ruby=ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]
    program_name=/opt/gitlab/embedded/bin/chef-client
    executable=/opt/gitlab/embedded/bin/chef-client
    
Recipe: gitaly::enable
  * runit_service[gitaly] action hup
    - send hup to runit_service[gitaly]

Running handlers:
There was an error running gitlab-ctl reconfigure:

Multiple failures occurred:
* Mixlib::ShellOut::ShellCommandFailed occurred in chef run: execute[/opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8] (postgresql::enable line 85) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of /opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8 ----
STDOUT: 
STDERR: popen failure: Resource temporarily unavailable
The program "postgres" is needed by initdb but was not found in the
same directory as "/opt/gitlab/embedded/postgresql/10/bin/initdb".
Check your installation.
---- End output of /opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8 ----
Ran /opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8 returned 1
* Mixlib::ShellOut::ShellCommandFailed occurred in delayed notification: execute[clear the gitlab-rails cache] (gitlab::gitlab-rails line 409) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '2'
---- Begin output of /opt/gitlab/bin/gitlab-rake cache:clear ----
STDOUT: 
STDERR: /opt/gitlab/bin/gitlab-rake: 34: /opt/gitlab/bin/gitlab-rake: Cannot fork
---- End output of /opt/gitlab/bin/gitlab-rake cache:clear ----
Ran /opt/gitlab/bin/gitlab-rake cache:clear returned 2

Running handlers complete
Chef Client failed. 169 resources updated in 40 seconds

@RaphKa02
Copy link

Did you find any solution to this problem?

@trytuna
Copy link
Author

trytuna commented Mar 16, 2022

Nope unfortunately not

@mkay-42069
Copy link

Might be a bit late, but for all who're interested.
It's the Numproc which are the problem. As is with all containerized servers there is a limit on how many processes you can run.
In your case the limit is 400 which is absurdly low! For comparison I have another vps with another company and there my limit is 131072.

I only stumbled upon this problem bc I got the 25 year deal from Strato, good thing I cancelled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment