Restic init attempt on backblaze returns 401 with no error message

First attempt to use restic with backblaze per this blog article:

When I try to init the repository, restic returns a 401:

$ restic -r b2:oryxBackup2 init
Fatal: create repository at b2:oryxBackup2 failed: b2.NewClient: b2_authorize_account: 

I have followed the blog instructions and properly exported a key_id and key that I’ve created on backblaze.

I would expect a more specific message after the 401:, but there is none, so I don’t know quite where to take it from here to troubleshoot.

$ restic version
restic 0.9.5 compiled with go1.12.4 on linux/amd64

Any help appreciated!

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?

(Don’t paste the results here, though!)

echo \"$B2_ACCOUNT_ID\"
echo \"$B2_ACCOUNT_KEY\"

Hi cdhowie, thanks for the response.

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.

Argh, feeling a little silly now, I was trying to use an old key. Thanks for pointing me back to verifying my credentials!

1 Like

Hello @sdanieru, and welcome to the forum!

Don’t feel so bad, it happens to the best of us :wink: And thanks for keeping the topic posted. Perhaps mark it also as “Solved” would be a good idea?

– Durval.