Error chef-solo Errno :: ENOENT: There is no such file or directory - solo.rb

I am trying to install nginx via the opscode cookbook on a Ubuntu 12.04 server. I know that it depends on whoo, so I bought a book too. When i started

$ sudo chef-solo -c solo.rb 

I get an error

 FATAL: Errno::ENOENT: No such file or directory - solo.rb 

Not sure how solo.rb is missing when it is in my current directory.

 $ ls cache cookbooks node.json node.json~ solo.rb solo.rb~ 

Here is the debugging result

 $ sudo chef-solo -l debug -c solo.rb [Sun, 20 May 2012 14:00:10 -0400] INFO: *** Chef 0.10.10 *** [Sun, 20 May 2012 14:00:10 -0400] DEBUG: Building node object for vagrant-ubuntu-precise [Sun, 20 May 2012 14:00:10 -0400] DEBUG: Extracting run list from JSON attributes provided on command line [Sun, 20 May 2012 14:00:10 -0400] INFO: Setting the run_list to ["recipe[ohai]", "recipe[main]", "recipe[nginx]"] from JSON [Sun, 20 May 2012 14:00:10 -0400] DEBUG: Applying attributes from json file [Sun, 20 May 2012 14:00:10 -0400] DEBUG: Platform is ubuntu version 12.04 [Sun, 20 May 2012 14:00:10 -0400] INFO: Run List is [recipe[ohai], recipe[main], recipe[nginx]] [Sun, 20 May 2012 14:00:10 -0400] INFO: Run List expands to [ohai, main, nginx] [Sun, 20 May 2012 14:00:10 -0400] INFO: Starting Chef Run for vagrant-ubuntu-precise [Sun, 20 May 2012 14:00:10 -0400] INFO: Running start handlers [Sun, 20 May 2012 14:00:10 -0400] INFO: Start handlers complete. [Sun, 20 May 2012 14:00:10 -0400] DEBUG: No chefignore file found at /var/chef/cookbooks/chefignore no files will be ignored [Sun, 20 May 2012 14:00:10 -0400] DEBUG: Loading cookbook chef-jenkins library file: /var/chef/cookbooks/chef-jenkins/libraries/manage_node.rb [Sun, 20 May 2012 14:00:10 -0400] DEBUG: Loading cookbook chef-jenkins providers from /var/chef/cookbooks/chef-jenkins/providers/job.rb [Sun, 20 May 2012 14:00:10 -0400] DEBUG: Loaded contents of /var/chef/cookbooks/chef-jenkins/providers/job.rb into a provider named chef-jenkins_job defined in Chef::Provider::ChefJenkinsJob [Sun, 20 May 2012 14:00:10 -0400] DEBUG: Loading cookbook chef-jenkins providers from /var/chef/cookbooks/chef-jenkins/providers/execute.rb [Sun, 20 May 2012 14:00:10 -0400] DEBUG: Loaded contents of /var/chef/cookbooks/chef-jenkins/providers/execute.rb into a provider named chef-jenkins_execute defined in Chef::Provider::ChefJenkinsExecute [Sun, 20 May 2012 14:00:10 -0400] DEBUG: Loading cookbook chef-jenkins providers from /var/chef/cookbooks/chef-jenkins/providers/node.rb [Sun, 20 May 2012 14:00:10 -0400] DEBUG: Loaded contents of /var/chef/cookbooks/chef-jenkins/providers/node.rb into a provider named chef-jenkins_node defined in Chef::Provider::ChefJenkinsNode [Sun, 20 May 2012 14:00:10 -0400] DEBUG: Loading cookbook chef-jenkins providers from /var/chef/cookbooks/chef-jenkins/providers/cli.rb [Sun, 20 May 2012 14:00:10 -0400] DEBUG: Loaded contents of /var/chef/cookbooks/chef-jenkins/providers/cli.rb into a provider named chef-jenkins_cli defined in Chef::Provider::ChefJenkinsCli [Sun, 20 May 2012 14:00:10 -0400] DEBUG: Loading cookbook chef-jenkins resources from /var/chef/cookbooks/chef-jenkins/resources/job.rb [Sun, 20 May 2012 14:00:10 -0400] DEBUG: Loaded contents of /var/chef/cookbooks/chef-jenkins/resources/job.rb into a resource named chef-jenkins_job defined in Chef::Resource::ChefJenkinsJob [Sun, 20 May 2012 14:00:10 -0400] DEBUG: Loading cookbook chef-jenkins resources from /var/chef/cookbooks/chef-jenkins/resources/node.rb [Sun, 20 May 2012 14:00:10 -0400] DEBUG: Loaded contents of /var/chef/cookbooks/chef-jenkins/resources/node.rb into a resource named chef-jenkins_node defined in Chef::Resource::ChefJenkinsNode [Sun, 20 May 2012 14:00:10 -0400] DEBUG: Loading cookbook chef-jenkins resources from /var/chef/cookbooks/chef-jenkins/resources/execute.rb [Sun, 20 May 2012 14:00:10 -0400] DEBUG: Loaded contents of /var/chef/cookbooks/chef-jenkins/resources/execute.rb into a resource named chef-jenkins_execute defined in Chef::Resource::ChefJenkinsExecute [Sun, 20 May 2012 14:00:10 -0400] DEBUG: Loading cookbook chef-jenkins resources from /var/chef/cookbooks/chef-jenkins/resources/cli.rb [Sun, 20 May 2012 14:00:10 -0400] DEBUG: Loaded contents of /var/chef/cookbooks/chef-jenkins/resources/cli.rb into a resource named chef-jenkins_cli defined in Chef::Resource::ChefJenkinsCli [Sun, 20 May 2012 14:00:10 -0400] DEBUG: Node vagrant-ubuntu-precise loading cookbook nginx attribute file /var/chef/cookbooks/nginx/attributes/default.rb [Sun, 20 May 2012 14:00:10 -0400] DEBUG: Node vagrant-ubuntu-precise loading cookbook nginx attribute file /var/chef/cookbooks/nginx/attributes/geoip.rb [Sun, 20 May 2012 14:00:10 -0400] DEBUG: Node vagrant-ubuntu-precise loading cookbook nginx attribute file /var/chef/cookbooks/nginx/attributes/source.rb [Sun, 20 May 2012 14:00:10 -0400] DEBUG: Node vagrant-ubuntu-precise loading cookbook nginx attribute file /var/chef/cookbooks/nginx/attributes/upload_progress.rb [Sun, 20 May 2012 14:00:10 -0400] DEBUG: Node vagrant-ubuntu-precise loading cookbook ohai attribute file /var/chef/cookbooks/ohai/attributes/default.rb [Sun, 20 May 2012 14:00:10 -0400] DEBUG: Node vagrant-ubuntu-precise loading cookbook chef-jenkins attribute file /var/chef/cookbooks/chef-jenkins/attributes/default.rb [Sun, 20 May 2012 14:00:10 -0400] DEBUG: Loading cookbook nginx definitions from /var/chef/cookbooks/nginx/definitions/nginx_site.rb [Sun, 20 May 2012 14:00:10 -0400] DEBUG: Loading Recipe ohai via include_recipe [Sun, 20 May 2012 14:00:10 -0400] DEBUG: Found recipe default in cookbook ohai [Sun, 20 May 2012 14:00:10 -0400] INFO: ohai plugins will be at: /etc/chef/ohai_plugins [Sun, 20 May 2012 14:00:10 -0400] DEBUG: Platform ubuntu not found, using all defaults. (Unsupported platform?) [Sun, 20 May 2012 14:00:10 -0400] INFO: Processing remote_directory[/etc/chef/ohai_plugins] action create (ohai::default line 23) [Sun, 20 May 2012 14:00:10 -0400] INFO: Processing cookbook_file[/etc/chef/ohai_plugins/README] action create (dynamically defined) [Sun, 20 May 2012 14:00:10 -0400] DEBUG: Platform ubuntu not found, using all defaults. (Unsupported platform?) [Sun, 20 May 2012 14:00:10 -0400] ERROR: Running exception handlers [Sun, 20 May 2012 14:00:10 -0400] ERROR: Exception handlers complete [Sun, 20 May 2012 14:00:10 -0400] DEBUG: Re-raising exception: Errno::ENOENT - No such file or directory - solo.rb /var/chef/cookbooks/ohai/recipes/default.rb:41:in `read' /var/chef/cookbooks/ohai/recipes/default.rb:41:in `from_file' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/cookbook_version.rb:578:in `load_recipe' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/mixin/language_include_recipe.rb:46:in `load_recipe' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/mixin/language_include_recipe.rb:33:in `include_recipe' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/mixin/language_include_recipe.rb:27:in `each' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/mixin/language_include_recipe.rb:27:in `include_recipe' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/run_context.rb:72:in `load' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/run_context.rb:69:in `each' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/run_context.rb:69:in `load' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/client.rb:199:in `setup_run_context' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/client.rb:162:in `run' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/application/solo.rb:207:in `run_application' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/application/solo.rb:195:in `loop' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/application/solo.rb:195:in `run_application' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/application.rb:70:in `run' /var/lib/gems/1.8/gems/chef-0.10.10/bin/chef-solo:25 /usr/local/bin/chef-solo:19:in `load' /usr/local/bin/chef-solo:19 [Sun, 20 May 2012 14:00:10 -0400] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out [Sun, 20 May 2012 14:00:10 -0400] DEBUG: Errno::ENOENT: No such file or directory - solo.rb /var/chef/cookbooks/ohai/recipes/default.rb:41:in `read' /var/chef/cookbooks/ohai/recipes/default.rb:41:in `from_file' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/cookbook_version.rb:578:in `load_recipe' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/mixin/language_include_recipe.rb:46:in `load_recipe' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/mixin/language_include_recipe.rb:33:in `include_recipe' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/mixin/language_include_recipe.rb:27:in `each' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/mixin/language_include_recipe.rb:27:in `include_recipe' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/run_context.rb:72:in `load' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/run_context.rb:69:in `each' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/run_context.rb:69:in `load' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/client.rb:199:in `setup_run_context' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/client.rb:162:in `run' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/application/solo.rb:207:in `run_application' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/application/solo.rb:195:in `loop' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/application/solo.rb:195:in `run_application' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/application.rb:70:in `run' /var/lib/gems/1.8/gems/chef-0.10.10/bin/chef-solo:25 /usr/local/bin/chef-solo:19:in `load' /usr/local/bin/chef-solo:19 [Sun, 20 May 2012 14:00:10 -0400] FATAL: Errno::ENOENT: No such file or directory - solo.rb 
+8
ubuntu nginx chef
source share
4 answers

This is due to the way the chef works. It changes the directory to / to avoid any permission problems, but that means plugins that need access to command line arguments will no longer know how to get to your relative paths.

There is a bug related to the chef code to solve the problem.

Using full paths for chef-solo arguments now fixes issues. For example.

 $ chef-solo -c /full/path/to/solo.rb -j /full/path/to/node.json -l debug 

Or, as someone else noted, deleting the /etc/chef/ohai_plugins/README also fix the problem. Although this is not so, because all that happens is the launch of updating the modification time in the ohai_plugins folder, the launch of the chef to restart everything. This functionality is not guaranteed and may break before the aforementioned error is fixed.

+15
source share

This seems to be a mistake with the chef and chef, I dug up a bit and discovered the error here: http://tickets.opscode.com/browse/COOK-1490?focusedCommentId=25572#comment-25572

As already suggested, a workaround is to use the absolute path to the config, any relative path has the same problem. This also happens whenever an ohai recipe is launched without modifying any plugins; it is not specific to the nginx cookbook.

+3
source share

The most likely problem is "/ etc / chef / ohai_plugins / README", which are recreated on every run. You just need to remove it before running the chef.

+2
source share

If chef-solo 0.10.10 could not find your solo.rb , it will complain about the following message at the beginning of your debug log:

 $ chef-solo -c solo.rb -l debug [2012-06-18T23:27:32+03:00] WARN: ***************************************** [2012-06-18T23:27:32+03:00] WARN: Did not find config file: solo.rb, using command line options. [2012-06-18T23:27:32+03:00] WARN: ***************************************** [2012-06-18T23:27:32+03:00] INFO: *** Chef 0.10.10 *** ... 

So, there is an error in the logic of recipes that somehow use this configuration file name.

0
source share

All Articles