TiMa

标签: Gitlab

  • Gitlab Docker部署gitaly启动失败问题

    在NAS上部署docker版gitlab,发现其他都正常,创建群组也正常,但是创建项目就会报500错误,

    Request ID: 01JXKP6NTCNM201KEGMSDHFJ2J

    查运行状态,gitaly未运行,有大量的gitaly错误日志,错误信息大致如下:

    {"error":"open /var/opt/gitlab/gitaly/gitaly.pid: permission denied","level":"fatal","msg":"find process","pid":3499,"time":"2025-06-13T14:56:03.048Z","wrapper":3499}
    
    unclean Gitaly shutdown: creating Git command factory: setting up Git execution environment: constructing Git environment: Checking bundled Git binary "gitaly-git-v2.49": permission denied
    {“level”:“warning”,“msg”:“The current configurations will cause Gitaly to fail to start up in future versions. Please run ‘gitaly configuration validate \u003c /var/opt/gitlab/gitaly/config.toml’ and fix the errors that are printed.”,“pid”:46135,“time”:“2025-06-13T14:59:34.981Z”}
    FAIL: 14:connections to all backends failing; last error: UNKNOWN: unix:/var/opt/gitlab/gitaly/gitaly.socket: No such file or directory

    换了好几个版本都是如此,经过大量查询和AI解释,都只解释了一半,主要与 GitLab 容器内 gitaly-git 二进制文件的权限或配置异常有关,也没有给准确的建议。这个问题的原因在于/var是一个受noexec保护的路径,禁止运行gitaly服务程序,而gitaly的运行目录正好位于:/var/opt/gitlab/gitaly/

    即便做了目录持久化挂载,给了读写权限,给了git用户/组权限,也会受目录保护影响,解决方案有两个:

    (更多…)