I am trying to install apache2 via chef-solo unsuccessfully. The same recipe works when I run chef-client in local mode.
package 'apache2' do
action [:$pstall]
end
and
package 'apache2'
both fail, with the following exception:
* 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
The fact that chef-solo is able to execute the first line in the recipe, means configuration should be fine. I am not sure what I am missing. Please, any pointers are appreciated.
Best,
Alice
Just for the historical reference, issue was solved as comment.
Chef solo should be run from the root user or with the use of sudo.