Files encrypted but database corrupted, backups lost

Hello Nextcloud users.

Background:
I know, it’s totally stupid, I’ve lost my database backups and somehow messed with my /data directory during an update, a lot of files are accessible - some important other files aren’t.
I’ve updated from 9.something to 10.0.1 and moved files accidentally during the update. I even knew that I messed up but thought “aah, so what, I’ve got backups” BUT, the script which I used with cron to backup the database didn’t work because rsnapshot deleted the databases every night after a backup :-/. So I’ve got a few snapshots of my /data folder but no database backup.

Errors I get:
“app”:“webdav”,“message”:"Exception: {“Message”:"HTTP\/1.1 503 Encryption not ready: multikeydecrypt with share key failed:error:0407106B:rsa

Question:
Is there a way to rebuild the whole owncloud files database from scratch? Or can I decrypt my files somehow, if they are inaccessible via webdav/webinterface due to a corrupted database?

Please help me out and thanks in advance
Ray

  1. Make a backup of everything you have in your current state.
  2. Do you use external storage? If not, why are you using the encryption app?

To decrypt files, you normally don’t need the database. If you run a occ files:scan --all, this should update the file-index of your Nextcloud. Then you must have enabled the encryption app and the default encryption module. Check the user directory, if the keyfiles are still present (data/<user>/files_encryption).

You can also decrypt all files for a user from command line. All these details should be on this documentation page:
https://doc.owncloud.org/server/9.1/admin_manual/configuration_files/encryption_configuration.html

Please read through it before proceeding any further.

thank you for your quick reply

sudo -u apache /var/www/html/owncloud/occ encryption:status

  • enabled: true
  • defaultModule: OC_DEFAULT_MODULE

/data/user/files_encryption contains a lot of files and folders I don’t know where to look at exactly. I’ve got a folder in which half of the files are accessible and the other half aren’t.
Filescan didn’t change anything. I’ve found a lot of OC_DEFAULT_MODULE folders containing “filekey” and “*.shareKey” files. All are present, even those of the inacessible files

Does this help somehow?!

Did you enable the the default encryption module-app?

sure, thought that was clear.
Doesn’t "sudo -u apache /var/www/html/owncloud/occ encryption:status

  • enabled: true"
    confirm that?

I’m not an expert for this encryption app. As far as I can see, you’ve tried everything mentioned in the docs, so I suggest that you open a bug report on github.com/nextcloud/server/issues

There is a similar thread but with no solution either: Files opening problem after change SSL encryption key and update to nextcloud 10.x.x