gitlab-ctl reconfigure报错“Error executing action `run` on resource ‘execute[semodule -i /opt/gitlab/”
一。问题场景
在linux安装gitlab时,修改配置文件完成后,执行命令gitlab-ctl reconfigure
时报错:“Error executing action run
on resource 'execute[semodule -i /opt/gitlab/”
Recipe: gitlab::selinux
* execute[semodule -i /opt/gitlab/embedded/selinux/rhel/7/gitlab-7.2.0-ssh-keygen.pp] action run
[execute] Failed to resolve typeattributeset statement at /etc/selinux/targeted/tmp/modules/400/gitlab-7.2.0-ssh-keygen/cil:1
semodule: Failed!
================================================================================
Error executing action `run` on resource 'execute[semodule -i /opt/gitlab/embedded/selinux/rhel/7/gitlab-7.2.0-ssh-keygen.pp]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of semodule -i /opt/gitlab/embedded/selinux/rhel/7/gitlab-7.2.0-ssh-keygen.pp ----
STDOUT:
STDERR: Failed to resolve typeattributeset statement at /etc/selinux/targeted/tmp/modules/400/gitlab-7.2.0-ssh-keygen/cil:1
semodule: Failed!
---- End output of semodule -i /opt/gitlab/embedded/selinux/rhel/7/gitlab-7.2.0-ssh-keygen.pp ----
Ran semodule -i /opt/gitlab/embedded/selinux/rhel/7/gitlab-7.2.0-ssh-keygen.pp returned 1
Resource Declaration:
---------------------
# In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/selinux.rb
20: execute "semodule -i /opt/gitlab/embedded/selinux/rhel/7/#{ssh_keygen_module}.pp" do
21: not_if "getenforce | grep Disabled"
22: not_if "semodule -l | grep '^#{ssh_keygen_module}\\s'"
23: end
24: end
Compiled Resource:
------------------
# Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/selinux.rb:20:in `from_file'
execute("semodule -i /opt/gitlab/embedded/selinux/rhel/7/gitlab-7.2.0-ssh-keygen.pp") do
action [:run]
retries 0
retry_delay 2
default_guard_interpreter :execute
command "semodule -i /opt/gitlab/embedded/selinux/rhel/7/gitlab-7.2.0-ssh-keygen.pp"
backup 5
returns 0
declared_type :execute
cookbook_name "gitlab"
recipe_name "selinux"
not_if "getenforce | grep Disabled"
not_if "semodule -l | grep '^gitlab-7.2.0-ssh-keygen\s'"
end
Platform:
---------
x86_64-linux
Running handlers:
Running handlers complete
Chef Client failed. 3 resources updated in 03 seconds
二。解决办法
前言:我是昨天安装gitlab的时候出的这个问题,昨天一晚上包括今天早上都在搜索这个问题。网上解决方法不多,但是也基本上都试过,一直都没有解决这个问题,最后还是在gitlab官网上面的issue才看见有关于这个问题的解决方法。这提醒我以后出现问题尽量去官网上面找答案,切记!
这篇博客的解决方法来自于gitlab官网issue:https://gitlab.com/gitlab-org/omnibus-gitlab/-/issues/501
话不多说,现在开始说解决办法:
1.我在网上看见比较多的解决方法就是执行sudo yum install libsemanage-static libsemanage-devel
命令,包括在官网上面也有这个案例,但是执行后还是依然报错:
2.执行cd /opt/gitlab/embedded/cookbooks/gitlab/recipes
命令,进入/opt/gitlab/embedded/cookbooks/gitlab/recipes文件夹下,再执行ll
命令,找到selinux.rb
文件:
3.执行vim selinux.rb
命令修改文件内容,将以下内容全部注释:
4.修改完成后如下图所示:
5.再次执行gitlab-ctl reconfigure
命令,运行成功:
6.执行gitlab-ctl start
命令后,gitlab也成功启动并且能够访问:
更多推荐
所有评论(0)