cupcakearmy / autorestic

Config driven, easy backup cli for restic.
https://autorestic.vercel.app/
Apache License 2.0
1.16k stars 68 forks source link

copy to backblaze fails #219

Open cschritt opened 1 year ago

cschritt commented 1 year ago

autorestic version: 1.7.1 restic version: 0.13.1

backends:
  local:
    type: local
    path: /backup/data
    key: $KEY
  backblaze:
    type: b2
    path: '$PATH'
    key: $KEY
    env:
      B2_ACCOUNT_ID: '$ID'
      B2_ACCOUNT_KEY: '$KEY'

locations:
  data:
    from:
    - /data
    to:
    - local
    copy:
      local: 
        - backblaze

With this config on an initialized b2 repository, the copy fails for no apparent reason.

user@host:~> autorestic -c .config/restic/autorestic.yaml backup --ci --verbose --all
Backend: local
> Executing: /usr/local/bin/restic backup --tag ar:location:data /data
using parent snapshot xxx

Files:           0 new,     0 changed, xxx unmodified
Dirs:            0 new,     0 changed,  xxx unmodified
Added to the repo: 0 B

snapshot xxx of [/data] at 2022-08-17 20:24:20.645239574 +0200 CEST)
  copy started, this may take a while...
snapshot xxx saved
Copying local → backblaze
> Executing: /usr/local/bin/restic copy xxx

Running hooks
[...]
exit status 1

Is there any way to debug this further?

rdelaage commented 1 year ago

I think it's a problem with restic since autorestic just call the restic binary with the proper arguments

cupcakearmy commented 1 year ago

Have you run check?

vinaydawani commented 1 year ago

Ran into this issue as well. Using check says it's initializing but still fails

 autorestic check --verbose 2 -c ~/server/backup/.autorestic.yml
Using config:    ~/server/backup/.autorestic.yml
Using lock:      ~/server/backup/.autorestic.lock.yml
> Executing: /usr/local/bin/restic check
> Executing: /usr/local/bin/restic check
Initializing backend "backblaze"...
> Executing: /usr/local/bin/restic init
Error: exit status 1

I have pretty much the same config as OP

scubao commented 11 months ago

Got the same issue - backup to backblaze is fine, when i try copy it fails. Unfortunately there is no proper error log / message.

alvaro17f commented 11 months ago

Got the same issue too.

I'm on Arch Linux, and I can see that using version 1.7.4.-1 it was working fine. Since then, it started to error.

hogcycle commented 6 months ago

Got this too.

cschritt commented 6 months ago

I finally got to take a closer look at this again. restic recommends to use the s3 API for backblaze now in their docs https://restic.readthedocs.io/en/latest/030_preparing_a_new_repo.html#backblaze-b2

I tested this method and it is working without any issues for me. Heres an example config. Don't be confused by the AWS_ variables. Put in the values for the Backblaze API.

[...]
backends:
    backblaze_b2:
        type: s3
        path: https://s3.us-west-002.backblazeb2.com/<b2-bucket>/<directory>
        key: <restic-key>
        env:
            AWS_ACCESS_KEY_ID: <apiKeyId>
            AWS_SECRET_ACCESS_KEY: <apiKey>
pec0ra commented 6 months ago

@cschritt I tested today with the latest versions of restic and autorestic and it's still not working. I can successfully backup to s3 directly but I can't use copy from a local backend to s3.

Do you have any more details about your working config?

I think it's a problem with restic since autorestic just call the restic binary with the proper arguments

Copying directly with restic (without autorestic) works. I think that the issue is how autorestic sets up the two environments to copy from/to.

Anybody has an idea how to debug this? The failure unfortunately leaves no trace in the log, just an exit status 1

cschritt commented 5 months ago

@pec0ra

Do you have any more details about your working config?

I started on a fresh B2 bucket this time. I also first created a backup on the b2 backend as a primary target. Then I reconfigured autorestic and ran another backup. This effectively replicated all data on the b2 backend, but the copy finished successfully. I did not take any further care about the extra setup step or the redundant data on the backend, yet.