401 is the HTTP code for “unauthorized,” which is coming from B2 – it is rejecting your credentials, or the credentials were not supplied. If you run the following two commands, do you see the expected key ID and secret? Are there any spaces around the double quotes in the output?
Yep, my first thought was to double-check that my key_id and key were in their proper vars for restic to pick up, and they are in place as you suggested to check. Perhaps worth noting that it is an ‘Application Key’ in my backblaze acct, and has full permissions to do whatever it needs to do, so it’s puzzling that backblaze is returning a 401. Also, am I right in assuming that there should be some type of error msg following the “401:”?
To my knowledge, B2 returns 403 when the provided key does not have access to perform the requested operation. 401 indicates that there is a problem with the credentials themselves.
Hi everyone
I have a similar problem, but not exactly the same. I get a 401 error when restic tries to remove the lock:
I first checked if the repository exist, then I created the repository and finally I tried to show the snapshots again. The same issue appears when I backup a file/directory or show the master key for example.
root@587469b95e8b:~# restic snapshots
Fatal: unable to open config file: Stat: b2_download_file_by_name: 404: File with such name does not exist.
Is there a repository at the following location?
b2:pg-backup:backup-test-restic-1/
root@587469b95e8b:~# echo $?
1
root@587469b95e8b:~# restic init
created restic repository feaa0ba007 at b2:pg-backup:backup-test-restic-1/
Please note that knowledge of your password is required to access
the repository. Losing your password means that your data is
irrecoverably lost.
root@587469b95e8b:~# restic snapshots
repository feaa0ba0 opened successfully, password is correct
created new cache in /app/pg-backup/.cache/restic
Remove(<lock/c887ed5465>) returned error, retrying after 552.330144ms: Delete: b2_delete_file_version: 401:
Remove(<lock/c887ed5465>) returned error, retrying after 1.080381816s: Delete: b2_delete_file_version: 401:
Remove(<lock/c887ed5465>) returned error, retrying after 1.31013006s: Delete: b2_delete_file_version: 401:
Remove(<lock/c887ed5465>) returned error, retrying after 1.582392691s: Delete: b2_delete_file_version: 401:
Remove(<lock/c887ed5465>) returned error, retrying after 2.340488664s: Delete: b2_delete_file_version: 401:
Remove(<lock/c887ed5465>) returned error, retrying after 4.506218855s: Delete: b2_delete_file_version: 401:
Remove(<lock/c887ed5465>) returned error, retrying after 3.221479586s: Delete: b2_delete_file_version: 401:
Remove(<lock/c887ed5465>) returned error, retrying after 5.608623477s: Delete: b2_delete_file_version: 401:
Remove(<lock/c887ed5465>) returned error, retrying after 7.649837917s: Delete: b2_delete_file_version: 401:
Remove(<lock/c887ed5465>) returned error, retrying after 15.394871241s: Delete: b2_delete_file_version: 401:
Remove(<lock/c887ed5465>) returned error, retrying after 507.606314ms: Delete: b2_delete_file_version: 401:
Remove(<lock/c887ed5465>) returned error, retrying after 985.229971ms: Delete: b2_delete_file_version: 401:
Remove(<lock/c887ed5465>) returned error, retrying after 803.546856ms: Delete: b2_delete_file_version: 401:
Remove(<lock/c887ed5465>) returned error, retrying after 1.486109007s: Delete: b2_delete_file_version: 401:
Remove(<lock/c887ed5465>) returned error, retrying after 2.070709754s: Delete: b2_delete_file_version: 401:
Remove(<lock/c887ed5465>) returned error, retrying after 3.67875363s: Delete: b2_delete_file_version: 401:
Remove(<lock/c887ed5465>) returned error, retrying after 4.459624189s: Delete: b2_delete_file_version: 401:
Remove(<lock/c887ed5465>) returned error, retrying after 6.775444383s: Delete: b2_delete_file_version: 401:
Remove(<lock/c887ed5465>) returned error, retrying after 15.10932531s: Delete: b2_delete_file_version: 401:
Remove(<lock/c887ed5465>) returned error, retrying after 13.811796615s: Delete: b2_delete_file_version: 401:
error in cleanup handler: Delete: b2_delete_file_version: 401:
I configured the credentials and the repository via environment variables.
The account I use has the following capabilities in b2:
writeFiles,readFiles,listFiles,deleteFiles