docker-gitlab icon indicating copy to clipboard operation
docker-gitlab copied to clipboard

mac don't start docker gitlab caused by psotgresql , how to solve it

Open AlfredNing opened this issue 1 year ago • 8 comments

2023-08-29_03:21:56.76573 LOG: starting PostgreSQL 13.11 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 11.3.0-1ubuntu1~22.04.1) 11.3.0, 64-bit 2023-08-29_03:21:56.76817 LOG: could not set permissions of file "/var/opt/gitlab/postgresql/.s.PGSQL.5432": Invalid argument 2023-08-29_03:21:56.76835 WARNING: could not create Unix-domain socket in directory "/var/opt/gitlab/postgresql" 2023-08-29_03:21:56.76846 FATAL: could not create any Unix-domain sockets 2023-08-29_03:21:56.77111 LOG: database system is shut down 2023-08-29_03:21:58.02704 LOG: starting PostgreSQL 13.11 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 11.3.0-1ubuntu1~22.04.1) 11.3.0, 64-bit 2023-08-29_03:21:58.03004 LOG: could not set permissions of file "/var/opt/gitlab/postgresql/.s.PGSQL.5432": Invalid argument 2023-08-29_03:21:58.03025 WARNING: could not create Unix-domain socket in directory "/var/opt/gitlab/postgresql" 2023-08-29_03:21:58.03037 FATAL: could not create any Unix-domain sockets 2023-08-29_03:21:58.03365 LOG: database system is shut down 2023-08-29_03:21:59.27062 LOG: starting PostgreSQL 13.11 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 11.3.0-1ubuntu1~22.04.1) 11.3.0, 64-bit 2023-08-29_03:21:59.27307 LOG: could not set permissions of file "/var/opt/gitlab/postgresql/.s.PGSQL.5432": Invalid argument 2023-08-29_03:21:59.27323 WARNING: could not create Unix-domain socket in directory "/var/opt/gitlab/postgresql" 2023-08-29_03:21:59.27335 FATAL: could not create any Unix-domain sockets 2023-08-29_03:21:59.27592 LOG: database system is shut down

AlfredNing avatar Aug 29 '23 03:08 AlfredNing

From the message /var/opt/gitlab/postgresql/.s.PGSQL.5432, I think you are using official gitlab/gitlab-ce or gitlab/gitlab-ee image. If so, this is not the right place to ask for help.
Please ask on https://gitlab.com/gitlab-org/omnibus-gitlab

kkimurak avatar Sep 01 '23 04:09 kkimurak

what is the resolution to this though I am facing the same issue.

kianting avatar Sep 21 '23 00:09 kianting

The issue I am facing is similar 2023-09-21_00:48:26.29829 LOG: starting PostgreSQL 13.11 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 11.3.0-1ubuntu1~22.04.1) 11.3.0, 64-bit 2023-09-21_00:48:26.30008 LOG: could not set permissions of file "/var/opt/gitlab/postgresql/.s.PGSQL.5432": Invalid argument 2023-09-21_00:48:26.30029 WARNING: could not create Unix-domain socket in directory "/var/opt/gitlab/postgresql" 2023-09-21_00:48:26.30050 FATAL: could not create any Unix-domain sockets 2023-09-21_00:48:26.30305 LOG: database system is shut down

kianting avatar Sep 21 '23 00:09 kianting

I believe you are using a recent version of Docker Desktop which enables VirtioFS for file sharing by default. This blocks the embedded PostgreSQL from booting up. Changing it back to gRPC Fuse mode could help to work it around.

This has bothered me for a day on a new laptop. I recall it was working on an old laptop of M1 so it might be running an old version of Docker Desktop. Then I tried some old versions of Docker Desktop and 4.19.0 happened to work which does not have VirtioFS turned on yet but later versions made it default since 4.21.0.

Still don't know the root cause yet. I may explore it a bit further to see if I can find some time over the weekend.

xiaogangwen avatar Sep 29 '23 06:09 xiaogangwen

I believe you are using a recent version of Docker Desktop which enables VirtioFS for file sharing by default. This blocks the embedded PostgreSQL from booting up. Changing it back to gRPC Fuse mode could help to work it around.

This has bothered me for a day on a new laptop. I recall it was working on an old laptop of M1 so it might be running an old version of Docker Desktop. Then I tried some old versions of Docker Desktop and 4.19.0 happened to work which does not have VirtioFS turned on yet but later versions made it default since 4.21.0.

Still don't know the root cause yet. I may explore it a bit further if I can find some time over the weekend.

Yes you are right changing it back to gRPC Fuse got it working again.

image

kianting avatar Oct 01 '23 23:10 kianting

It sounds caused by the permission issue of VirtioFS in Docker Desktop.

xiaogangwen avatar Oct 03 '23 03:10 xiaogangwen

I got the same failure under VirtioFS, but switching to gRPC FUSE just gets me a different permissions error:

