Skip to content

Fails with: the enclosing directory /root/.chef/state/cache does not exist #2

Closed
hedgehog opened this Issue Feb 9, 2012 · 6 comments

2 participants

@hedgehog
hedgehog commented Feb 9, 2012

I bootstrap rbenv+ruby+bundler+chef as a user install under /root/.rbenv, then invoke a chef-solo run to install system wide.
The apt cache-client recipe installs fine, so chef seems to run fine fine.

At the ruby_build install stage this happens:

[Thu, 09 Feb 2012 12:28:45 +1100] INFO: Processing package[tar] action install (ruby_build::default line 34)
[Thu, 09 Feb 2012 12:28:45 +1100] INFO: Processing package[bash] action install (ruby_build::default line 34)
[Thu, 09 Feb 2012 12:28:45 +1100] INFO: Processing package[curl] action install (ruby_build::default line 34)
[Thu, 09 Feb 2012 12:28:45 +1100] INFO: Processing package[git-core] action install (ruby_build::default line 34)
[Thu, 09 Feb 2012 12:28:45 +1100] INFO: Processing execute[Install ruby-build] action nothing (ruby_build::default line 38)
[Thu, 09 Feb 2012 12:28:45 +1100] INFO: Processing git[/root/.chef/state/cache/ruby-build] action checkout (ruby_build::default line 48)
[Thu, 09 Feb 2012 12:28:45 +1100] ERROR: git[/root/.chef/state/cache/ruby-build] (ruby_build::default line 48) has had an error
[Thu, 09 Feb 2012 12:28:45 +1100] ERROR: git[/root/.chef/state/cache/ruby-build] (/home/hedge/personal-chef/cookbooks/ruby_build/recipes/default.rb:48:in `from_file') had an error:
git[/root/.chef/state/cache/ruby-build] (ruby_build::default line 48) had an error: Chef::Exceptions::MissingParentDirectory: Cannot clone git[/root/.chef/state/cache/ruby-build] to /root/.chef/state/cache/ruby-build, the enclosing directory /root/.chef/state/cache does not exist
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/provider/git.rb:81:in `assert_target_directory_valid!'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/provider/git.rb:39:in `action_checkout'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/resource.rb:440:in `run_action'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/runner.rb:45:in `run_action'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/runner.rb:81:in `block (2 levels) in converge'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/runner.rb:81:in `each'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/runner.rb:81:in `block in converge'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/resource_collection.rb:94:in `block in execute_each_resource'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/resource_collection/stepable_iterator.rb:116:in `call'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/resource_collection/stepable_iterator.rb:104:in `iterate'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/resource_collection.rb:92:in `execute_each_resource'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/runner.rb:76:in `converge'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/client.rb:312:in `converge'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/client.rb:160:in `run'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/application/solo.rb:192:in `block in run_application'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/application/solo.rb:183:in `loop'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/application/solo.rb:183:in `run_application'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/lib/chef/application.rb:67:in `run'
/home/hedge/personal-chef/vendor/ruby/1.9.1/gems/chef-0.10.8/bin/chef-solo:25:in `<top (required)>'
/home/hedge/personal-chef/vendor/ruby/1.9.1/bin/chef-solo:19:in `load'
/home/hedge/personal-chef/vendor/ruby/1.9.1/bin/chef-solo:19:in `<main>'
[Thu, 09 Feb 2012 12:28:45 +1100] ERROR: Running exception handlers
[Thu, 09 Feb 2012 12:28:45 +1100] ERROR: Exception handlers complete
[Thu, 09 Feb 2012 12:28:45 +1100] FATAL: Stacktrace dumped to /root/.chef/state/cache/chef-stacktrace.out
[Thu, 09 Feb 2012 12:28:45 +1100] FATAL: Chef::Exceptions::MissingParentDirectory: git[/root/.chef/state/cache/ruby-build] (ruby_build::default line 48) had an error: Chef::Exceptions::MissingParentDirectory: Cannot clone git[/root/.chef/state/cache/ruby-build] to /root/.chef/state/cache/ruby-build, the enclosing directory /root/.chef/state/cache does not exist
@hedgehog
hedgehog commented Feb 9, 2012

A second run seems to get further:

[Thu, 09 Feb 2012 12:36:39 +1100] INFO: Processing execute[Install ruby-build] action nothing (ruby_build::default line 38)
[Thu, 09 Feb 2012 12:36:39 +1100] INFO: Processing git[/root/.chef/state/cache/ruby-build] action checkout (ruby_build::default line 48)
[Thu, 09 Feb 2012 12:36:39 +1100] INFO: git[/root/.chef/state/cache/ruby-build] cloning repo git://github.com/sstephenson/ruby-build.git to /root/.chef/state/cache/ruby-build
[Thu, 09 Feb 2012 12:36:39 +1100] INFO: git[/root/.chef/state/cache/ruby-build] sh(git clone  git://github.com/sstephenson/ruby-build.git /root/.chef/state/cache/ruby-build)
Cloning into '/root/.chef/state/cache/ruby-build'...
[Thu, 09 Feb 2012 12:36:43 +1100] INFO: git[/root/.chef/state/cache/ruby-build] checked out branch: master reference: 365225f2abcbbe86b6c7df9a548dade42a69e3c5
[Thu, 09 Feb 2012 12:36:43 +1100] INFO: git[/root/.chef/state/cache/ruby-build] sending run action to execute[Install ruby-build] (immediate)
[Thu, 09 Feb 2012 12:36:43 +1100] INFO: Processing execute[Install ruby-build] action run (ruby_build::default line 38)
[Thu, 09 Feb 2012 12:36:43 +1100] INFO: Processing package[git-core] action install (rbenv::system_install line 43)
[Thu, 09 Feb 2012 12:36:43 +1100] INFO: Processing package[grep] action install (rbenv::system_install line 43)
[Thu, 09 Feb 2012 12:36:43 +1100] INFO: Processing template[/etc/profile.d/rbenv.sh] action create (rbenv::system_install line 29)
[Thu, 09 Feb 2012 12:36:43 +1100] INFO: template[/etc/profile.d/rbenv.sh] mode changed to 755
[Thu, 09 Feb 2012 12:36:43 +1100] INFO: template[/etc/profile.d/rbenv.sh] updated content
[Thu, 09 Feb 2012 12:36:43 +1100] INFO: Processing git[/usr/local/rbenv] action checkout (rbenv::system_install line 61)
[Thu, 09 Feb 2012 12:36:43 +1100] INFO: git[/usr/local/rbenv] cloning repo git://github.com/sstephenson/rbenv.git to /usr/local/rbenv
[Thu, 09 Feb 2012 12:36:43 +1100] INFO: git[/usr/local/rbenv] sh(git clone  git://github.com/sstephenson/rbenv.git /usr/local/rbenv)
Cloning into '/usr/local/rbenv'...
[Thu, 09 Feb 2012 12:36:49 +1100] INFO: git[/usr/local/rbenv] checked out branch: master reference: e899f1d31c9f3d976a3a40ab73e845d386e5e3e8
[Thu, 09 Feb 2012 12:36:49 +1100] INFO: Processing bash[Initialize rbenv (system)] action run (rbenv::system_install line 80)
[Thu, 09 Feb 2012 12:36:49 +1100] INFO: bash[Initialize rbenv (system)] sh("bash"  "/tmp/chef-script20120209-28517-11gxn3b")
export PATH="/usr/local/rbenv/shims:${PATH}"
source "/usr/local/rbenv/libexec/../completions/rbenv.bash"
rbenv rehash 2>/dev/null
rbenv() {
  command="$1"
  if [ "$#" -gt 0 ]; then
    shift
  fi

  case "$command" in
  shell)
    eval `rbenv "sh-$command" "$@"`;;
  *)
    command rbenv "$command" "$@";;
  esac
}
[Thu, 09 Feb 2012 12:36:49 +1100] INFO: bash[Initialize rbenv (system)] ran successfully
[Thu, 09 Feb 2012 12:36:49 +1100] INFO: Chef Run complete in 10.326871398 seconds
[Thu, 09 Feb 2012 12:36:49 +1100] ERROR: Running exception handlers
[Thu, 09 Feb 2012 12:36:49 +1100] ERROR: Exception handlers complete
[Thu, 09 Feb 2012 12:36:49 +1100] FATAL: Stacktrace dumped to /root/.chef/state/cache/chef-stacktrace.out
[Thu, 09 Feb 2012 12:36:49 +1100] FATAL: Errno::EISDIR: Is a directory - /root/.chef/state/cache/ruby-build

The chef-stacktrace.out is:

Generated at 2012-02-09 12:46:05 +1100
Errno::EISDIR: Is a directory - /root/.chef/state/cache/ruby-build
/root/.rbenv/versions/1.9.2-p290/lib/ruby/1.9.1/fileutils.rb:1314:in `unlink'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/1.9.1/fileutils.rb:1314:in `block in remove_file'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/1.9.1/fileutils.rb:1319:in `platform_support'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/1.9.1/fileutils.rb:1313:in `remove_file'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/1.9.1/fileutils.rb:781:in `remove_file'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/1.9.1/fileutils.rb:559:in `block in rm'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/1.9.1/fileutils.rb:558:in `each'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/1.9.1/fileutils.rb:558:in `rm'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/checksum_cache.rb:97:in `remove_unused_checksum'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/checksum_cache.rb:85:in `block in cleanup_checksum_cache'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/checksum_cache.rb:83:in `each'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/checksum_cache.rb:83:in `cleanup_checksum_cache'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/checksum_cache.rb:92:in `block in <class:ChecksumCache>'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/client.rb:103:in `call'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/client.rb:103:in `block in run_completed_successfully'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/client.rb:102:in `each'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/client.rb:102:in `run_completed_successfully'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/client.rb:165:in `run'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/application/solo.rb:192:in `block in run_application'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/application/solo.rb:183:in `loop'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/application/solo.rb:183:in `run_application'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/application.rb:67:in `run'
/root/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/chef-0.10.8/bin/chef-solo:25:in `<top (required)>'
/root/.rbenv/versions/1.9.2-p290/bin/chef-solo:19:in `load'
/root/.rbenv/versions/1.9.2-p290/bin/chef-solo:19:in `<main>'
/root/.chef/state/cache/chef-stacktrace.out
@hedgehog
hedgehog commented Feb 9, 2012

I think this might the source of the grief:

http://tickets.opscode.com/browse/CHEF-2786

Correct?

@hedgehog hedgehog added a commit to hedgehog/chef-ruby_build that referenced this issue Feb 9, 2012
@hedgehog hedgehog A workaround that closes issue #2 3ad5860
@fnichol fnichol closed this in 802a30f Feb 19, 2012
@fnichol
Owner
fnichol commented Feb 19, 2012

Thanks, I didn't know about that client/solo issue concerning Chef::Config[:file_cache_path]. Do you think the above commit gets the job done (ensures that the git clone's parent directory exists)?

@hedgehog

Just to clarify this comment relates to the second run results posted. The patch might be enough to eliminate behavior see on the first run, but likely not change the behavior seen on the second run.

I didn't think it was a problem of dir existence, but rather that client/solo tries to rm a link and finds a directory - so in some sense existence of the directory caused the problem.

But I'm just reading the caller history above - there may be some internals that mean your patch results in the link existing and rm succeeding - I just don't see it.

@fnichol fnichol reopened this Feb 21, 2012
@hedgehog hedgehog added a commit to hedgehog/chef-ruby_build that referenced this issue Jun 4, 2012
@hedgehog hedgehog issue #2 workaround 6e58d7b
@fnichol
Owner
fnichol commented May 22, 2013

Hey @hedgehog, think this is still a current issue?

@fnichol
Owner
fnichol commented May 23, 2013

Hoping this is resolved, but if not please re-open. Thanks!

@fnichol fnichol closed this May 23, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.