Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create key in backend at "any local dir" failed: Calibrate: scrypt.Calibrate: scrypt: the parameters provided are invalid #676

Closed
wdl1908 opened this issue Nov 15, 2016 · 14 comments

Comments

@wdl1908
Copy link

wdl1908 commented Nov 15, 2016

Output of restic version

restic 0.3.0 (v0.3.0-29-g190673b)
compiled at 2016-11-15 21:58:36 with go1.7.3 on linux/386

Expected behavior

create a new repo

Actual behavior

create key in backend at "any local dir" failed: Calibrate: scrypt.Calibrate: scrypt: the parameters provided are invalid

Steps to reproduce the behavior

  1. build according to readme
  2. ./restic init -r "any local dir"

replace "any local dir" with anything on the local filesystem
I tried several different dirs also with the root user. The result is always the same.

@fd0
Copy link
Member

fd0 commented Nov 16, 2016

Hey, thanks for reporting this. I find it really unexpected. What happens here is that restic calibrates scrypt(), a function to derive encryption keys from a password, according to the hardware it is executed on. After calibration restic checks that the parameters are strong enough, otherwise default parameters should be used. Somehow this doesn't work, so we need to find out why.

What hardware do you run restic on? Is that especially low- or high-end (in terms of CPU)?

@fd0 fd0 added type: question/problem usage questions or problem reports type: bug labels Nov 16, 2016
@wdl1908
Copy link
Author

wdl1908 commented Nov 16, 2016

Intel(R) Core(TM)2 Quad CPU Q8400 @ 2.66GHz
8G RAM
Linux wormhole 4.6.0-1-686-pae #1 SMP Debian 4.6.4-1 (2016-07-18) i686 GNU/Linux

So yes maybe this is a low end machine.

@fd0
Copy link
Member

fd0 commented Nov 16, 2016

Hm, that's not what I would call "low-end" ;)

I'll write something up so we can debug this further.

@wdl1908
Copy link
Author

wdl1908 commented Nov 17, 2016

I tested it on a 64bit system and it seems to work fine the 32bit system always fails. Maybe there is some 64 bit specific code that fails on 32bit.

@fd0
Copy link
Member

fd0 commented Nov 18, 2016

Ah, that's an interesting information! I can reproduce it (on my amd64 machine) when building and running a 32 bit restic binary:

$ go run build.go --goarch 386
$ ./restic -r /tmp/foo init                      
enter password for new backend: 
enter password again: 
create key in backend at /tmp/foo failed: Calibrate: scrypt.Calibrate: scrypt: the parameters provided are invalid

@fd0
Copy link
Member

fd0 commented Nov 19, 2016

I've found the cause and implemented a solution, it was caused by an integer overflow in the Calibrate function of the simple-scrypt library, issue is here: elithrar/simple-scrypt#6

@wdl1908
Copy link
Author

wdl1908 commented Nov 19, 2016

Nice you got a specific branch I can test?

@fd0
Copy link
Member

fd0 commented Nov 19, 2016

I'll create one once the PR is merged :)

@fd0
Copy link
Member

fd0 commented Nov 19, 2016

See branch fix-676 and #678

@wdl1908
Copy link
Author

wdl1908 commented Nov 19, 2016

Yup that fixes the problem.

@wdl1908 wdl1908 closed this as completed Nov 19, 2016
@fd0
Copy link
Member

fd0 commented Nov 19, 2016

Great, thanks for having a look!

@cschelcher
Copy link

Hi All,

Thanks for fixing this for oldies 32bits systems ;)

However, vendor version on master is not up-to-date with master (including the fix) of source repository. I tested the fix with sucess though.

Could you please update vendor on restic master repo ?

Thanks for your great work ;) !

@fd0
Copy link
Member

fd0 commented Aug 5, 2017

That is probably because we've recently switched to a different repo layout and are now using dep for vendor management. I'll bug the author to make a new release and make a PR which updates the version.

fd0 added a commit that referenced this issue Aug 5, 2017
The master branch includes a fix for i386, otherwise the calibration
panics. See #676 for details.
@fd0
Copy link
Member

fd0 commented Aug 5, 2017

Done, the code in master uses simple-scrypt master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants