Issue
I'm trying to figure out how Chef and Vagrant work by creating a LAMP stack in a Centos box. When provisioning with Chef, the Apache2 install gives the following error:
[2013-02-01T11:00:13+00:00] INFO: package[apache2] installing httpd-2.2.15-15.el6.centos.1 from base repository
================================================================================
Error executing action `install` on resource 'package[apache2]'
================================================================================
Chef::Exceptions::Exec
----------------------
returned 1, expected 0
Resource Declaration:
---------------------
# In /tmp/vagrant-chef-1/chef-solo-1/cookbooks/apache2/recipes/default.rb
20: package "apache2" do
21: package_name node['apache']['package']
22: end
23:
Compiled Resource:
------------------
# Declared in /tmp/vagrant-chef-1/chef-solo-1/cookbooks/apache2/recipes/default.rb:20:in `from_file'
package("apache2") do
package_name "httpd"
retries 0
recipe_name "default"
cookbook_name :apache2
version "2.2.15-15.el6.centos.1"
action :install
retry_delay 2
end
[2013-02-01T11:00:56+00:00] ERROR: Running exception handlers
[2013-02-01T11:00:56+00:00] ERROR: Exception handlers complete
[2013-02-01T11:00:56+00:00] FATAL: Stacktrace dumped to /tmp/vagrant-chef-1/chef-stacktrace.out
[2013-02-01T11:00:56+00:00] FATAL: Chef::Exceptions::Exec: package[apache2] (apache2::default line 20) had an error: Chef::Exceptions::Exec: returned 1, expected 0
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.
I commented out the Apache2 recipe and tried to install just PHP, but that gives the same error. The MYSQL recipe however works without problems and installs just fine
The base box was created with Veewee CentOS-6.3-i386-minimal
and this is the recipe I use:
include_recipe "yum"
include_recipe "apache2"
include_recipe "apache2::mod_php5"
include_recipe "apache2::mod_rewrite"
include_recipe "php"
include_recipe "php::module_mysql"
include_recipe "mysql::server"
All used cookbooks are the latest from opscode-cookbooks
.
I've no clue how to solve this, is it an error with yum not finding the packages, or some faulty install code in de cookbooks?
A previously installed Debian box with the same cookbooks (Apt instead of Yum) worked without problems.
Any help is appreciated.
Solution
Thanks to @DracoAter for the life-saving advice.
Ssh`d into vagrant and tried to install the package manually with yum. That gave the following error:
error: unpacking of archive failed on file /var/www/icons/poweredby.png;510bc31b: cpio: symlink
I had this in my Vagrantfile
:
config.vm.share_folder "www", "/var/www", "./www"
Which apparently blocks access to that directory from yum. So removing that line fixes the installation of httpd
.
Answered By - floorish Answer Checked By - Candace Johnson (WPSolving Volunteer)