Chef-client failing while running from user 'oracle'. Running fine while running as 'root' user


#1

$ chef-client

/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/config_fetcher.rb:58:in realpath': Permission denied @ realpath_rec - /etc/chef/client.rb (Errno::EACCES) from /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/config_fetcher.rb:58:inrealpath’
from /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/config_fetcher.rb:58:in config_missing?' from /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/application.rb:107:inload_config_file’
from /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/application/client.rb:389:in load_config_file' from /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/application.rb:90:inconfigure_chef’
from /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/application.rb:48:in reconfigure' from /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/application/client.rb:313:inreconfigure’
from /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/application.rb:57:in run' from /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/bin/chef-client:26:in<top (required)>'
from /bin/chef-client:58:in load' from /bin/chef-client:58:in'
$


#2

If you use chef-client as a user other than root you are also responsible for setting the permissions to the configuration files and paths as appropriate. This error just means that the user doesn’t have sufficient access to that file so that needs to be resolved. Chef expects to be run as root so if using it as another user, unexpected behaviour might be experienced if the user under which it is running is not configured properly to have elevated permissions for common system tasks.

Cheers,