Restore Notes from Backup

Hi, yesterday I performed an update of nextcloud and an update of the nextcloud apps. Today most of my notes are gone (in the front end, in the shell I can see all notes with different file sizes) and those which are still there are corrupt.
I have setup an automatic backup and this is available. How can I extract the notes from that backup?

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): 23.0.6.1
Operating system and version (eg, Ubuntu 20.04): Raspbian GNU/Linux 10. 5.10.103-v7l+ (armv7l)
Apache or nginx version (eg, Apache 2.4.25): Apache

The issue you are facing:

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

If you see some errors due to an update, it’s always good to check if the error is known to the developers and if not to report it:

they might have a solution and a fix what to do. I am not a notes expert, so I just suppose that the notes are stored in the database. If so, it depends a bit if the real data is corrupt or if it is just a problem with the app, so if you restore to an older version of the app, it will work without manual restore.

I just suppose that the notes are stored in the database

No, the Notes app stores its notes as casual text files within the users folder.

They should therefore be simply next to your other files in your backup. You can extract them with any tool of your choice and view them with any text editor.

Please verify, that you are able to view the files this way. If not, your backup itself is corrupted and therefore worthless (how did you do it? the issue is not limited to the Notes app in this case).

Disclaimer: If you don’t use the above linked Notes apo but Carnet or Quick Notes or whatever, the notes are stored in a database.

Hm, I have created a new test note and tried to cat it on the shell in ‘/var/www/nextcloud/data/Bernd/files/Notes’ by using

cat /var/www/nextcloud/data/Bernd/files/Notes/Test.md

But the file is encrypted. How can I decrypt the file? It’s not plain text.

Why is it encrypted? Did you enable E2EE for your instance? Are all of your files (besides your notes) encrypted?

Notes itself doesn’t store the text files encrypted, so I assume it has something to do with your general Nextcloud setup.

Serverside Encryption is enabled. Do I need to restore the keys as well? They are stored alongside the files folder in my backup…

Without the key you can obviously not read encrypted files, so: yes.

However, as far as I can see, this issue is not related to the Notes app in any way (or to be more specific: It is not limited to the Notes app).

Let me summarize:

  1. You had corrupted files (caused by a broken upgrad of your Nextcloud instance?)
  2. You now want to restore your files from a backup
  3. Since you enabled e2e encryption, the files of your backup are encrypted
  4. You need to decrypt your files now to continue working

Let me suggest to open a new support request in the end-to-end-encryption category with those steps to clarify how you can recover your encrypted files - as stated above, this is actually no Notes specific issue.

I would move the topic, but all in all I think that the history of this thread is only confusing for other supporters. You might want to link to this topic though.