Skip to content
This repository has been archived by the owner on Jul 14, 2021. It is now read-only.

chef exec rspec fails with 'Permission denied @ dir_s_mkdir' #135

Closed
sciurus opened this issue Aug 13, 2014 · 2 comments
Closed

chef exec rspec fails with 'Permission denied @ dir_s_mkdir' #135

sciurus opened this issue Aug 13, 2014 · 2 comments

Comments

@sciurus
Copy link

sciurus commented Aug 13, 2014

Strangely, the error references a ruby I installed via ruby-build rather than the one from chefdk.

Brianps-MacBook-Air:lp_elasticsearch brianp$ chef exec rspec
/Users/brianp/.rbenv/versions/2.1.1/lib/ruby/2.1.0/fileutils.rb:250:in `mkdir': Permission denied @ dir_s_mkdir - /opt/chefdk/embedded/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-13/2.1.0-static (Errno::EACCES)
    from /Users/brianp/.rbenv/versions/2.1.1/lib/ruby/2.1.0/fileutils.rb:250:in `fu_mkdir'
    from /Users/brianp/.rbenv/versions/2.1.1/lib/ruby/2.1.0/fileutils.rb:224:in `block (2 levels) in mkdir_p'
    from /Users/brianp/.rbenv/versions/2.1.1/lib/ruby/2.1.0/fileutils.rb:222:in `reverse_each'
    from /Users/brianp/.rbenv/versions/2.1.1/lib/ruby/2.1.0/fileutils.rb:222:in `block in mkdir_p'
    from /Users/brianp/.rbenv/versions/2.1.1/lib/ruby/2.1.0/fileutils.rb:208:in `each'
    from /Users/brianp/.rbenv/versions/2.1.1/lib/ruby/2.1.0/fileutils.rb:208:in `mkdir_p'
    from /Users/brianp/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/ext/builder.rb:210:in `write_gem_make_out'
    from /Users/brianp/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/ext/builder.rb:132:in `build_error'
    from /Users/brianp/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/ext/builder.rb:171:in `rescue in build_extension'
    from /Users/brianp/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/ext/builder.rb:156:in `build_extension'
    from /Users/brianp/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/ext/builder.rb:198:in `block in build_extensions'
    from /Users/brianp/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/ext/builder.rb:195:in `each'
    from /Users/brianp/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/ext/builder.rb:195:in `build_extensions'
    from /Users/brianp/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/specification.rb:1436:in `block in build_extensions'
    from /Users/brianp/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/user_interaction.rb:45:in `use_ui'
    from /Users/brianp/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/specification.rb:1434:in `build_extensions'
    from /Users/brianp/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/stub_specification.rb:60:in `build_extensions'
    from /Users/brianp/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/basic_specification.rb:56:in `contains_requirable_file?'
    from /Users/brianp/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:68:in `block in require'
    from /Users/brianp/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:67:in `each'
    from /Users/brianp/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:67:in `find'
    from /Users/brianp/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:67:in `require'
    from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-11.14.0.rc.2/lib/chef/log.rb:20:in `<top (required)>'
    from /Users/brianp/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:in `require'
    from /Users/brianp/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:in `require'
    from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-11.14.0.rc.2/lib/chef/config.rb:22:in `<top (required)>'
    from /Users/brianp/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:in `require'
    from /Users/brianp/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:in `require'
    from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-11.14.0.rc.2/lib/chef/client.rb:21:in `<top (required)>'
    from /Users/brianp/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:126:in `require'
    from /Users/brianp/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:126:in `require'
    from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chefspec-4.0.1/lib/chefspec/extensions/chef/client.rb:1:in `<top (required)>'
    from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chefspec-4.0.1/lib/chefspec.rb:3:in `require_relative'
    from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chefspec-4.0.1/lib/chefspec.rb:3:in `<top (required)>'
    from /Users/brianp/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in `require'
    from /Users/brianp/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
    from /Users/brianp/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:144:in `require'
    from /Users/brianp/Code/chef-repo/cookbooks/lp_elasticsearch/spec/spec_helper.rb:1:in `<top (required)>'
    from /Users/brianp/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/brianp/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/brianp/Code/chef-repo/cookbooks/lp_elasticsearch/spec/default_spec.rb:1:in `<top (required)>'
    from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.2/lib/rspec/core/configuration.rb:1057:in `load'
    from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.2/lib/rspec/core/configuration.rb:1057:in `block in load_spec_files'
    from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.2/lib/rspec/core/configuration.rb:1057:in `each'
    from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.2/lib/rspec/core/configuration.rb:1057:in `load_spec_files'
    from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.2/lib/rspec/core/runner.rb:97:in `setup'
    from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.2/lib/rspec/core/runner.rb:85:in `run'
    from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.2/lib/rspec/core/runner.rb:70:in `run'
    from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.2/lib/rspec/core/runner.rb:38:in `invoke'
    from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.2/exe/rspec:4:in `<top (required)>'
    from /Users/brianp/.rbenv/versions/2.1.1/bin/rspec:23:in `load'
    from /Users/brianp/.rbenv/versions/2.1.1/bin/rspec:23:in `<main>'

