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

,

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 ?

Tu devrais peut être essayer d’extraire le info.json avec la commande tar pour qu’on vois à quoi il ressemble

EDIT: Oublis je viens de voir qu’il est en haut…

1 Like

I suggest you to try again with this working archive and to disable the installation of php7.3 by disabling the helper

cp /usr/share/yunohost/helpers.d/php /root/php.bkp
echo "ynh_install_php () { true }" >> /usr/share/yunohost/helpers.d/php

Then you try to restore your archive (potentially by installing php manually with apt before).
Then

cp /root/php.bkp /usr/share/yunohost/helpers.d/php 
1 Like

Et ben en fait je ne relis même pas le fil que je fais pour documenter le problème, j’avais moi-même oublié que j’avais une archive “fonctionnelle” :sweat_smile: