Can't restore backup (Nextcloud) - wrong json or archive / outdated restore script

  • READ ME AND USE THIS TEMPLATE IF YOU WANT TO GET HELP ! You may ask your question in english or french, whichever is easiest for you… But please use one of the templates provided below :wink:
  • LISEZ-MOI ET UTILISEZ CE MODÈLE DE TOPIC SI VOUS SOUHAITEZ OBTENIR DE L’AIDE ! Vous pouvez poser votre question en anglais ou français, selon ce qui est le plus simple pour vous… Mais de préférence en utilisant l’un des deux modèles fournis ci-dessous :wink:

:uk:/:us: Message template (english)

The “support” category is meant to ask for help or troubleshooting related to installing or using YunoHost or its applications. It is not to ask assistance on general system administration, network administration or special use cases that goes beyond the scope of the project. If you wish to discuss more advanced use case, please post in the “Advanced Use Case” category.

Before posting, please :

My YunoHost server

Hardware: Raspberry Pi at home
YunoHost version: 4.1.8
I have access to my server : Through SSH
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : yes
If yes, please explain: recent restore of a 5 months old backup. Upgrade to Buster and RPI 3 → 4 in the midtime

Description of my issue

When I try to restore my Nextcloud archive, it tells me that there is no info.json file (or no valid one).

But that file is inside the archive, with the right name.
The json is valid (I did an import and export in python to check, it worked).

{"size_details": {"apps": {"nextcloud": 2033254143}, "system": {}}, "description": "", "from_yunohost_version": "3.8.5.9", "created_at": 1600561690, "apps": {"nextcloud": {"version": "18.0.4~ynh1", "name": "Nextcloud", "description": "Consultez et partagez vos fichiers, agendas, carnets d'adresses, emails et bien plus depuis les appareils de votre choix, sous vos conditions"}}, "system": {}, "size": 2137121937}

Sorry for the mistake, I can’t edit my post, I have a 500 internal error…

My YunoHost server

Hardware: Raspberry Pi at home
YunoHost version: 4.1.8
I have access to my server : Through SSH
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : yes
If yes, please explain: recent restore of a 5 months old backup. Upgrade to Buster and RPI 3 → 4 in the midtime

Description of my issue

When I try to restore my Nextcloud archive, it tells me that there is no info.json file (or no valid one).

But that file is inside the archive, with the right name.
The json is valid (I did an import and export in python to check, it worked).

{"size_details": {"apps": {"nextcloud": 2033254143}, "system": {}}, "description": "", "from_yunohost_version": "3.8.5.9", "created_at": 1600561690, "apps": {"nextcloud": {"version": "18.0.4~ynh1", "name": "Nextcloud", "description": "Consultez et partagez vos fichiers, agendas, carnets d'adresses, emails et bien plus depuis les appareils de votre choix, sous vos conditions"}}, "system": {}, "size": 2137121937}

Logs:

INFO Préparation de l’archive pour restauration...
DEBUG Extraction des fichiers nécessaires depuis l’archive…
DEBUG unable to retrieve 'info.json' inside the archive
None
DEBUG action [23252.1] executed in 24.998s

I believe I made an archive after solving this issue: Restauration fails : hook_exec_failed · Issue #353 · YunoHost-Apps/nextcloud_ynh · GitHub
So maybe it’s a rights problem ? But the file is marked as readable by any user…

:up: :pray:

Sorry for the delay

That’s weird but let’s try to investigate:

  • do you have the same archivename.info.json file on the side, outside of the archive ?
  • if you delete (or move) that file elsewhere, and run yunohost backup info [archivename], does it displays the info, or does it crashes as well with the same error ?
1 Like

Yes.
And a modified one too, after json import&export (using python) to be sure the formating was correct.

It clearly takes time (to decompress the archive I guess), so it’s using the file inside the archive…
Same error.

(Note: I already try to restore the backup without that outside-from-archive archivename.info.json json file)

yunohost backup info works well with the json that is not in the archive.

I also tried to create a new archive, while removing the info.json, and replacing it with archivename.info.json (renamed info.json).
Failed with the same error. But I’m unsure about my way to create the archive, I had multiple failures that did not have the proper file structure. Not a tar command expert… :sweat_smile:

Maybe I should try to restore manually… is there any guidance about how to do that ?
I suppose I need to load the helpers and the the restore script manually ?

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.

Alternatively, did someone try to restore Nextcloud from backup files using a new installation ?

My data folder is still there, all I need is “just” the app and its config files…

Yes you can do that if you install same version of nextcloud:

  • Reinstall nextcloud with the good commit to match version inside the archive
  • Put big data in your /home/yunohost.app/nextcloud/data
  • Replace the mysql db with the sql inside archive

You could need to copy extension in the good dir too…

1 Like

How can I know that ? Does the info.json contain that information ?

How can I do that ?

The version of nextcloud was 18.0.4~ynh1. You can try this version of nextcloud_ynh GitHub - YunoHost-Apps/nextcloud_ynh at 63ef78d0364d7b8f06ec2daf7051a4f90b01c877

I am not completely sure this old package could install on 4.2…

To replace mysql db:

source /usr/share/yunohost/helpers
app=nextcloud
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
ynh_mysql_remove_db --db_user=$app --db_name=$app
ynh_mysql_setup_db --db_user=$app --db_name=$app --db_pwd=$db_pwd
ynh_mysql_connect_as --user=$app --password=$app --database=$db_name < PATH_TO_YOUR_DB.sql

Can you display the result and removing all the part with your personnal files ?

tar -tvf YOUR_ARCHIVE.tar.gz

It’s to verify the tree of your archive.

Do you want all the files (130 000 lines) or just the arborescence ?

Here are the basic first levels:

drwxr-x— - admin 20 sept. 2020 apps
.rw-r–r-- 854 root 20 sept. 2020 backup.csv
.rw-r–r-- 414 root 20 sept. 2020 info.json

And in app/apps/nextcloud/ :

drwxr-x— - admin 20 sept. 2020 backup
dr-------- - root 20 sept. 2020 settings

De mon côté la ligne pour le info.json ressemble à ça:

-rw-r--r-- root/root       310 2021-03-04 19:56 info.json

Je me demande ce qu’est le 414 dans ton archive.

Turns out that I had another copy of that file, that is working…

But I have this error:

Do not use ynh_install_php to install php7.3

I believe that I did change the restore script, and replace it with a more recent one (following @Aleks advice if I remember well… :thinking:) as Yunohost version changed a lot since that time :thinking:

So maybe I need to do that again, and find the good way to recompress it :sweat_smile:

Et si je passe tout en root:root ?

En fait je ne sais pas trop quelles sont les différences entre les deux syntaxes…

:up:, sait-on jamais… :slight_smile:

J’ai essayé de restaurer l’archive sur un autre serveur, même problème avec le fichier json… il semble bien y avoir un problème avec mon archive… Problème de droits sur le json ?