Windows + B2 Settings

Okay, I have to be missing something simple, and I’m going to feel dumb once someone tells me how… but I’ve looked all over the place and can’t figure it out. I’ve been using restic awhile on my Mac and love it. It’s so simple - but for the life of me can’t even initialize a repo on Windows lol.

I’m stuck setting the B2 variables in the first place. On a Mac, it’s a simple

export B2_ACCOUNT_ID=“myid”
export B2_ACCOUNT_KEY=“mysecretkey”

On Windows? Obviously “export” doesn’t work. I thought it would be SET… but nope. I’ve tried setting environment variables through the Windows GUI. From my searches I’m apparently the only person having this problem. I’m an idiot and can’t figure it out. Please help lol

Can you show us the batch file you’ve been working on (redacting the credentials, of course)?

No batch file as of yet. I’m not even past initializing the repo in the first place lol

I’ve just tried export B2_ACCOUNT_ID=“myid” and got an error saying that was a bad command. Since the “export” command doesn’t seem to work, I thought SET would do the trick and did SET B2_ACCOUNT_ID=“myid”. But after restic -r b2:bucket:test init I got “Fatal: unable to open B2 backend: Key ($B2_ACCOUNT_KEY) is empty.” So then I tried SET $B2_ACCOUNT_ID=“myid” and then I tried it without quotes around the ID. Then I googled and searched the forums and eventually posted here.

So, in short… I tried:

export B2_ACCOUNT_ID=“myid”
SET B2_ACCOUNT_ID=“myid”
SET B2_ACCOUNT_ID=myid
SET $B2_ACCOUNT_ID=“myid”
SET $B2_ACCOUNT_ID=myid

And after all of that, I tried restic -r b2:bucket:test init and got:
Fatal: unable to open B2 backend: Key ($B2_ACCOUNT_KEY) is empty.

I also tried going to Advanced System Settings > Advanced > Environment Variables and putting them in both the User and System variables, but received the same error.

Really, if anyone could just walk me through initializing a repo on Windows for the first time, that’d probably be enough to get me going. I don’t know what I’m doing wrong. It’s got to be something dumb I’m overlooking (or I’m just plain doing it wrong). I wish I could just use a config file or pass all of this through the command line as switches (if I can, I don’t know how). It’s the “export” bit that’s messing me up. I don’t know what the Windows equivalent is.

The error message seems pretty self-explanatory. You set B2_ACCOUNT_ID but you never set B2_ACCOUNT_KEY. Both must be set.

Oh god, I knew I was overlooking something painfully obvious. I just knew it. It’s been one of those days.

I was reading “B2_ACCOUNT_KEY” as “B2_ACCOUNT_ID” and thinking it never got past the ID. I could have sworn I put in the KEY part too, but apparently not. Yep, confirmed, I’m an idiot lol.

Thanks a bunch! :slight_smile:

1 Like

No worries, it happens to the best of us. Glad you got it working!

New dumb question - how do you show the upload speed? I tried -v and that’s showing time, percentage, files, size, etc but no speed?

That’s not implemented (yet), sorry. We had a “processed bytes per second” indicator a while back, but that was very misleading as deduplication led to highly unusable values (like “23GiB/s”). We have plans to add the bandwidth to/from the backend, but no efforts have been made in that direction.

Hi,

I’m running into the same issue on Windows 7.

Can you please tell me which SET command worked for you?

Thanks.

Windows:

  • SET B2_ACCOUNT_ID=xxxxxx
  • SET B2_ACCOUNT_KEY=xxxxxx
  • SET RESTIC_REPOSITORY=b2:xxx
  • SET RESTIC_PASSWORD=xxxxxxx

Mac:

  • export B2_ACCOUNT_ID= xxxxxx
  • export B2_ACCOUNT_KEY= xxxxxx
  • export RESTIC_REPOSITORY=b2:xxx
  • export RESTIC_PASSWORD= xxxxxx

I think capitalization matters in both. Including the “SET” and “export” commands. Might be wrong.

Also the “b2” is just because I use Backblaze.

What I do here is to monitor the ethernet port of the affected server, but then I have a dedicated server just for the backups.

You could also runrclone about twice on your B2 remote, separated by 30 secs or what have you, and calculate (size2 - size1) / 30, I do it here when I need a longer average (say, hourly or for the entire duration of the backup).

Cheers,
– Durval.

1 Like

The only thing that’s case sensitive on Windows is the actual value. The “set” command and the variable names are not case-sensitive.

Everything in these commands is case sensitive on Mac/Linux.

1 Like