Brianps-MacBook-Air:lp_elasticsearch brianp$ chef exec env
TERM_PROGRAM=iTerm.app
GPG_AGENT_INFO=/tmp/gpg-UQkGOo/S.gpg-agent:409:1
SHELL=/bin/bash
TERM=xterm-256color
TMPDIR=/var/folders/3h/q29fx2hs6mld3xpgrjqp5wqr0000gp/T/
Apple_PubSub_Socket_Render=/tmp/launch-kg8hOT/Render
OLDPWD=/Users/brianp/Code/chef-repo/cookbooks/lp_elasticsearch/recipes
USER=brianp
SSH_AUTH_SOCK=/tmp/launch-LPxgUs/Listeners
__CF_USER_TEXT_ENCODING=0x1F6:0:0
__CHECKFIX1436934=1
PATH=/opt/chefdk/bin:/Users/brianp/.chefdk/gem/ruby/2.1.0/bin:/opt/chefdk/embedded/bin:/Users/brianp/.rbenv/shims:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin
PWD=/Users/brianp/Code/chef-repo/cookbooks/lp_elasticsearch
EDITOR=/usr/bin/vim
LANG=en_US.UTF-8
ITERM_PROFILE=Default
SHLVL=1
HOME=/Users/brianp
ITERM_SESSION_ID=w0t0p0
LOGNAME=brianp
DISPLAY=/tmp/launch-kGvXr0/org.macosforge.xquartz:0
_=/usr/bin/chef
GEM_ROOT="/opt/chefdk/embedded/lib/ruby/gems/2.1.0"
GEM_HOME=/opt/chefdk/embedded/lib/ruby/gems/2.1.0
GEM_PATH=/Users/brianp/.chefdk/gem/ruby/2.1.0:/opt/chefdk/embedded/lib/ruby/gems/2.1.0

Brianps-MacBook-Air:lp_elasticsearch brianp$ chef exec which rspec
/opt/chefdk/embedded/bin/rspec

Brianps-MacBook-Air:lp_elasticsearch brianp$ chef exec 'rspec -v'
3.0.2

Brianps-MacBook-Air:lp_elasticsearch brianp$ chef exec gem which rspec
Error loading RubyGems plugin "/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/yard-0.8.7.4/lib/rubygems_plugin.rb": Permission denied @ dir_s_mkdir - /opt/chefdk/embedded/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-13/2.1.0-static (Errno::EACCES)
ERROR:  While executing gem ... (Errno::EACCES)
    Permission denied @ dir_s_mkdir - /opt/chefdk/embedded/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-13/2.1.0-static

Brianps-MacBook-Air:~ brianp$ uname -a
Darwin Brianps-MacBook-Air.local 13.3.0 Darwin Kernel Version 13.3.0: Tue Jun  3 21:27:35 PDT 2014; root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64
@sciurus
Copy link
Author

sciurus commented Aug 13, 2014

After running eval "$(chef shell-init bash)" I can run rspec. Is this #103 ?

@danielsdeleo
Copy link
Contributor

I believe this is a combination of #103 triggering rubygems/rubygems#796 Since we've released ChefDK 0.2.1 which should fix the original cause, I'm going to close this. Comment on this ticket or open a new one if ChefDK 0.2.1 doesn't fix things for you.

@chef-boneyard chef-boneyard locked and limited conversation to collaborators Feb 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants