ERROR: [050]: unable to acquire lock on file '/tmp/pgbackrest/demo-archive.lock': Permission denied - postgresql-11

I have been trying to load data incrementally in postgres on linux(ubuntu) from the source (https://access.crunchydata.com/documentation/pgbackrest/2.00/pdf/backrest.pdf) while I am trying to create a stanza I am getting the following error.
As I am new to the Linux platform it has been taken more then 2 days and I couldn't solve it!
sudo -u postgres pgbackrest --stanza=demo --log-level-console=info stanza-create
2019-10-03 16:16:22.730 P00 INFO: stanza-create command begin 2.16: --log-level-console=info --pg1-path=/var/lib/postgresql/11/demo --repo1-path=/var/lib/pgbackrest --stanza=demo
ERROR: [050]: unable to acquire lock on file '/tmp/pgbackrest/demo-archive.lock': Permission denied
HINT: does the user running pgBackRest have permissions on the '/tmp/pgbackrest/demo-archive.lock' file?
2019-10-03 16:16:22.730 P00 INFO: stanza-create command end: aborted with exception [050]
ERROR: [050]: unable to acquire lock on file '/tmp/pgbackrest/demo-archive.lock': Permission denied
HINT: does the user running pgBackRest have permissions on the '/tmp/pgbackrest/demo-archive.lock' file?
2019-10-03 16:16:22.730 P00 INFO: stanza-create command end: aborted with exception [050]
What is the reason why this is showing and how to solve it?

I faced the same issue and solved by just deleting the temp folder and its files
sudo rm -r pgbackrest/
It worked for me.
Another possible solution is to delete the temp folder and stanza & re-create the stanza.

Related

AWS OpsWorks setup_failed for Instance - unable to deploy_branch

I've had a remote dashboard running fine for a couple of years (written for me by an external developer). It runs on an EC2 instance and is configured using OpsWorks.
Today it's not working, and I see in OpsWorks that the instance is showing as setup_failed.
According to the logs it fails here:
[2021-07-02T15:00:59+00:00] FATAL: Stacktrace dumped to /var/chef/runs/18bc4301-71c1-4393-bb26-eae958791d5a/local-mode-cache/cache/chef-stacktrace.out
[2021-07-02T15:00:59+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2021-07-02T15:00:59+00:00] ERROR: deploy_branch[/srv/api] (iparcelbox::deploy-api line 45) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '255'
---- Begin output of git fetch origin ----
STDOUT:
STDERR: error: cannot open .git/FETCH_HEAD: Permission denied
---- End output of git fetch origin ----
Ran git fetch origin returned 255
I've checked the recipe file for iparcelbox::deploy-api and line 45 calls a deploy_branch:
deploy_branch server_path do
user userName
group groupName
repository node[:iparcelbox][:git_url]
revision node[:iparcelbox][:revision]
enable_submodules false
migrate false
shallow_clone true
git_ssh_wrapper "/tmp/api_git_wrapper.sh"
rollback_on_error false
keep_releases 5
symlink_before_migrate.clear
purge_before_symlink purge_dirs
create_dirs_before_symlink []
symlinks({})
action :deploy
end
So as I understand it, the deploy_branch is trying to fetch a git repo, and for some reason it's failing? I've checked my GitHub repository for the source files and I can see an ssh 'Deploy Key' which is showing as used within the last week.
If anyone could give me any suggestions as to what else to try, it would be much appreciated!
I found an answer to this - I thought the issue was permission denied accessing the git repository, but actually it was because the destination folder on my instance had modified ownership. Setting the ownership back to that specified in the Chef recipe using chown allowed the setup to complete successfully.

Permission Error Running Container in AWS CodeBuild

I'm attempting to run the following command in CodeBuild:
- docker run --rm -v $(pwd)/SQL:/flyway/SQL -v $(pwd)/conf:/flyway/conf flyway/flyway -enterprise -url=jdbc:postgresql://xxx.xxx.us-east-1.rds.amazonaws.com:5432/hamshackradio -dryRunOutput="/flyway/SQL/output.sql" migrate
I get the following error:
ERROR: Unable to use /flyway/SQL/output.sql as a dry run output:
/flyway/SQL/output.sql (Permission denied) Caused by:
java.io.FileNotFoundException: /flyway/SQL/output.sql (Permission
denied)
The goal is to capture the output.sql file. Running the exact same command locally on Windows (adjusting the paths of course) works without error. The issue isn't Flyway or the overall command structure. It's something to do with the internals of running the Docker container on Ubuntu on AWS CodeBuild and permissions there (maybe permissions, maybe something else, I'm open).
Does anyone have a good idea on how to address this?
The container doesn't have write access to the host. You could try the following, which saves the artifact to the container and uses docker cp to copy the artifact to the host.
container=$(docker create -v <flywaymigrationspathonhost>:/flyway/sql flyway/flyway migrate -dryRunOutput=/flyway/reports/changes.sql -schemas=dbo -user=youruser -password=yourpass -url=<yourjdbcurl> -licenseKey=<licensekey>)
docker start -a ${container}
docker cp ${container}:/flyway/reports/changes.sql <hostpath>
You need to enable Privileged Mode for your CodeBuild project.

Initd permission denied

I'm new to Linux and AWS I'm trying to set up an initd script as this code in this gist but getting the following error message, which I think related to permissions but I don't understand what thing needs permissions where.
env: /etc/init.d/geoserver: Permission denied
I've tried the following to resolve it;
[ec2-user#ip-xxx init.d]$ sudo chmod +x geoserver start
[ec2-user#ip-xxx init.d]$ service geoserver start
Starting geoserver...
/etc/init.d/geoserver: line 33: /run/geoserver.pid: Permission denied
EDIT: The machine is AWS Linux 2 RHEL 7.6 Maipo

Raspberry [Errno 13] permission denied opening file txt

I am using a raspberry pi 3 with Jessie.
In my code, I need to read a file.txt in a loop but i got the error N13 saying Permission denied: 'file.txt'.
I am running the code using thonny.
Any solution ?
i solved from cmd window tiping sudo python3 filename.py
but i need to do it everytime i want to launch the code, there is a way to make it definitive?
Check FILE PERMISSIONS.
Do it from root.
Whenever there is permission denied error appears/occurs, its either file permissions in case of files or wrong password entered.

Xcode 4 and cocos2D 1.0.0 beta Uncategorized errors and Info.plist doesn't exist

I just installed the xcode 4 sdk and the cocos2d 1.0.0 beta template.
I just created a new project with the cocos2d template.
But when I build I got these errors :
(for information my previous projects developed with xcode 3 have the same problem)
warning: couldn't add 'com.apple.XcodeGenerated' tag to '/Users/Benoit/Library/Developer/Xcode/DerivedData/xcode4-bswxazfuwbsguiasyatbtlmvbpps/Build/Intermediates/xcode4.build': Error Domain=NSPOSIXErrorDomain Code=2 UserInfo=0x201dde680 "The operation couldn’t be completed. No such file or directory"
error: unable to create '/Users/Benoit/Library/Developer/Xcode/DerivedData/xcode4-bswxazfuwbsguiasyatbtlmvbpps/Build/Intermediates' (Permission denied)
error: unable to create '/Users/Benoit/Library/Developer/Xcode/DerivedData/xcode4-bswxazfuwbsguiasyatbtlmvbpps/Build/Products' (Permission denied)
Unable to create directory /Users/Benoit/Library/Developer/Xcode/DerivedData/xcode4-bswxazfuwbsguiasyatbtlmvbpps/Build/Intermediates/xcode4.build/Debug-iphonesimulator/xcode4.build/Objects-normal/i386
Unable to create directory /Users/Benoit/Library/Developer/Xcode/DerivedData/xcode4-bswxazfuwbsguiasyatbtlmvbpps/Build/PrecompiledHeaders/Prefix-dflnzjtztxdgjwhistrvvjxetfrg
Unable to create directory /Users/Benoit/Library/Developer/Xcode/DerivedData/xcode4-bswxazfuwbsguiasyatbtlmvbpps/Build/Intermediates/xcode4.build/Debug-iphonesimulator/xcode4.build
Unable to create directory /Users/Benoit/Library/Developer/Xcode/DerivedData/xcode4-bswxazfuwbsguiasyatbtlmvbpps/Build/Intermediates/xcode4.build/Debug-iphonesimulator/xcode4.build
Unable to create directory /Users/Benoit/Library/Developer/Xcode/DerivedData/xcode4-bswxazfuwbsguiasyatbtlmvbpps/Build/Intermediates/xcode4.build/Debug-iphonesimulator/xcode4.build
Unable to create directory /Users/Benoit/Library/Developer/Xcode/DerivedData/xcode4-bswxazfuwbsguiasyatbtlmvbpps/Build/Intermediates/xcode4.build/Debug-iphonesimulator/xcode4.build
Unable to create directory /Users/Benoit/Library/Developer/Xcode/DerivedData/xcode4-bswxazfuwbsguiasyatbtlmvbpps/Build/PrecompiledHeaders/Prefix-fqemzerugrwojibbegzkffljkxqs
Unable to create directory /Users/Benoit/Library/Developer/Xcode/DerivedData/xcode4-bswxazfuwbsguiasyatbtlmvbpps/Build/Intermediates/xcode4.build/Debug-iphonesimulator/xcode4.build
Unable to create directory /Users/Benoit/Library/Developer/Xcode/DerivedData/xcode4-bswxazfuwbsguiasyatbtlmvbpps/Index/PrecompiledHeaders/Prefix-dbtcglhksokwygezixirqkgfipsr_ast
Unable to create directory /Users/Benoit/Library/Developer/Xcode/DerivedData/xcode4-bswxazfuwbsguiasyatbtlmvbpps/Index/PrecompiledHeaders/Prefix-gdirtpasdqzasnclnkzguimarjpd_ast
error: couldn't create directory /Users/Benoit/Library/Developer/Xcode/DerivedData/xcode4-bswxazfuwbsguiasyatbtlmvbpps/Build/Products/Debug-iphonesimulator/xcode4.app: Permission denied
error: couldn't create directory /Users/Benoit/Library/Developer/Xcode/DerivedData/xcode4-bswxazfuwbsguiasyatbtlmvbpps/Build/Products/Debug-iphonesimulator/xcode4.app: Permission denied
The file “Info.plist” doesn’t exist.
Please help !!
I've just experienced the same issue - check the permissions on the directory:
/Users/Benoit/Library/Developer/Xcode/
In my case it was owned by root (which I suspect was as a result of installing the cocos2d templates before a fresh install of Xcode - but could be wrong). Changing it to be owned by my user fixed the issue, or in your case:
sudo chown Benoit /Users/Benoit/Library/Developer/Xcode/
Hope that helps.
Nick