permissions error details
    * ruby_block[directory resource: /var/opt/gitlab/git-data] action run[2023-10-25T15:18:25+00:00] INFO: ruby_block[directory resource: /var/opt/gitlab/git-data] called

      - execute the ruby block directory resource: /var/opt/gitlab/git-data
  
  * storage_directory[/var/opt/gitlab/git-data/repositories] action create
    * ruby_block[directory resource: /var/opt/gitlab/git-data/repositories] action run
      
      ================================================================================
      Error executing action `run` on resource 'ruby_block[directory resource: /var/opt/gitlab/git-data/repositories]'
      ================================================================================
      
      Mixlib::ShellOut::ShellCommandFailed
      ------------------------------------
      Failed asserting that mode permissions on "/var/opt/gitlab/git-data/repositories" is 2770
      ---- Begin output of set -x && [ "$(stat --printf='%04a' $(readlink -f /var/opt/gitlab/git-data/repositories) | grep -o '....$')" = '2770' ] ----
      STDOUT: 
      STDERR: + + grepreadlink -o ....$
       -f /var/opt/gitlab/git-data/repositories
      + stat --printf=%04a /var/opt/gitlab/git-data/repositories
      + [ 0770 = 2770 ]
      ---- End output of set -x && [ "$(stat --printf='%04a' $(readlink -f /var/opt/gitlab/git-data/repositories) | grep -o '....$')" = '2770' ] ----
      Ran set -x && [ "$(stat --printf='%04a' $(readlink -f /var/opt/gitlab/git-data/repositories) | grep -o '....$')" = '2770' ] returned 1
      
      Cookbook Trace: (most recent call first)
      ----------------------------------------
      /opt/gitlab/embedded/cookbooks/cache/cookbooks/package/libraries/storage_directory_helper.rb:125:in `validate_command'
      /opt/gitlab/embedded/cookbooks/cache/cookbooks/package/libraries/storage_directory_helper.rb:113:in `block in validate'
      /opt/gitlab/embedded/cookbooks/cache/cookbooks/package/libraries/storage_directory_helper.rb:112:in `each_index'
      /opt/gitlab/embedded/cookbooks/cache/cookbooks/package/libraries/storage_directory_helper.rb:112:in `validate'
      /opt/gitlab/embedded/cookbooks/cache/cookbooks/package/libraries/storage_directory_helper.rb:87:in `validate!'
      /opt/gitlab/embedded/cookbooks/cache/cookbooks/package/resources/storage_directory.rb:45:in `block (3 levels) in class_from_file'
      /opt/gitlab/embedded/cookbooks/cache/cookbooks/package/resources/storage_directory.rb:36:in `block in class_from_file'

llimllib avatar Oct 25 '23 15:10 llimllib

I got the same failure under VirtioFS, but switching to gRPC FUSE just gets me a different permissions error:

permissions error details

    * ruby_block[directory resource: /var/opt/gitlab/git-data] action run[2023-10-25T15:18:25+00:00] INFO: ruby_block[directory resource: /var/opt/gitlab/git-data] called

      - execute the ruby block directory resource: /var/opt/gitlab/git-data
  
  * storage_directory[/var/opt/gitlab/git-data/repositories] action create
    * ruby_block[directory resource: /var/opt/gitlab/git-data/repositories] action run
      
      ================================================================================
      Error executing action `run` on resource 'ruby_block[directory resource: /var/opt/gitlab/git-data/repositories]'
      ================================================================================
      
      Mixlib::ShellOut::ShellCommandFailed
      ------------------------------------
      Failed asserting that mode permissions on "/var/opt/gitlab/git-data/repositories" is 2770
      ---- Begin output of set -x && [ "$(stat --printf='%04a' $(readlink -f /var/opt/gitlab/git-data/repositories) | grep -o '....$')" = '2770' ] ----
      STDOUT: 
      STDERR: + + grepreadlink -o ....$
       -f /var/opt/gitlab/git-data/repositories
      + stat --printf=%04a /var/opt/gitlab/git-data/repositories
      + [ 0770 = 2770 ]
      ---- End output of set -x && [ "$(stat --printf='%04a' $(readlink -f /var/opt/gitlab/git-data/repositories) | grep -o '....$')" = '2770' ] ----
      Ran set -x && [ "$(stat --printf='%04a' $(readlink -f /var/opt/gitlab/git-data/repositories) | grep -o '....$')" = '2770' ] returned 1
      
      Cookbook Trace: (most recent call first)
      ----------------------------------------
      /opt/gitlab/embedded/cookbooks/cache/cookbooks/package/libraries/storage_directory_helper.rb:125:in `validate_command'
      /opt/gitlab/embedded/cookbooks/cache/cookbooks/package/libraries/storage_directory_helper.rb:113:in `block in validate'
      /opt/gitlab/embedded/cookbooks/cache/cookbooks/package/libraries/storage_directory_helper.rb:112:in `each_index'
      /opt/gitlab/embedded/cookbooks/cache/cookbooks/package/libraries/storage_directory_helper.rb:112:in `validate'
      /opt/gitlab/embedded/cookbooks/cache/cookbooks/package/libraries/storage_directory_helper.rb:87:in `validate!'
      /opt/gitlab/embedded/cookbooks/cache/cookbooks/package/resources/storage_directory.rb:45:in `block (3 levels) in class_from_file'
      /opt/gitlab/embedded/cookbooks/cache/cookbooks/package/resources/storage_directory.rb:36:in `block in class_from_file'

You may want to clean up or delete the persistent volumes and start the container from scratch after switching file sharing mode.

xiaogangwen avatar Oct 26 '23 02:10 xiaogangwen