Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In my "Vagrant" file I have this line:


But it gives me this error:

[2013-01-11T22:14:53+00:00] INFO: Processing package[php-apc] action install (php::module_apc line 34)
Error executing action `install` on resource 'package[php-apc]'
apt-get -q -y install php-apc=3.1.7-1 returned 100, expected 0

Resource Declaration:
# In /tmp/vagrant-chef-1/chef-solo-1/cookbooks/php/recipes/module_apc.rb

 33: when "debian"
 34:   package "php-apc" do
 35:     action :install
 36:   end
 37: end

Compiled Resource:
# Declared in /tmp/vagrant-chef-1/chef-solo-1/cookbooks/php/recipes/module_apc.rb:34:in `from_file'

package("php-apc") do
  retry_delay 2
  retries 0
  recipe_name "module_apc"
  action [:install]
  cookbook_name :php
  package_name "php-apc"
[2013-01-11T22:14:53+00:00] ERROR: Running exception handlers
[2013-01-11T22:14:53+00:00] ERROR: Exception handlers complete
[2013-01-11T22:14:53+00:00] FATAL: Stacktrace dumped to /tmp/vagrant-chef-1/chef-stacktrace.out
[2013-01-11T22:14:53+00:00] FATAL: Chef::Exceptions::Exec: package[php-apc] (php::module_apc line 34) had an error: Chef::Exceptions::Exec: apt-get -q -y install php-apc=3.1.7-1 returned 100, 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'm also running this before:


But it's no help either.

Any ideas how to fix this? Thanks a lot!

Btw, I'm using all cookbooks from OpsCode:

share|improve this question
What repository are you getting php 5.4 from? Do they have a APC package against that version of PHP included in that repository? If they haven't built a package, then you can't install it. Extensions have to be compiled against the specific version of PHP you are running. – Zoredache Jan 11 '13 at 23:30
To be honest, I dunno. I've installed Vagrant, downloaded some of the opscode cookbooks and use them in my Vagrant file. Any idea where to look for the repository addresses? The exact name of the PHP version is 5.4.10-1~dotdeb.0, if that helps. Thanks! – Thasmo Jan 11 '13 at 23:36
Ah, I probably used some chef cookbooks/recipes which use dotdeb to install the packages. And if I'm right, the comments tell me, that there's no up to date version of APC for PHP 5.4.10 yet, right? – Thasmo Jan 11 '13 at 23:46
Repositories are defined in /etc/apt/sources.list, or files in ``/etc/apt/sources.list.d/. You can also see what repository was used for a specific package by running the command apt-cache policy {packagename}` – Zoredache Jan 12 '13 at 1:06
The repositories are the ones from, but there seems to be no relevant APC package for PHP 5.4, if I'm right. But i've found a PECL directory on their servers which holds an APC version for PHP 5.4, I think: But I'm not sure how to install it. Using PHP Pear to install it tells me: "RuntimeError: Package apc not found in either PEAR or PECL." Any hints? Thanks a lot! – Thasmo Jan 13 '13 at 17:12

I just ran through the following test:

Vagrantfile runlist:

chef.run_list = [

Using Ubuntu 12.04, Chef 10.14.2, and the following cookbook versions:

  • apt (1.4.8)
  • php (1.1.0)
  • build-essential (1.3.2) (dependency)
  • xml (1.0.4) (dependency)
  • mysql (2.1.0) (dependency)
  • openssl (1.0.0) (dependency)

It runs completely through, and ends up with:

vagrant@apctest:~$ dpkg -l | grep php
ii  php-apc                         3.1.7-1                    APC (Alternative PHP Cache) module for PHP 5
ii  php5-common                     5.3.10-1ubuntu3.4          Common files for packages built from the php5 source
ii  php5-fpm                        5.3.10-1ubuntu3.4          server-side, HTML-embedded scripting language (FPM-CGI binary)


I would suggest using up-to-date released cookbooks from the Community Site instead of the source from GitHub - the released versions are "stable" vs the repos that are in constant development.

share|improve this answer
Thanks for your input. So you recommend using PHP 5.3 instead of PHP 5.4, which has not too many stable cookbooks yet? Thanks! – Thasmo Jan 19 '13 at 22:15
I wold say: be informed about the cookbooks you use, and the versions they support. If someone writes a cookbook that supports installing PHP 5.4, it may only work for a subset of the "stable" cookbook's functionality. – Mike Fiedler Jan 20 '13 at 14:51

I could be wrong, but the error doesn't seem to be related to a version mismatch.

Log in to the box and run sudo apt-get update. Log out and see if you can provision with vagrant provision. Sometimes an update doesn't complete properly and just needs to be rerun.

If that doesn't work, log in and try sudo apt-get install php-apc=3.1.7-1 to see what the error is from apt.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.