Restic: b2.NewClient: b2_authorize_account: 401: Invalid authorization token

Created on 20 Oct 2017  路  1Comment  路  Source: restic/restic

Output of restic version

restic 0.7.3
compiled with go1.9 on linux/arm

How did you run restic exactly?

1, First, created backup for home dir:

$ cat .bash_aliases 

export B2_ACCOUNT_ID="xy"
export B2_ACCOUNT_KEY="xy"
export RESTIC_REPOSITORY="b2:pi3-restic-home-backup"
export RESTIC_PASSWORD="xy"

2,

restic init
...
restic backup --one-file-system ~

done. It's worked.

Then I decided to make a full system backup so I created new bucket on B2, then:

$ sudo restic -r b2:rpi3-fullbackup backup --one-file-system --exclude /dev/ --exclude /lost+found/ --exclude /media/ --exclude /mnt/ --exclude /proc/ --exclude /sys/ --exclude /tmp/ --exclude /var/cache/apt/ /

Note the -r switch to override variable from .bash_aliases above.

Result:
unable to open repo at b2:rpi3-fullbackup: b2.NewClient: b2_authorize_account: 401: Invalid authorization token

What backend/server/service did you use?

B2

Do you have any idea what may have caused this?

some B2 token?

questioproblem

Most helpful comment

Hey, thanks for the report. That's not a problem in restic, it's sudo which cleans the environment and removes the variables:

$ export FOO=bar
$ env | grep FOO 
FOO=bar
$ sudo env | grep FOO
[sudo] password for fd0:

I see two solutions: Either configure sudo to pass on these environment variables (e.g. by using sudo -E) or write a shell script which sets the variables and then calls restic, and call the script via sudo.

I'm going to close this issue as it is not a problem in restic.

>All comments

Hey, thanks for the report. That's not a problem in restic, it's sudo which cleans the environment and removes the variables:

$ export FOO=bar
$ env | grep FOO 
FOO=bar
$ sudo env | grep FOO
[sudo] password for fd0:

I see two solutions: Either configure sudo to pass on these environment variables (e.g. by using sudo -E) or write a shell script which sets the variables and then calls restic, and call the script via sudo.

I'm going to close this issue as it is not a problem in restic.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

stevesbrain picture stevesbrain  路  3Comments

fd0 picture fd0  路  4Comments

jpic picture jpic  路  3Comments

RafaelAybar picture RafaelAybar  路  3Comments

reallinfo picture reallinfo  路  4Comments