gocryptfs: Corrupt files and folder when gocryptfs cipherdir is synchronised via Syncthing

I have started observing this during the last 2 weeks or so, albeit on a smaller scale.

In previous cases corruption was mostly affecting git indexes, but here damage is more extensive:

$ gocryptfs -fsck gocrypt/
Password: 
Decrypting master key
OpenDir ".": invalid entry "Q42GWQmqmH5GvujP8DOrdg": bad message
fsck: corrupt entry in dir "": "Q42GWQmqmH5GvujP8DOrdg"
OpenDir "mhzofRHRP2shWMMtzv6ZEA": could not read gocryptfs.diriv: no such file or directory
fsck: error opening dir "xxxxxxxxx/xxxxxxxxxx/xx/xxxxxxxx/xxxx/xxxxxxxx": 5=input/output error
OpenDir "CmE5cc0HwXERKp3e6lO3gA": invalid entry "BS1jRx94o2SPZE3VVoKduw": bad message
fsck: corrupt entry in dir "xxxx/xxxx/xxx": "BS1jRx94o2SPZE3VVoKduw"
OpenDir "TNYugAMPIEi73eD6AlHZ3A": invalid entry "ErCyzALmrA_6iMQ2je18iQ": bad message
fsck: corrupt entry in dir "xxxx/xxxx/xxx/xxxxxx": "ErCyzALmrA_6iMQ2je18iQ"
OpenDir "YbtQ8679xCEYi324Okt7Bw": invalid entry "Q7lbJVgsU7EQJollS_EUng": bad message
fsck: corrupt entry in dir "xxxx/xxxx/xxx/xxxxxx/xxxxx": "Q7lbJVgsU7EQJollS_EUng"
OpenDir "8eOpARKnAQAbCBLVaVIBgg": invalid entry "r3UIaZYYMDQQjIOfM4WpJQ": bad message
OpenDir "8eOpARKnAQAbCBLVaVIBgg": invalid entry "XHaLuVAw3rTZ0A72ErwQDw": bad message
fsck: corrupt entry in dir "xxxx/xxxx/xxxxxx": "r3UIaZYYMDQQjIOfM4WpJQ"
fsck: corrupt entry in dir "xxxx/xxxx/xxxxxx": "XHaLuVAw3rTZ0A72ErwQDw"
OpenDir "EOiNnPbRmZLFlDZUy1hzRw": invalid entry "J9WwFnSWdFMcRtv88muvpg": bad message
fsck: corrupt entry in dir "xxxx/xxxx/xxxxxx/xxxxxxxxxxx": "J9WwFnSWdFMcRtv88muvpg"
OpenDir "xCcc7WlHYQ-CC31Q-T5yIw": invalid entry "LKwyeRtRF_0Bd-OWgPEAnA": bad message
fsck: corrupt entry in dir "xxxx/xxxx/xxxxxx/xxxxxxxxxxx/xxxx": "LKwyeRtRF_0Bd-OWgPEAnA"
OpenDir "mLOdyr1FCyOnfNa2332zIQ": invalid entry "nuPcy1D81IzB3sKpQiGSFQ": bad message
fsck: corrupt entry in dir "xxxx/xxxx/xxxxxxxx": "nuPcy1D81IzB3sKpQiGSFQ"
OpenDir "h5wPJK5dw21t-8bQLhfkuw": invalid entry "360a5xjQI5NYzUrCQzyb-A": bad message
fsck: corrupt entry in dir "xxxx/xxxx/xxxxxxxx/xxxxxxxx": "360a5xjQI5NYzUrCQzyb-A"
OpenDir "n4buocgPjyZ8eRSeAqCk7g": invalid entry "7Iifijp3w-TGxvt57TVMFw": bad message
fsck: corrupt entry in dir "xxxx/xxxx/xxxxxxxx/xxxxxxxxxxx": "7Iifijp3w-TGxvt57TVMFw"
OpenDir "cOo3UWTinz-Nrzmnojz2Og": invalid entry "Wo87J3NGSRa_D7KfTiF-0Q": bad message
fsck: corrupt entry in dir "xxxx/xxxx/xxxxxxxx/xxxxxxxxx": "Wo87J3NGSRa_D7KfTiF-0Q"
OpenDir "n15XaS9mDqLXjQXYUtkdUw": invalid entry "3cYjofmRbfOomOT_oZvRug": bad message
fsck: corrupt entry in dir "xxxx/xxxx/xxxxxxxxx": "3cYjofmRbfOomOT_oZvRug"
OpenDir "vPa5sYKAdS1HNODvxUnGcw": invalid entry "fNOALh19-Gk_Nfq3f9q5kQ": bad message
fsck: corrupt entry in dir "xxxx/xxxx/xxxxxxxxx/BSD": "fNOALh19-Gk_Nfq3f9q5kQ"
OpenDir "Re1tpEUGMO9Rh2aW8LI_yg": invalid entry "ww0XqKavBZqE3xoTXUPJLA": bad message
fsck: corrupt entry in dir "xxxx/xxxx/xxxxxxxxxxxx": "ww0XqKavBZqE3xoTXUPJLA"
OpenDir "xWrSDaS9XCmZxVin_3UkVA": invalid entry "4NtZBOl8UevnjabTYHT5XA": bad message
fsck: corrupt entry in dir "xxxx/xxxx/xxxxxxxxxxxx/xxxxxx": "4NtZBOl8UevnjabTYHT5XA"
OpenDir "dUr7Tfadq4vJXBetXhrAGw": invalid entry "QsBR3hImqbjav3TYaR7YxQ": bad message
fsck: corrupt entry in dir "xxxx/xxxx/xxxxxxxxxxxx": "QsBR3hImqbjav3TYaR7YxQ"
OpenDir "G0PrT6uQD760thIUu_PZfg": invalid entry "Ie_9LDDFJMkoOv2FhKgueg": bad message
fsck: corrupt entry in dir "xxxx/xxxx/xxxxx": "Ie_9LDDFJMkoOv2FhKgueg"
fsck summary: 19 corrupt files, 0 files skipped

