I am writing a simple recipe to create file like:
file '/myfile' do
content 'Welcome to Technical Guftgu'
action :create
end
but on chef-client -zr "recipe[test::recipe1]"
i am getting the following error:
[2022-03-08T10:54:16+00:00] ERROR: Running exception handlers
Running handlers complete
[2022-03-08T10:54:16+00:00] ERROR: Exception handlers complete
Chef Infra Client failed. 0 resources updated in 02 seconds
[2022-03-08T10:54:16+00:00] FATAL: Stacktrace dumped to /home/vagrant/.chef/local-mode-cache/cache/chef-stacktrace.out
[2022-03-08T10:54:16+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2022-03-08T10:54:16+00:00] FATAL: Errno::EACCES: file[/myfile] (test::recipe1 line 7) had an error: Errno::EACCES: Permission denied # rb_sysopen - /myfile
It seems that your app does not have access to the file /myfile.
Try this, to allow access to all: sudo chmod a+rw /myfile
Errno::EACCES Means "Permission Denied"
The Errno class is mapped to your system call errors at runtime. You can find this (confusingly) documented in:
SystemCallError#errno
Errno
In particular:
Errno.constants.include? :EACCES
#=> true
on most *nix sytems Errno::EACCES maps to the libc error code for "permission denied". Specifically:
Macro: int EACCES
"Permission denied." The file permissions do not allow the attempted operation.
That generally means your #create action doesn't have permissions to read, write, or traverse the path to the file you are trying to manage, so you need to change your implementation (which you don't show in your original post) to ensure that your Ruby process has the needed file or filesystem permissions to perform the requested operations.
See Also
Understanding Ruby's strange "Errno" exceptions
errno Lookup
errno.h from The Open Group Base Specifications Issue 7, 2018 edition
Related
This error message is displaying:
An unknown server-side error occurred while processing the command. Original error: Error executing adbExec. Original error: 'Command 'F:\\gautam\\android\\platform-tools\\adb.exe -P 5037 -s 192.168.0.115\:5555 shell settings delete global hidden_api_policy_pre_p_apps' exited with code 255'; Stderr: 'Security exception: Permission denial: writing to settings requires:android.permission.WRITE_SECURE_SETTINGS
java.lang.SecurityException: Permission denial: writing to settings requires:android.permission.WRITE_SECURE_SETTINGS
at com.android.providers.settings.SettingsProvider.enforceWritePermission(SettingsProvider.java:1815)
at com.android.providers.settings.SettingsProvider.mutateGlobalSetting(SettingsProvider.java:1023)
at com.android.providers.settings.SettingsProvider.deleteGlobalSetting(SettingsProvider.java:1006)
at com.android.providers.settings.SettingsProvider.delete(SettingsProvider.java:592)
at android.content.ContentProvider$Transport.delete(ContentProvider.java:343)
at com.android.providers.settings.SettingsService$MyShellCommand.deleteForUser(SettingsService.java:406)
at com.android.providers.settings.SettingsService$MyShellCommand.onCommand(SettingsService.java:289)
at android.os.ShellCommand.exec(ShellCommand.java:103)
at com.android.providers.settings.SettingsService.onShellCommand(SettingsService.java:51)
at android.os.Binder.shellCommand(Binder.java:634)
at android.os.Binder.onTransact(Binder.java:532)
at android.os.Binder.execTransact(Binder.java:735)'; Code: '255'`enter code here
An error tells you: Stderr: 'Security exception: Permission denial: writing to settings requires:android.permission.WRITE_SECURE_SETTINGS
Try following steps:
In your phone developer options (Security settings), enable USB Debugging or (or and) Disable permission monitoring. All of these settings are in your dev options.
Unable to download pdf generated with laravel 5 cashier and phantomjs. Throws following error:
ProcessFailedException in Process.php line 233: The command "/PROJECT/vendor/laravel/cashier/src/Laravel/Cashier/bin/linux-x86_64/phantomjs invoice.js /PROJECT/storage/framework/48dc273eaff3a0adaab8aa4f5b1d73df.pdf" failed.
Exit Code: 126(Invoked command cannot execute)
Output:
================
Error Output:
================
sh: 1: /PROJECT/vendor/laravel/cashier/src/Laravel/Cashier/bin/linux-x86_64/phantomjs: Permission denied
I checked storage/framework/ directory pdf has been created with permission 644 and www-data. My storage directory has 777 permission and user say xproject
Can anyone help me to get rid of this error?
I had exactly the same error and after much searching I found this post https://alfrednutile.info/posts/149 by Alfred Nutile
You solve the issue by adding execute permissions to the bin folder recursively:
chmod -R +x vendor/laravel/cashier/src/Laravel/Cashier/bin
On Ruby Im trying to fill a temporary file then rename it but getting permission errors on Windows.
File.rename("tempFile.csv", #data_file)
Error
Permission denied - tempFile.csv (Errno::EACCES)
Try to place
File.chmod(0755, "tempFile.csv") rescue nil
before
File.rename("tempFile.csv", #data_file)
I'm trying to use chef to check out a git repo to a windows client node.
This seems simple enough and I've got the following resource definition:
git "C:\\pathtocheckout" do
repo "https://gitserver/repo.git"
action [ :checkout, :sync]
end
But when this is reached by chef-client I get:
Errno::EIO: git[C:\pathtocheckout] (cookbook_name::test line 21) had an error: Errno::EIO: Input/output error - CreateProcessW
I've had a look at the stacktrace produced and it appears to be something to do with creating a process to run the git command - but this is the limit of my knowledge.
I've made sure git is installed on on Path, removed all other recipes from the run list, running as a different admin user and I've tried different repositories but all with the same error.
So I'm pretty stumped - anyone got a way I can dig into this error and see what is going on?
I've confirmed that I have permissions on the local box. Here is my default.rb in my Chef cookbook:
ruby_block "Copy Oracle Files" do
block do
require 'fileutils'
FileUtils.cp_r("#{node["server_files"]}","c:\\chef-tmp")
end
action :create
end
Here is the server_files dir: default["server_files"] = "\\\\winmomfs1\\3rdParty\\Oracle Client\\Oracle_11g\\win64_11gR2_client.zip"
And upon running chef-client on the node, I get:
[2013-12-20T12:51:45-05:00] INFO: Running queued delayed notifications before re-raising exception
[2013-12-20T12:51:45-05:00] ERROR: Running exception handlers
[2013-12-20T12:51:45-05:00] ERROR: Exception handlers complete
[2013-12-20T12:51:45-05:00] FATAL: Stacktrace dumped to c:/chef/cache/chef-stacktrace.out
Chef Client failed. 0 resources updated
[2013-12-20T12:51:45-05:00] FATAL: Errno::EACCES: ruby_block[Copy Oracle Files] (oracle::default line 9) had an error: Errno::EACCES: Permission denied - \\winmomfs1\3rdParty
\Oracle Client\Oracle_11g\win64_11gR2_client.zip
Any ideas why?