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

[Bug]: 3.12 - Server replied with an error while reading directory "xyz": Encrypted metadata setup error #6452

Closed
5 of 8 tasks
eibex opened this issue Feb 16, 2024 · 15 comments

Comments

@eibex
Copy link

eibex commented Feb 16, 2024

⚠️ Before submitting, please verify the following: ⚠️

Bug description

After upgrading to 3.12 the app cannot sync files to the server as it errors out with: Server replied with an error while reading directory "xyz": Encrypted metadata setup error

iOS e2ee is working just fine

Steps to reproduce

  1. Use Nextcloud Desktop 3.12 with vfs
  2. Setup e2ee
  3. (not sure if anything else is needed to replicate)

Expected behavior

No errors

Which files are affected by this bug

e2ee

Operating system

Windows

Which version of the operating system you are running.

Windows 11

Package

Appimage

Nextcloud Server version

28.0.2

Nextcloud Desktop Client version

3.12.0

Is this bug present after an update or on a fresh install?

Updated to a major version (ex. 3.3.6 to 3.4.0)

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

Are you using an external user-backend?

  • Default internal user-backend
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Nextcloud Server logs

no errors in server logs

Additional info

No response

@allexzander allexzander self-assigned this Feb 19, 2024
@allexzander
Copy link
Contributor

@eibex Could you please reproduce this again and upload client logs to https://cloud.nextcloud.com/s/9FDMAf99KNxZTyy?
Seems not so easy to reproduce. I tried 2 scenarios:

  • setting up E2EE with desktop client 3.12 with VFS on and a server 28.0.2, created a folder, uploaded some files and nested folders, it syncs fine afterwads
  • setting up E2EE with the older desktop client and creating a folder - works too later with 3.12

Did you just set up the E2EE for the first time? Or did you have it set up, with some encrypted folders already uploaded, and then just updated to 3.12?

@eibex
Copy link
Author

eibex commented Feb 19, 2024

Did you just set up the E2EE for the first time? Or did you have it set up, with some encrypted folders already uploaded, and then just updated to 3.12?

I've been using E2EE for 2-3 years now, so the encrypted folders have been created years ago. I will try to upload the logs when I get back home. I can confirm that downgrading back to 3.11.1 does not create an error and allows the program to sync files with the server.

@eibex
Copy link
Author

eibex commented Feb 19, 2024

I have uploaded a censored version of the logs. I removed irrelevant data and folder names.

@allexzander
Copy link
Contributor

@eibex I was able to reproduce. Based on your information and longs, indeed, you have some folders with version 1.1 metadata, that were created a long time ago. The new release 3.12 failed to decrypt those due to a condition. I came up with a solution that should fix the problem. Could you give this build a try https://cloud.nextcloud.com/s/3Z8CZHzxdqTKBRo and let me know if the issue is still present with it? It's a 3.12.50 dev build with my changes on top of 3.12.

@eibex
Copy link
Author

eibex commented Feb 20, 2024

Hi, thanks for the quick PR.
Sadly the linked build did not fix the issue. I'm uploading nc_log2.txt with the latest logs (they seem very similar to the originals).

I scanned previous logs too and didn't find any lines related to updating metadata to v2? (I don't know C++ but from the linked PR I believe files should be migrated to v2 with a log line Migrating from or Could not migrate. No metadata keys found! - correct me if I'm wrong).

@eibex
Copy link
Author

eibex commented Feb 21, 2024

Apologies for the additional comment, I just wanted to ask if you'd like me to keep the folders as they are to keep troubleshooting or whether I should recreate them so that I can circumvent the bug.

I have no problems in keeping them as they are to help fixing the bug as I have the decrypted files backed up elsewhere.

@allexzander
Copy link
Contributor

@eibex Kindly keep them. I know a workaround, but the fix is coming in a few hours.

@allexzander
Copy link
Contributor

allexzander commented Feb 21, 2024

@eibex I was able to find one more overlook for dealing with version 1.1 (the one you have in your metadata) and added a fix, and also made logs more verbose temporarily, the build to try is here https://cloud.nextcloud.com/s/Y6MEwPYAtXmiNgm, hopefully, this time I managed to catch it. If not, please attach the log, as I said, it is much more verbose, so I will have a better picture than I have now.

Btw, by design, we do not auto-migrate folders that contain nested folders. This will only happen if you change something. So, if the last build does not work, the workaround would be to do the change within the encrypted folder while running version 3.11 and having it upload the change. Then, version 3.12 will work with that folder too as it will be 1.2.

@eibex
Copy link
Author

eibex commented Feb 22, 2024

Client syncing as expected. Tried to upload some new e2ee files in the existing folders and it worked too. Thanks!

How would you recommend to update existing folders? Would the easiest way be to delete and reupload them?

@allexzander
Copy link
Contributor

Client syncing as expected. Tried to upload some new e2ee files in the existing folders and it worked too. Thanks!

How would you recommend to update existing folders? Would the easiest way be to delete and reupload them?

I recommend making a backup of these files somewhere else on your machine, then, add some dummy text file (or any file, or do the rename inside those folders), and wait till the client uploads them to the server. Then, install normal 3.12, then uncheck those folders (that had issues) in the selective sync dialog, apply the changes, and wait for sync. Then recheck them and apply. Make sure errors are not present anymore. You will be able to use 3.12 with your folders from that moment. When we release the fix you tested in 3.12.1, you will just update normally.

You can just keep using 3.11 until we have released an update 3.12.1, and do nothing for now.

Many thanks for spending your time testing it.

@russtaylor
Copy link

Thanks so much! I noticed that I was having the same error yesterday, and was happy to find out that the fix was already in progress.

And thanks eibex for reporting the issue & testing the fixed build!

@allexzander
Copy link
Contributor

Fixed with #6471, and will be released in 3.12.1

@eibex
Copy link
Author

eibex commented Mar 27, 2024

Now files created with v2 are uploaded to the server and immediately error out everything showing "encrypted metadata setup error" on first sync by the client following the upload.

Given that iOS E2EE is completely borked right now I guess the only solution is to remove E2EE completely. (Deleting nextcloud desktop folder and recreating does not fix it)

Logs excerpt:

Setting up existing metadata
Failed to setup FolderMetadata. Could not parse/create metadataKey!
serverJob has finished for folder: "xxx"  and it has _isFileDropDetected: false
Server error in directory "xxx" 0
Item  "Nextcloud"  retrieved resulted in  "Server replied with an error while reading directory \"xxx\" : Encrypted metadata setup error!"

@bcutter
Copy link

bcutter commented Apr 1, 2024

Saw this again with Windows client 3.12.3 after updating from NC v27 to v28 once I tried to add a file to an existing (already encryption 2.0) e2ee folder. Details:

nextcloud/ios#2809 (comment)

@Eric-Sparks
Copy link

I, too, am seeing this with 3.12.3. Do I need to open a new bug?

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

6 participants