You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Google Drive (encrypted): "failed to authenticate decrypted block - bad password?" on files during reading #999
The files were copied from a non encrypted remote (01:) to an encrypted remote (02crypt:) with the copy command.
I still have 01: so I tried to fix the files on 02crypt by doing a sync 01: 02crypt:. I hoped that the corrupted would be written again because of some failed checks but no. The files from 02crypt: still won't copy back to local.
Sizes and file counts report ok:
~/drive/rclone size 01:
Total objects: 12847
Total size: 19918.153 GBytes (21386954189603 Bytes)
~/drive/rclone size 02crypt:
Total objects: 12847
Total size: 19918.153 GBytes (21386954189603 Bytes)
Same issue here. Very worrying because I have many thousands files and no idea what file is ok and what file isn't.
You'd better check them all, not only right after uploading, but also periodically. For this, I generate MD5 files of all data and store it along the data, both locally and remotely, and then use "md5sum -c" (on a rclone mount for the remote files).
I've learned from hard, cold experience that my files aren't safe unless I have at least 3 copies stored in different places and verify each and every file of each and every copy periodically. I already work with two physical copies (one local and the other stored in a different place in my city), and my rclone usage is an attempt to try and store a 3rd copy in a really different place (hopefully another continent).
I'm sorry you are having problems with this. I think this probably isn't related to #677 - practically any error in the crypt data transfer will cause that error message.
Can you perform a test for me? I'd like you to see if you can download the encrypted version of a file, then try to decrypt it locally.
To work out which file it is, you'll need to find out what it is called. The easiest way of doing this is to find the directory
rclone -v ls egd:REDACTED/REDACTED/REDACTED/REDACTED.mp4
This will print a messagae like this
2017/01/08 12:10:20 Encrypted Google drive root 'h0fgn6vkka25jj9fhu5roml6pg/rv5l12j0nanu5af9ivc97ofdk8/gtu1leijh9rlm05pcjtusqop2g': Modify window is 1ms
That will be the directory that the file is in. You can find exactly which one it is by matching the sizes in the web interface.
Once you've identified the file, can you try downloading it with rclone copy (using the non encrypted mount). Say to a directory called /tmp/downloaded
If you then edit your config file with a text editor and duplicate your egd remote calling it elocal say and change the remote line to be remote = /tmp/downloaded, this will let you decrypt things locally.
You can then use rclone ls elocal: and if you can try rclone copy elocal:REDACTED.mp4 /tmp/redownload and see what happens there.
This will enable me to see whether
the file is corrupted on google drive
or rclone is having a problem downloading the file (which would also give that error).
Can you also try downloading the ecnrypted file with the web intereface and see if it is the same as the file you download with rclone copy.
If you have the original file, another useful check would be to rclone copy it into the elocal: and then compare that file with the one you downloaded from drive - (size and md5sum).
Thanks for your long and thoughtful comment, @ncw. It's a pleasure using a program whose developer is so dedicated and responsive.
More below:
I'm sorry you are having problems with this.
No problem -- every piece of software more complex than "helloworld" has issues, and in this case, no one can assert that the error is indeed on rclone: the data could have been corrupted on GDrive itself. About the only thing I can say is that it has not been corrupted in my servers: I use ZFS (which has built-in checksums) for everything, and all the machines involved in the above transfers have ECC RAM (my only 'computers' without ECC RAM are my laptop, my mediacenter and my smartphone -- and I plan on getting an ECC-based laptop ASAP as they are now somewhat available).
I think this probably isn't related to #677 - practically any error in the crypt data transfer will cause that error message.
Thanks for the clarification. I mentioned it because it was the issue I found more similar to my current one, and it was one where I had commented before.
Can you perform a test for me?
Sure thing, and with pleasure.
I'd like you to see if you can download the encrypted version of a file, then try to decrypt it locally.
To work out which file it is, you'll need to find out what it is called. The easiest way of doing this is to find the directory
rclone -v ls egd:REDACTED/REDACTED/REDACTED/REDACTED.mp4
This will print a messagae like this
2017/01/08 12:10:20 Encrypted Google drive root 'h0fgn6vkka25jj9fhu5roml6pg/rv5l12j0nanu5af9ivc97ofdk8/gtu1leijh9rlm05pcjtusqop2g': Modify window is 1ms
That will be the directory that the file is in. You can find exactly which one it is by matching the sizes in the web interface.
I tried, but in that particular dir there are a quite a few files with very similar sizes, and not one of them matches the rclone-encrypted size exactly:
Correct me if I'm wrong, but I think none of the sizes match because rclone crypt does some "padding". If I had to guess, I would have bet on the file with the closest size (ie. 262060813), but I don't like to bet :-) so I think it's best to ask you how to proceed.
OTOH, is there any particular reason for the rclone -v output not including each file's encrypted full path+filename? If not please let me know and I will open an issue for it, as I think it would make these kinds of determinations much easier.
Once you've identified the file, can you try downloading it with rclone copy (using the non encrypted mount). Say to a directory called /tmp/downloaded
If you then edit your config file with a text editor and duplicate your egd remote calling it elocal say and change the remote line to be remote = /tmp/downloaded, this will let you decrypt things locally.
You can then use rclone ls elocal: and if you can try rclone copy elocal:REDACTED.mp4 /tmp/redownload and see what happens there.
This will enable me to see whether
the file is corrupted on google drive
or rclone is having a problem downloading the file (which would also give that error).
Can you also try downloading the ecnrypted file with the web intereface and see if it is the same as the file you download with rclone copy.
Please let me know how to determine the exact file as I asked above so I can proceed in answering these questions.
Other questions
is it only large files you see this problem on?
What is "large"? ;-) To try and anwer that, I just checked and the smallest of the 73 files that show this problem has exactly 22067174 bytes (~22MB), unencrypted of course.
what does rclone check say?
Last two lines state:
[...] 0 differences found
[...] 16 hashes could not be checked
I note that #854 would be useful here.
I see what you mean. Even better would be an rclone-equivalent of a "md5sum -c" (perhaps a "-c" option to "rclone md5sum"?), where I supply a remote path and a local .md5 file (eg, one generated using "md5sum * >file.md5" or equivalent), and then rclone calculates the MD5SUM for every remote file mentioned in the .md5 file and checks against the MD5SUM contained in that file and prints the appropriate message just like a local "md5sum -c" (or one run against a "rclone mount" on the remote) would.
If you have the original file, another useful check would be to rclone copy it into the elocal: and then compare that file with the one you downloaded from drive - (size and md5sum).
Of course I do have it; in fact, I have all of them, and in duplicate. It will be a cold day in Hell when I get caught with my pants down regarding not having redundant copies of all my data ;-)
I will wait for your guidance re: my question above (on how to identify the exact encrypted file between many with approximately the same size).
No problem -- every piece of software more complex than "helloworld" has issues, and in this case, no one can assert that the error is indeed on rclone: the data could have been corrupted on GDrive itself.
Yes that is the first thing we need to do - work out where the corruption is happening.
About the only thing I can say is that it has not been corrupted in my servers: I use ZFS (which has built-in checksums) for everything, and all the machines involved in the above transfers have ECC RAM (my only 'computers' without ECC RAM are my laptop, my mediacenter and my smartphone -- and I plan on getting an ECC-based laptop ASAP as they are now somewhat available).
We have similar levels of paranoia about data loss! You'd probably enjoy one of my other programs stressdisk if you haven't seen it already.
OTOH, is there any particular reason for the rclone -v output not including each file's encrypted full path+filename? If not please let me know and I will open an issue for it, as I think it would make these kinds of determinations much easier.
I agree that would be useful. Probably what I'd so is make the name mappings show if you do an ls -v - how does that sound? If you wanted to make an issue about it that would be great.
16 hashes could not be checked
Can you try it over the whole remote? I'm concerned as to whether rclone check will notice those missing files you reported.
I see what you mean. Even better would be an rclone-equivalent of a "md5sum -c" (perhaps a "-c" option to "rclone md5sum"?), where I supply a remote path and a local .md5 file (eg, one generated using "md5sum * >file.md5" or equivalent), and then rclone calculates the MD5SUM for every remote file mentioned in the .md5 file and checks against the MD5SUM contained in that file and prints the appropriate message just like a local "md5sum -c" (or one run against a "rclone mount" on the remote) would.
That is effectively what rclone check does at the moment - however crypt doesn't support hashes. With the addition of #854 it would work for crypted remotes too
Again thanks for your response. So let's move ahead:
Ach, I forgot about the padding... Yes your guess of the file of size 262060813 is correct
Great! So here's what you asked for:
Once you've identified the file, can you try downloading it with rclone copy (using the non encrypted mount). Say to a directory called /tmp/downloaded
Done:
mkdir /tmp/rclone_issue_999_test_20170108Z191002
cd !$
rclone copy -v gd:ad9vmobdicfbsr1bbropaghtik/j9t3ij7t2vmucl443rn90hmjbo/jhdir64l56ogdjpqjd71ubgenc0frv2fe8m9v062qlea593jc97g/4s56ib1p2pjdofn9s4tpveehg8 .
It produced the following output:
2017/01/08 17:12:35 rclone: Version "v1.35" starting with parameters ["rclone" "copy" "-v" "gd:ad9vmobdicfbsr1bbropaghtik/j9t3ij7t2vmucl443rn90hmjbo/jhdir64l56ogdjpqjd71ubgenc0frv2fe8m9v062qlea593jc97g/4s56ib1p2pjdofn9s4tpveehg8" "."]
2017/01/08 17:12:38 Local file system at /tmp/rclone_issue_999_test_20170108Z191002: Modify window is 1s
2017/01/08 17:12:39 Local file system at /tmp/rclone_issue_999_test_20170108Z191002: Waiting for checks to finish
2017/01/08 17:12:39 Local file system at /tmp/rclone_issue_999_test_20170108Z191002: Waiting for transfers to finish
2017/01/08 17:13:38
Transferred: 4.375 MBytes (70.504 kBytes/s)
Errors: 0
Checks: 0
Transferred: 0
Elapsed time: 1m3.5s
Transferring:
* 4s56ib1p2pjdofn9s4tpveehg8: 1% done, 76.660 kBytes/s, ETA: 54m39s
[...]
2017/01/08 18:13:56 4s56ib1p2pjdofn9s4tpveehg8: Copied (new)
2017/01/08 18:13:56
Transferred: 249.921 MBytes (69.512 kBytes/s)
Errors: 0
Checks: 0
Transferred: 1
Elapsed time: 1h1m21.6s
2017/01/08 18:13:56 Go routines at exit 6
If you then edit your config file with a text editor and duplicate your egd remote calling it elocal say and change the remote line to be remote = /tmp/downloaded, this will let you decrypt things locally.
You can then use rclone ls elocal: and if you can try rclone copy elocal:REDACTED.mp4 /tmp/redownload and see what happens there.
Here are the commands I ran, and their output:
rclone ls elo:
261996813 REDACTED.mp4
rclone -v copy elo:REDACTED.mp4 /tmp/test.mp4
2017/01/08 18:45:40 rclone: Version "v1.35" starting with parameters ["rclone" "-v" "copy" "elo:REDACTED.mp4" "/tmp/test.mp4"]
2017/01/08 18:45:40 Local file system at /tmp/test.mp4: Modify window is 1s
2017/01/08 18:45:40 Local file system at /tmp/test.mp4: Waiting for checks to finish
2017/01/08 18:45:40 Local file system at /tmp/test.mp4: Waiting for transfers to finish
2017/01/08 18:45:40 REDACTED.mp4: Removing partially written file on error: failed to authenticate decrypted block - bad password?
2017/01/08 18:45:40 REDACTED: Failed to copy: failed to authenticate decrypted block - bad password?
2017/01/08 18:45:40 Attempt 1/3 failed with 1 errors and: failed to authenticate decrypted block - bad password?
2017/01/08 18:45:40 Local file system at /tmp/test.mp4: Waiting for checks to finish
2017/01/08 18:45:40 Local file system at /tmp/test.mp4: Waiting for transfers to finish
2017/01/08 18:45:40 REDACTED.mp4: Removing partially written file on error: failed to authenticate decrypted block - bad password?
2017/01/08 18:45:40 REDACTED.mp4: Failed to copy: failed to authenticate decrypted block - bad password?
2017/01/08 18:45:40 Attempt 2/3 failed with 1 errors and: failed to authenticate decrypted block - bad password?
2017/01/08 18:45:40 Local file system at /tmp/test.mp4: Waiting for checks to finish
2017/01/08 18:45:40 Local file system at /tmp/test.mp4: Waiting for transfers to finish
2017/01/08 18:45:40 REDACTED.mp4: Removing partially written file on error: failed to authenticate decrypted block - bad password?
2017/01/08 18:45:40 REDACTED.mp4: Failed to copy: failed to authenticate decrypted block - bad password?
2017/01/08 18:45:40 Attempt 3/3 failed with 1 errors and: failed to authenticate decrypted block - bad password?
2017/01/08 18:45:40 Failed to copy: failed to authenticate decrypted block - bad password?
This will enable me to see whether
the file is corrupted on google drive
or rclone is having a problem downloading the file (which would also give that error).
If I'm following your reasoning correctly (and please correct me if I don't), I think the above tests show that the file is already corrupted on GDrive (ie, the corruption is not happening during rclone's "download" of it). But, do they show anything regarding how it got corrupted there in the first place (ie, during rclone's "upload", or by some issue on GDrive itself, independently of rclone)?
If my thinking is correct, this is where an independent rclone-calculated md5sum stored along with the file's metadata (a la #637) would have helped us a lot... :-/
Can you also try downloading the ecnrypted file with the web intereface and see if it is the same as the file you download with rclone copy.
Just did (saved it as /tmp/encrypted_REDACTED_downloaded_via_WebUI), and it's exactly the same file downloaded by the above "rclone copy gd:" command.
I think that this corroborates the above: the encrypted file that is now stored on GDrive is already corrupted (ie, in a state where rclone can't decrypt it), it is not being somehow modified by rclone during "download".
But does this gets us any closer to finding out whether that file was (a) corrupted after being stored in GDrive by the rclone "upload" (ie, by GDrive itself, or at least something that happened on GDrive outside of rclone's "jurisdiction"), or (b) was it corrupted during the original rclone "upload"?
We have similar levels of paranoia about data loss! You'd probably enjoy one of my other programs stressdisk if you haven't seen it already.
"Perfect paranoia is perfect awareness" ;-) I will have a look at your stressdisk program; I actually have one I wrote myself (for sequential-access stressing), which I run in parallel with the venerable dledford's memtest (which, despite its name, is also a great random-access disk stressing program), plus mprime on "torture" mode, on all my machines for at least 24 continuous hours before getting them to production. It has saved me from flaky hardware (from intermittent motherboards to weak power supplies) more times than I can count....
OTOH, is there any particular reason for the rclone -v output not including each file's encrypted full path+filename? If not please let me know and I will open an issue for it, as I think it would make these kinds of determinations much easier.
I agree that would be useful. Probably what I'd so is make the name mappings show if you do an ls -v - how does that sound?
It sounds just about perfect ;-)
If you wanted to make an issue about it that would be great.
Can you try it over the whole remote? I'm concerned as to whether rclone check will notice those missing files you reported.
I need to reallocate the relevant disks to my machine with good internet bandwidth (which is offsite), right now it's with other disks whose contents are being copied to GDrive. It will be at least a few weeks before I can do that :-( Sorry...
A -c option to rclone md5sum is a good idea too.
That would be great, and allow me to do that checking you asked for immediately. I just opened an issue for it too, see #1005.
If you have the original file, another useful check would be to rclone copy it into the elocal: and then compare that file with the one you downloaded from drive - (size and md5sum).
Will do, and let you know (also have to reallocate these pesky disks, but at least it can be done on a local machine, so it will take just a few hours).
If you have the original file, another useful check would be to rclone copy it into the elocal: and then compare that file with the one you downloaded from drive - (size and md5sum).
Will do, and let you know (also have to reallocate these pesky disks, but at least it can be done on a local machine, so it will take just a few hours).
Here it is:
rclone mkdir elo:local_copy_into_encrypted_local_volume
rclone -v copy /mnt2/REDACTED/REDACTED/REDACTED.mp4 elo:local_copy_into_encrypted_local_volume
2017/01/08 22:57:36 rclone: Version "v1.35" starting with parameters ["rclone" "-v" "copy" "/mnt2//mnt2/REDACTED/REDACTED/REDACTED.mp4" "elo:local_copy_into_encrypted_local_volume"]
2017/01/08 22:57:36 Encrypted Local file system at /tmp/rclone_issue_999_test_20170108Z191002/dn8l3qcrroa7isplg99uj24v5sff6eb89qqokdchr189qtgn6dik7hjg25g1oerca0fci93005rbc: Modify window is 1s
2017/01/08 22:57:36 Encrypted Local file system at /tmp/rclone_issue_999_test_20170108Z191002/dn8l3qcrroa7isplg99uj24v5sff6eb89qqokdchr189qtgn6dik7hjg25g1oerca0fci93005rbc: Waiting for checks to finish
2017/01/08 22:57:36 Encrypted Local file system at /tmp/rclone_issue_999_test_20170108Z191002/dn8l3qcrroa7isplg99uj24v5sff6eb89qqokdchr189qtgn 6dik7hjg25g1oerca0fci93005rbc: Waiting for transfers to finish
2017/01/08 22:57:39 S01E08.mp4: Copied (new)
2017/01/08 22:57:39
Transferred: 249.860 MBytes (73.119 MBytes/s)
Errors: 0
Checks: 0
Transferred: 1
Elapsed time: 3.4s
find /tmp/rclone_issue_999_test_20170108Z191002 -type f -ls
1999866 256170 -rw-rw-r-- 1 durval durval 262060813 Aug 2 2015 /tmp/rclone_issue_999_test_20170108Z191002/dn8l3qcrroa7isplg99uj24v5sff6eb89qqokdchr189qtgn6dik7hjg25g1oerca0fci93005rbc/4s56ib1p2pjdofn9s4tpveehg8
652927 256170 -rw-rw-r-- 1 durval durval 262060813 Aug 2 2015 /tmp/rclone_issue_999_test_20170108Z191002/4s56ib1p2pjdofn9s4tpveehg8
md5sum /tmp/rclone_issue_999_test_20170108Z191002/4s56ib1p2pjdofn9s4tpveehg8 /tmp/rclone_issue_999_test_20170108Z191002/dn8l3qcrroa7isplg99uj24v5sff6eb89qqokdchr189qtgn6dik7hjg25g1oerca0fci93005rbc/4s56ib1p2pjdofn9s4tpveehg8
81fed713aed1ba6b3f7b2408bb912f4a /tmp/rclone_issue_999_test_20170108Z191002/4s56ib1p2pjdofn9s4tpveehg8
586c4d7cfdde6ac10594fb0a937960f7 /tmp/rclone_issue_999_test_20170108Z191002/dn8l3qcrroa7isplg99uj24v5sff6eb89qqokdchr189qtgn6dik7hjg25g1oerca0fci93005rbc/4s56ib1p2pjdofn9s4tpveehg8
So it seems that the files have the same size and encrypted filename, but distinct MD5SUMs.
I hexdumped the start of each file to see how much they differed, and here's what I found:
So it seems that, after the "RCLONE\000\000" header, the files are utterly different. if it was a single byte, or even a sequence of bytes, I would be able to understand that GDrive might have corrupted it... but the entire file?! Only if GDrive managed to somehow replace the entire file content with trash... but it seems it skipped exactly the first 8 bytes of the above header!?
@ncw, I hope the above is helpful for you (and if it isn't, please feel free to request anything else you'd need).
I'm pretty sure it happens during the upload.
Once a file is corrupted, a download always fails at the same point on different hosts.
I have 1 Google remote with originals and 3 remotes with encrypted copies.
All encrypted remotes have different (single) passwords and it happens with random files. I haven't spotted any issues with non-encrypted files.
Maybe it has to do with 403's because of rate limiting or other retries. I'm using --drive-chunk-size 262144 and --transfers 16 to keep things going.
I'm pretty convinced that the original files are ok and all encrypted copies contain different corrupted files. However, I have no way to determine which ones are corrupted.
In addition to fixing it, I think it would be great to somehow (optional?) calculate the encrypted md5 from the non encrypted file before a sync (and I guess copy as well). That way Rclone can properly detect if an upload was successful and, in case of sync, corrupted files will be replaced. (Because right now, sync skips them and doesn't do anything.)
@DurvalMenezes - thanks for all your testing and for making the issues
I think that this corroborates the above: the encrypted file that is now stored on GDrive is already corrupted (ie, in a state where rclone can't decrypt it), it is not being somehow modified by rclone during "download".
Yes that is my reading of it.
So it seems that, after the "RCLONE\000\000" header, the files are utterly different.
Thinking about it further, that is what I'd expect as they have different randomly generated nonces - so that wasn't a particularly useful test, sorry :-(
I thought of another test which might shed some light...
If you could rclone cat egd:REDACTED/REDACTED/REDACTED/REDACTED.mp4 > tmp.mp4 or rclone cat elo:REDACTED.mp4 > tmp.mp4 if you prefer and see how big the resulting output is that would be very useful.
That will tell us which block to look at to see the corrupted data in the encrypted file you downloaded.
The output file will be some multiple of 65536 long. So take the file size and divide it by 65536 call it N.
This corresponds to a block at offset 32+N*(65536+16). It would be interesting to see what the data in the encrypted version of the file for the next 64k looks like. If it doesn't look like random data then there will be a clue there.
If we see a problem at a --drive-chunk-size boundary it is something to do with the multipart uploading.
@DurvalMenezes - thanks for all your testing and for making the issues
You are welcome, it's my pleasure to collaborate.
Thinking about it further, that is what I'd expect as they have different randomly generated nonces - so that wasn't a particularly useful test, sorry :-(
No problem, and I'm actually relieved to hear rclone encryption use nonces -- otherwise files with the same content would always encrypt to the same thing, which cryptographically is Not a Good Thing(tm).
I thought of another test which might shed some light...
[...]
Here it is, using the elo: "pseudo" remote (as I have already deleted and re-uploaded the errored files on the real GDrive encrypted remote):
rclone -v cat elo:REDACTED.mp4 | wc -c
2017/01/09 15:10:45 REDACTED.mp4: Failed to send to output: failed to authenticate decrypted block - bad password?
5177609
So, the decryption failed after exactly 5177609 bytes.
The output file will be some multiple of 65536 long. So take the file size and divide it by 65536 call it N.
Humrmrmr... presuming you meant N to be an integer: it's close but no cigar, not even minus/plus 1 byte:
dc
6 k
5177609 65536 / p
79.004043
5177609 1 + 65536 / p
79.004058
5177609 1 - 65536 / p
79.004028
This corresponds to a block at offset 32+N*(65536+16).
If I follow you correctly, this doesn't check either:
5177609 32 - 65536 16 + / p
78.984272
It would be interesting to see what the data in the encrypted version of the file for the next 64k looks like. If it doesn't look like random data then there will be a clue there.
I'm not sure that this applies, given that none of the offsets above checks out.
Again if I'm following you correctly, it seems the error occurs at a totally random place, so the rclone decryption called by "rclone cat" on the encrypted remote isn't outputting full blocks(?!)
Try that with the -q flag - -v writes to stdout by default
Doesn't seem like a good idea with a subcommand like "cat"... :-) Also, I faintly remember discussing something about rclone in general (not only cat) actually writing error messages and the like to stderr instead of stdout -- guess it hasn't made it into the code yet.
Anyway, without further ado, here it is:
rclone -q cat elo:REDACTED.mp4 | wc -c
2017/01/09 16:08:54 REDACTED.mp4: Failed to send to output: failed to authenticate decrypted block - bad password?
5177344
And of course now the numbers check out:
dc
6 k
5177344 65536 / p
79.000000
65536 16 + * 32 + p
5178640.000000
So, if I follow your thinking, the encrypted file was corrupted after exactly 79 blocks, and the interesting block for us will begin at offset 5178640.
Having an initial look at it:
dd bs=1 skip=5178640 <4s56ib1p2pjdofn9s4tpveehg8 | hexdump -C | head
00000000 a7 b2 29 18 cb 9a e4 9f bd 72 3f 97 20 1c c4 45 |..)......r?. ..E|
00000010 8b 42 13 68 05 bb b4 6e 6f c0 32 5e ba 93 86 45 |.B.h...no.2^...E|
00000020 4a db 4d b4 97 10 9e 67 91 fd 26 b5 4c 10 59 8a |J.M....g..&.L.Y.|
00000030 57 89 3f a9 d4 9d 9c e7 fe be ce 51 15 22 6f 99 |W.?........Q."o.|
00000040 6a ff 87 f1 d5 17 d9 5c 55 d1 35 52 7b 11 de c1 |j......\U.5R{...|
00000050 4a 3a cf 07 53 97 c4 84 36 75 b7 ba 86 9d 87 7d |J:..S...6u.....}|
00000060 5b 1c 7a 21 2c 51 eb 7c b2 76 bd dd d1 ff 1a 13 |[.z!,Q.|.v......|
00000070 8e 81 7e f7 1e 7e 45 15 ba 3f 25 13 12 a1 e9 16 |..~..~E..?%.....|
00000080 ca 8d 42 2d 32 be 34 74 29 1e 1b e8 94 f1 c8 95 |..B-2.4t).......|
00000090 60 be ac 03 a9 1a a5 0b 93 60 de 2b 82 11 84 88 |`........`.+....|
This looks pretty random to me...
Checking whether it is really random (ie, the probable result of rclone encryption), by testing the entire 64K block with the venerable ent program:
dd bs=1 skip=5178640 count=65536 <4s56ib1p2pjdofn9s4tpveehg8 | ent
65536+0 records in
65536+0 records out
65536 bytes (66 kB) copied, 0.0578989 s, 1.1 MB/s
[ent output follows]:
Entropy = 7.997738 bits per byte.
Optimum compression would reduce the size
of this 65536 byte file by 0 percent.
Chi square distribution for 65536 samples is 205.09, and randomly
would exceed this value 99.04 percent of the times.
Arithmetic mean value of data bytes is 127.6990 (127.5 = random).
Monte Carlo value for Pi is 3.149972533 (error 0.27 percent).
Serial correlation coefficient is -0.000010 (totally uncorrelated = 0.0).
rclone cryptcheck checks a remote against a crypted remote. This is
the equivalent of running rclone check, but able to check the
checksums of the crypted remote.
For it to work the underlying remote of the cryptedremote must support
some kind of checksum.
It works by reading the nonce from each file on the cryptedremote: and
using that to encrypt each file on the remote:. It then checks the
checksum of the underlying file on the cryptedremote: against the
checksum of the file it has just encrypted.
Great news, @ncw! Is that fix in the latest beta? I will use it to continue my copying and then will do the md5sum -c on the rclone mount` directory tree and let you know how it goes.
Are you copying over the network from a crypted drive? If so that will be the fix.
Humrmrmr... right now (and for the last two months), I'm copying from a local filesystem to my encrypted GDrive. But previously I was copying from an encrypted Amazon Cloud Drive to the encrypted Google Drive, and these errors may very well be from that time.
I will pay attention and report back if I get any errors from files that definitely were copied from the local filesystem instead of from a encrypted remote.
For what it's worth (I suspect not much right now that @ncw reported fixing the original cause), I just noticed that the latest rclone cat --tail 1 --discard I left running here (with --checkers 4 to avoid being banned) finished (after 18 and a half days -- ouch). The final stats block from the log file was:
So 914 errors in ~6.8M files... too much to check by hand, and as I mentioned above, probably not worth the trouble right now. Also, I suspect quite a few files are missing above (my numbers indicate something more like ~8M files on that remote).
What I will do is to run a rclone cryptcheck on the largest directory on this remote, and then a recursive md5sum -c and report back here. Please stay tuned ;-)
If @ncw or anyone wants details on the above rclone cat --tail 1 --discard run, please contact me in the next few days (before I delete the 300MB log file).
@DurvalMenezes I'd be tempted to grep out the failing files from the log and put them in a form I could pass to --files-from. You could then use the -I flag to unconditionally upload them.
I've managed to finish (in principle, as "rclone sync" has run to the end and reported no errors both on the last "Errors: " log line, and in its final process exit status (ie, "echo $?" prints a 0) copying an entire, very large local filesystem (my largest so far, with ~8M files totaling ~3.8TB) to Encrypted GDrive.
Now that rclone sync has finished, I'm doing a "md5sum -c" on an rclone mount of the resulting directory on the encrypted GDrive; it's about 10% done, and so far I've got no errors; this is AFAIK excellent news, as previously (with older versions of rclone, I'm using v1.36 now) it started reporting all sorts of errors way before that point.
In particular, no "failed to authenticate" errors mean, if I understand things correctly, that either @ncw's original diagnosis (that the errors were caused by remote-to-remote copying) was correct, or that his fix really corrected the root cause of this issue (or possibly both). But anyway, seeing no errors so far makes me a very happy camper! ;-)
On a side note, I'm seeing output from rclone mount along these lines:
2017/04/19 03:03:34 REDACTED/REDACTED/REDACTED/REDACTED/REDACTED/REDACTED.mp4: ReadFileHandle.Read error: low level retry 1/100: unexpected EOF
At this point (a few hundreds of thousands of files checked), I got exactly 16 of these errors; and, none of these errors has resulted in any issues being reported by the "md5sum -c" which is reading these files . So, I think the low level retries on these errors are now actually working (they weren't previously: md5sum reported errors when those things happened).
So, it seems we have only good news so far; when this md5sum -c has finished (which I estimate will take a couple of days more), I will post an updated report.
Activity
4getit commentedon Jan 8, 2017
Same issue here. Very worrying because I have many thousands files and no idea what file is ok and what file isn't.
With many files on an encrypted Google Drive I get the following errors when trying to copy to local: http://pastebin.com/ySNPSXgi
I think it goes wrong when writing the file.
The files were copied from a non encrypted remote (01:) to an encrypted remote (02crypt:) with the copy command.
I still have 01: so I tried to fix the files on 02crypt by doing a sync 01: 02crypt:. I hoped that the corrupted would be written again because of some failed checks but no. The files from 02crypt: still won't copy back to local.
Sizes and file counts report ok:
~/drive/rclone size 01:
Total objects: 12847
Total size: 19918.153 GBytes (21386954189603 Bytes)
~/drive/rclone size 02crypt:
Total objects: 12847
Total size: 19918.153 GBytes (21386954189603 Bytes)
DurvalMenezes commentedon Jan 8, 2017
@4getit wrote:
You'd better check them all, not only right after uploading, but also periodically. For this, I generate MD5 files of all data and store it along the data, both locally and remotely, and then use "md5sum -c" (on a rclone mount for the remote files).
I've learned from hard, cold experience that my files aren't safe unless I have at least 3 copies stored in different places and verify each and every file of each and every copy periodically. I already work with two physical copies (one local and the other stored in a different place in my city), and my rclone usage is an attempt to try and store a 3rd copy in a really different place (hopefully another continent).
So I think this recent experience just confirms all that. I posted a "tale of warning" topic on the forum just as a heads-up to everyone: https://forum.rclone.org/t/a-tale-of-warning-silently-corrupted-unreadable-data-on-remote/664
Cheers,
Durval.
ncw commentedon Jan 8, 2017
I'm sorry you are having problems with this. I think this probably isn't related to #677 - practically any error in the crypt data transfer will cause that error message.
Can you perform a test for me? I'd like you to see if you can download the encrypted version of a file, then try to decrypt it locally.
To work out which file it is, you'll need to find out what it is called. The easiest way of doing this is to find the directory
This will print a messagae like this
That will be the directory that the file is in. You can find exactly which one it is by matching the sizes in the web interface.
Once you've identified the file, can you try downloading it with rclone copy (using the non encrypted mount). Say to a directory called /tmp/downloaded
If you then edit your config file with a text editor and duplicate your
egdremote calling itelocalsay and change the remote line to beremote = /tmp/downloaded, this will let you decrypt things locally.You can then use
rclone ls elocal:and if you can tryrclone copy elocal:REDACTED.mp4 /tmp/redownloadand see what happens there.This will enable me to see whether
Can you also try downloading the ecnrypted file with the web intereface and see if it is the same as the file you download with
rclone copy.Other questions
I note that #854 would be useful here.
ncw commentedon Jan 8, 2017
If you have the original file, another useful check would be to rclone copy it into the elocal: and then compare that file with the one you downloaded from drive - (size and md5sum).
DurvalMenezes commentedon Jan 8, 2017
Thanks for your long and thoughtful comment, @ncw. It's a pleasure using a program whose developer is so dedicated and responsive.
More below:
No problem -- every piece of software more complex than "helloworld" has issues, and in this case, no one can assert that the error is indeed on rclone: the data could have been corrupted on GDrive itself. About the only thing I can say is that it has not been corrupted in my servers: I use ZFS (which has built-in checksums) for everything, and all the machines involved in the above transfers have ECC RAM (my only 'computers' without ECC RAM are my laptop, my mediacenter and my smartphone -- and I plan on getting an ECC-based laptop ASAP as they are now somewhat available).
Thanks for the clarification. I mentioned it because it was the issue I found more similar to my current one, and it was one where I had commented before.
I tried, but in that particular dir there are a quite a few files with very similar sizes, and not one of them matches the rclone-encrypted size exactly:
Correct me if I'm wrong, but I think none of the sizes match because rclone crypt does some "padding". If I had to guess, I would have bet on the file with the closest size (ie. 262060813), but I don't like to bet :-) so I think it's best to ask you how to proceed.
OTOH, is there any particular reason for the rclone -v output not including each file's encrypted full path+filename? If not please let me know and I will open an issue for it, as I think it would make these kinds of determinations much easier.
Please let me know how to determine the exact file as I asked above so I can proceed in answering these questions.
What is "large"? ;-) To try and anwer that, I just checked and the smallest of the 73 files that show this problem has exactly 22067174 bytes (~22MB), unencrypted of course.
Last two lines state:
Please find the entire "-v" output here: rclone_check_output_20170109Z141923.txt
Cheers,
Durval.
DurvalMenezes commentedon Jan 8, 2017
@ncw said:
Of course I do have it; in fact, I have all of them, and in duplicate. It will be a cold day in Hell when I get caught with my pants down regarding not having redundant copies of all my data ;-)
I will wait for your guidance re: my question above (on how to identify the exact encrypted file between many with approximately the same size).
Cheers,
Durval.
ncw commentedon Jan 8, 2017
Ach, I forgot about the padding... Yes your guess of the file of size 262060813 is correct
Calculation using python
Yes that is the first thing we need to do - work out where the corruption is happening.
We have similar levels of paranoia about data loss! You'd probably enjoy one of my other programs stressdisk if you haven't seen it already.
I agree that would be useful. Probably what I'd so is make the name mappings show if you do an
ls -v- how does that sound? If you wanted to make an issue about it that would be great.Can you try it over the whole remote? I'm concerned as to whether
rclone checkwill notice those missing files you reported.That is effectively what
rclone checkdoes at the moment - however crypt doesn't support hashes. With the addition of #854 it would work for crypted remotes tooA
-coption torclone md5sumis a good idea too.DurvalMenezes commentedon Jan 8, 2017
Hello @ncw,
Again thanks for your response. So let's move ahead:
Great! So here's what you asked for:
Done:
It produced the following output:
Here's a diff of my edit:
Here are the commands I ran, and their output:
If I'm following your reasoning correctly (and please correct me if I don't), I think the above tests show that the file is already corrupted on GDrive (ie, the corruption is not happening during rclone's "download" of it). But, do they show anything regarding how it got corrupted there in the first place (ie, during rclone's "upload", or by some issue on GDrive itself, independently of rclone)?
If my thinking is correct, this is where an independent rclone-calculated md5sum stored along with the file's metadata (a la #637) would have helped us a lot... :-/
Just did (saved it as /tmp/encrypted_REDACTED_downloaded_via_WebUI), and it's exactly the same file downloaded by the above "rclone copy gd:" command.
I think that this corroborates the above: the encrypted file that is now stored on GDrive is already corrupted (ie, in a state where rclone can't decrypt it), it is not being somehow modified by rclone during "download".
But does this gets us any closer to finding out whether that file was (a) corrupted after being stored in GDrive by the rclone "upload" (ie, by GDrive itself, or at least something that happened on GDrive outside of rclone's "jurisdiction"), or (b) was it corrupted during the original rclone "upload"?
I will reply to your further comments next.
Cheers,
Durval.
DurvalMenezes commentedon Jan 8, 2017
@ncw said:
"Perfect paranoia is perfect awareness" ;-) I will have a look at your stressdisk program; I actually have one I wrote myself (for sequential-access stressing), which I run in parallel with the venerable dledford's memtest (which, despite its name, is also a great random-access disk stressing program), plus mprime on "torture" mode, on all my machines for at least 24 continuous hours before getting them to production. It has saved me from flaky hardware (from intermittent motherboards to weak power supplies) more times than I can count....
It sounds just about perfect ;-)
I've just created it, see: #1004.
I need to reallocate the relevant disks to my machine with good internet bandwidth (which is offsite), right now it's with other disks whose contents are being copied to GDrive. It will be at least a few weeks before I can do that :-( Sorry...
That would be great, and allow me to do that checking you asked for immediately. I just opened an issue for it too, see #1005.
Will do, and let you know (also have to reallocate these pesky disks, but at least it can be done on a local machine, so it will take just a few hours).
Cheers,
Durval.
DurvalMenezes commentedon Jan 9, 2017
Here it is:
So it seems that the files have the same size and encrypted filename, but distinct MD5SUMs.
I hexdumped the start of each file to see how much they differed, and here's what I found:
So it seems that, after the "RCLONE\000\000" header, the files are utterly different. if it was a single byte, or even a sequence of bytes, I would be able to understand that GDrive might have corrupted it... but the entire file?! Only if GDrive managed to somehow replace the entire file content with trash... but it seems it skipped exactly the first 8 bytes of the above header!?
@ncw, I hope the above is helpful for you (and if it isn't, please feel free to request anything else you'd need).
Cheers,
Durval.
4getit commentedon Jan 9, 2017
I'm pretty sure it happens during the upload.
Once a file is corrupted, a download always fails at the same point on different hosts.
I have 1 Google remote with originals and 3 remotes with encrypted copies.
All encrypted remotes have different (single) passwords and it happens with random files. I haven't spotted any issues with non-encrypted files.
Maybe it has to do with 403's because of rate limiting or other retries. I'm using --drive-chunk-size 262144 and --transfers 16 to keep things going.
I'm pretty convinced that the original files are ok and all encrypted copies contain different corrupted files. However, I have no way to determine which ones are corrupted.
In addition to fixing it, I think it would be great to somehow (optional?) calculate the encrypted md5 from the non encrypted file before a sync (and I guess copy as well). That way Rclone can properly detect if an upload was successful and, in case of sync, corrupted files will be replaced. (Because right now, sync skips them and doesn't do anything.)
ncw commentedon Jan 9, 2017
@DurvalMenezes - thanks for all your testing and for making the issues
Yes that is my reading of it.
Thinking about it further, that is what I'd expect as they have different randomly generated nonces - so that wasn't a particularly useful test, sorry :-(
I thought of another test which might shed some light...
If you could
rclone cat egd:REDACTED/REDACTED/REDACTED/REDACTED.mp4 > tmp.mp4orrclone cat elo:REDACTED.mp4 > tmp.mp4if you prefer and see how big the resulting output is that would be very useful.That will tell us which block to look at to see the corrupted data in the encrypted file you downloaded.
The output file will be some multiple of 65536 long. So take the file size and divide it by 65536 call it N.
This corresponds to a block at offset 32+N*(65536+16). It would be interesting to see what the data in the encrypted version of the file for the next 64k looks like. If it doesn't look like random data then there will be a clue there.
If we see a problem at a
--drive-chunk-sizeboundary it is something to do with the multipart uploading.DurvalMenezes commentedon Jan 9, 2017
Hi @ncw,
You are welcome, it's my pleasure to collaborate.
No problem, and I'm actually relieved to hear rclone encryption use nonces -- otherwise files with the same content would always encrypt to the same thing, which cryptographically is Not a Good Thing(tm).
Here it is, using the elo: "pseudo" remote (as I have already deleted and re-uploaded the errored files on the real GDrive encrypted remote):
So, the decryption failed after exactly 5177609 bytes.
Humrmrmr... presuming you meant N to be an integer: it's close but no cigar, not even minus/plus 1 byte:
If I follow you correctly, this doesn't check either:
I'm not sure that this applies, given that none of the offsets above checks out.
Again if I'm following you correctly, it seems the error occurs at a totally random place, so the rclone decryption called by "rclone cat" on the encrypted remote isn't outputting full blocks(?!)
How can that be?
Cheers,
Durval.
ncw commentedon Jan 9, 2017
Try that with the
-qflag --vwrites to stdout by defaultDurvalMenezes commentedon Jan 9, 2017
Doesn't seem like a good idea with a subcommand like "cat"... :-) Also, I faintly remember discussing something about rclone in general (not only cat) actually writing error messages and the like to stderr instead of stdout -- guess it hasn't made it into the code yet.
Anyway, without further ado, here it is:
And of course now the numbers check out:
So, if I follow your thinking, the encrypted file was corrupted after exactly 79 blocks, and the interesting block for us will begin at offset 5178640.
Having an initial look at it:
This looks pretty random to me...
Checking whether it is really random (ie, the probable result of rclone encryption), by testing the entire 64K block with the venerable ent program:
So it seems to be really random.
Waiting for your further thoughts/instructions...
Cheers,
Durval.
80 remaining items
ncw commentedon Feb 12, 2017
I've implemented rclone cryptcheck (see #1102) in this beta which gives an alternative way of checking that a crypt remote is intact.
http://beta.rclone.org/v1.35-91-g01c747e-cryptcheck/ (uploaded in 15-30 mins)
Here are the docs
rclone cryptcheck checks a remote against a crypted remote. This is
the equivalent of running rclone check, but able to check the
checksums of the crypted remote.
For it to work the underlying remote of the cryptedremote must support
some kind of checksum.
It works by reading the nonce from each file on the cryptedremote: and
using that to encrypt each file on the remote:. It then checks the
checksum of the underlying file on the cryptedremote: against the
checksum of the file it has just encrypted.
Use it like this
You can use it like this also, but that will involve downloading all
the files in remote:path.
After it has run it will log the status of the encryptedremote:.
Usage:
rclone cryptcheck remote:path cryptedremote:path [flags]
ncw commentedon Feb 12, 2017
Correction: this is the beta http://beta.rclone.org/v1.35-92-g18c75a8/ (uploaded in 15-30 mins)
ncw commentedon Feb 14, 2017
I'm going to close this now as the underlying issue was fixed by 2abfae2
DurvalMenezes commentedon Feb 18, 2017
Great news, @ncw! Is that fix in the latest beta? I will use it to continue my copying and then will do the
md5sum -con the rclone mount` directory tree and let you know how it goes.ncw commentedon Feb 20, 2017
@DurvalMenezes yes that fix is in. Are you copying over the network from a crypted drive? If so that will be the fix.
DurvalMenezes commentedon Feb 26, 2017
Hello @ncw,
Humrmrmr... right now (and for the last two months), I'm copying from a local filesystem to my encrypted GDrive. But previously I was copying from an encrypted Amazon Cloud Drive to the encrypted Google Drive, and these errors may very well be from that time.
I will pay attention and report back if I get any errors from files that definitely were copied from the local filesystem instead of from a encrypted remote.
ncw commentedon Feb 27, 2017
@DurvalMenezes thanks for the confirmation and let me know if you do see any errors that were definitely copied from the local filesystem.
DurvalMenezes commentedon Mar 3, 2017
For what it's worth (I suspect not much right now that @ncw reported fixing the original cause), I just noticed that the latest
rclone cat --tail 1 --discardI left running here (with--checkers 4to avoid being banned) finished (after 18 and a half days -- ouch). The final stats block from the log file was:So 914 errors in ~6.8M files... too much to check by hand, and as I mentioned above, probably not worth the trouble right now. Also, I suspect quite a few files are missing above (my numbers indicate something more like ~8M files on that remote).
What I will do is to run a
rclone cryptcheckon the largest directory on this remote, and then a recursivemd5sum -cand report back here. Please stay tuned ;-)If @ncw or anyone wants details on the above
rclone cat --tail 1 --discardrun, please contact me in the next few days (before I delete the 300MB log file).Cheers,
Durval.
ncw commentedon Mar 3, 2017
@DurvalMenezes I'd be tempted to grep out the failing files from the log and put them in a form I could pass to --files-from. You could then use the -I flag to unconditionally upload them.
calisro commentedon Apr 12, 2017
For what it is worth, I just ran this on my google drive remote that I created as a clone of another google drive remote and I had zero errors:
rclone -v cat --tail 1 --stats 1m --discard zonegd-cryptp:
no ban either. I'll also run this on the source I created. The source was created with copy/sync from a local share.
Both remotes are crypted.
EDIT: oh its marked fixed. :( Thats what I get for reading on my phone!!!
DurvalMenezes commentedon Apr 12, 2017
Folks, I'm sorry for my lack of participation on this issue; I simply haven't had the time, as RL is taking a real toll here in the last few weeks.
@calisro: can you tell us how many files and GBs were on those remotes?
Cheers,
Durval.
calisro commentedon Apr 12, 2017
Smaller than yours. 3TB with 96,000 files.
calisro commentedon Apr 12, 2017
Also I use my own client id so I can track my quotas in the API dashboard.
DurvalMenezes commentedon Apr 19, 2017
Hello everyone,
I've managed to finish (in principle, as "rclone sync" has run to the end and reported no errors both on the last "Errors: " log line, and in its final process exit status (ie, "echo $?" prints a 0) copying an entire, very large local filesystem (my largest so far, with ~8M files totaling ~3.8TB) to Encrypted GDrive.
Now that rclone sync has finished, I'm doing a "md5sum -c" on an rclone mount of the resulting directory on the encrypted GDrive; it's about 10% done, and so far I've got no errors; this is AFAIK excellent news, as previously (with older versions of rclone, I'm using v1.36 now) it started reporting all sorts of errors way before that point.
In particular, no "failed to authenticate" errors mean, if I understand things correctly, that either @ncw's original diagnosis (that the errors were caused by remote-to-remote copying) was correct, or that his fix really corrected the root cause of this issue (or possibly both). But anyway, seeing no errors so far makes me a very happy camper! ;-)
On a side note, I'm seeing output from rclone mount along these lines:
2017/04/19 03:03:34 REDACTED/REDACTED/REDACTED/REDACTED/REDACTED/REDACTED.mp4: ReadFileHandle.Read error: low level retry 1/100: unexpected EOF
At this point (a few hundreds of thousands of files checked), I got exactly 16 of these errors; and, none of these errors has resulted in any issues being reported by the "md5sum -c" which is reading these files . So, I think the low level retries on these errors are now actually working (they weren't previously: md5sum reported errors when those things happened).
So, it seems we have only good news so far; when this md5sum -c has finished (which I estimate will take a couple of days more), I will post an updated report.
Cheers,
Durval.