Folder that shows 5=input/output error is displayed in clear-text as empty.

Is there anything I can do to help with investigating this issue? Or maybe there is some underlying incompatibility of GoCrypt share being synchronised bi-directionally?

Thanks.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (9 by maintainers)

Commits related to this issue

Most upvoted comments

Dear syncthing users, can you see if you can still trigger this problem with v2.0-beta3 ? This has the “track most recent parent” improvement (see changelog)

Download from https://github.com/rfjakob/gocryptfs/releases/tag/v2.0-beta3

gocryptfs v2.0 is out some time now containing the improvements. I tested some time ago with syncthing and was unable to cause problems. Even without -sharedstorage this should not happen anymore.

Unless somebody notices otherwise I’ll call this fixed.

Keyboard layout problem maybe? I don’t think so, this is pretty strange I agree, but I haven’t change devices or anything and this is on mutiple devices between two people. I guess until it happens again it’ll only be a fluke (maybe I changed the password while sleeping)

Todos for go-fuse to make things more robust even without -sharedstorage:

  1. Clear parents map if out.Nlink == 1? —> https://github.com/hanwen/go-fuse/blob/0f728ba15b38579efefc3dc47821882ca18ffea7/fs/bridge.go#L210

  2. Select last know-good parent instead of random? —> https://github.com/hanwen/go-fuse/blob/0f728ba15b38579efefc3dc47821882ca18ffea7/fs/inode.go#L293 Implemented in https://review.gerrithub.io/c/hanwen/go-fuse/+/513646/2

I have reached the same issue. I have 3 devices (server, PC and android) and I am syncing every device with all the others.

I do not see “corrupt entry errors” but I have OpenDir ".": invalid entry ".stfolder": illegal base64 data at input byte 0 `