在Ubuntu 18.04上通过Chef-solo安装apache2失败

时间:2018-10-23 23:22:28

标签: chef chef-solo

我尝试通过Chef-solo无法成功安装apache2。当我在本地模式下运行Chef-client时,相同的配方有效。

package 'apache2' do
  action [:$pstall]
end
and 
package 'apache2'

两者均失败,但以下情况除外:

* apt_update[Update the apt cache daily] action periodic (up to date)
* apt_package[apache2] action install

================================================================================
Error executing action `install` on resource 'apt_package[apache2]'
================================================================================

Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '100'
---- Begin output of ["apt-get", "-q", "-y", "install", "apache2=2.4.29-1ubuntu4.4"] ----
STDOUT:
STDERR: E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
---- End output of ["apt-get", "-q", "-y", "install", "apache2=2.4.29-1ubuntu4.4"] ----
Ran ["apt-get", "-q", "-y", "install", "apache2=2.4.29-1ubuntu4.4"] returned 100

chef-solo能够执行配方中的第一行,这意味着配置应该很好。我不确定我缺少什么。请,任何指针都表示赞赏。

最好

爱丽丝

1 个答案:

答案 0 :(得分:1)

仅供历史参考,问题已解决为comment

Chef solo应该从超级用户或使用sudo运行。