Files get deleted on desktop client when nextcloud gets rolled back

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 20.0.5): 24.0.4
Operating system and version (eg, Ubuntu 20.04): Linux 5.15.0-43-generic x86_64 (docker)
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.54
PHP version (eg, 7.4): 8.0.22

The issue you are facing:
Desktop clients files get deleted when nextcloud gets rolled back

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. Sync client to nextcloud server
  2. Backup nextcloud server
  3. Make changes on client’s files / create new files
  4. Turn off client
  5. Restore nextcloud to the last backup on step 2.
  6. Turn on client
  7. Files on client are following whatever was on the last backup of nextcloud server. New files that were created after the last backup gets deleted, where it is supposed to be synced to the nextcloud.

When you restore the server from backup, did your backup method maintain the original file timestamps?

yes, the backup maintain the original file timestamps. i tar.gz the entire docker container and datas.

let me clarify a bit on the steps i did:

  1. Sync client to nextcloud server
  2. Backup nextcloud server
  3. Make changes on client’s files / create new files
    3a. then SYNC client again to nextcloud. (if i skip this 3a, then all is normal, file on client don’t get deleted.
  4. Turn off client
  5. Restore nextcloud to the last backup on step 2.
  6. Turn on client
  7. Files on client are following whatever was on the last backup of nextcloud server. New files that were created after the last backup gets deleted, where it is supposed to be synced to the nextcloud.

My guess is that the client believes it has already uploaded these files (which it has), and then they were deleted server side, so it mirrors the change client side.

Maybe a config flag could be added to the server to let clients know to re-upload any missing files on their next sync in a case like this.

What happened on the server that made a restore from backup necessary?

Nothing happened on the server. I was just experimenting on it, making sure that i was able to move the docker container on a whole new server. And so I did, the move was success. Except that i found that bug along the way. I repeat the proccess, and it happens all the time.

That’s not a bug. The client is designed to delete a file if it’s deleted on the server or another client.

Hi everyone, did you see this?
https://docs.nextcloud.com/server/stable/admin_manual/maintenance/restore.html?highlight=maintenance:data-fingerprint

This command makes sure that the desktop client updates its changes after a backup was restored, afaik.