When running chef-client as non root user, you may encounter the following error:
==============================
Error Syncing Cookbooks:
=============================
Unexpected Error:
-----------------
ArgumentError: could not find a temporary directory
Platform:
---------
x86_64-linux
In the stacktrace, the error shows up as:
ArgumentError: could not find a temporary directory
/opt/chef/embedded/lib/ruby/2.1.0/tmpdir.rb:34:in `tmpdir'
/opt/chef/embedded/lib/ruby/2.1.0/tmpdir.rb:105:in `tmpdir'
/opt/chef/embedded/lib/ruby/2.1.0/tmpdir.rb:137:in `create'
/opt/chef/embedded/lib/ruby/2.1.0/tempfile.rb:136:in `initialize'
/opt/chef/embedded/lib/ruby/2.1.0/tempfile.rb:320:in `new'
/opt/chef/embedded/lib/ruby/2.1.0/tempfile.rb:320:in `open'
Solution:
This is not a CHEF issue rather a ruby one. Newer versions of ruby do not allow any directory to be used as a temporary directory that has (777) permissions set on it unless setuid of 1 is set on the directory too. As root user do the following:
chmod 1777 /tmp
ls -ld /tmp drwxrwxrwt. /tmp
notice the "t" in the output.
==============================
Error Syncing Cookbooks:
=============================
Unexpected Error:
-----------------
ArgumentError: could not find a temporary directory
Platform:
---------
x86_64-linux
In the stacktrace, the error shows up as:
ArgumentError: could not find a temporary directory
/opt/chef/embedded/lib/ruby/2.1.0/tmpdir.rb:34:in `tmpdir'
/opt/chef/embedded/lib/ruby/2.1.0/tmpdir.rb:105:in `tmpdir'
/opt/chef/embedded/lib/ruby/2.1.0/tmpdir.rb:137:in `create'
/opt/chef/embedded/lib/ruby/2.1.0/tempfile.rb:136:in `initialize'
/opt/chef/embedded/lib/ruby/2.1.0/tempfile.rb:320:in `new'
/opt/chef/embedded/lib/ruby/2.1.0/tempfile.rb:320:in `open'
Solution:
This is not a CHEF issue rather a ruby one. Newer versions of ruby do not allow any directory to be used as a temporary directory that has (777) permissions set on it unless setuid of 1 is set on the directory too. As root user do the following:
chmod 1777 /tmp
ls -ld /tmp drwxrwxrwt. /tmp
notice the "t" in the output.
No comments:
Post a Comment