Nextcloud : failed update and restore

,

[EN : will translate if needed]

Je fais ce post car j’ai eu très chaud suite à la dernière màj de nextcloud :
TL;DR : l’update a failé et la sauvegarde automatique n’était pas bonne, du coup yunohost a tout supprimé et m’a laissé sans cloud !!! J’ai pu restaurer (avec un bug) une sauvegarde précédente.

Détails de l’opération (pour que la team puisse investiguer, ping @JimboJoe) :
1 - lancement de yunohost tools upgrade depuis une connexion SSH
2 - l’opération est longue, sans message d’avancement, et ma connexion SSH tombe
3 - Je me reconnecte, le journal d’opération s’arrête à “creating backup…” et le processeur galère
4 - Je kille le processus (python) pour recommencer en ayant la main sur la commande : yunohost lance alors le script restore-backup, puisque l’upgrade s’est mal passée.
5 - la sauvegarde est incomplète, donc restore-backup échoue (en envoyant les messages tjs sur ma session SSH perdue), je le lis dans les logs.
6 - Je n’ai plus de Nextcloud ! :frowning_face: Heureusement le dossier yunohost.app/nextcloud qui contient mes données est toujours là. Le fichier de sauvegarde foiré fait 9,9Go, je pense qu’il y a eu un souci avec tentative de backup “full” (app+data) qui m’aurait bien embêté !

Restauration :
Je décide de restaurer l’app à partir d’une sauvegarde récente faite avec yunohost. Et là, nouvelle erreur !

  - 2019-04-03 18:44:04,104: DEBUG - + useradd --no-create-home --system --user-group nextcloud --shell /usr/sbin/nologin
  - 2019-04-03 18:44:04,506: DEBUG - + ynh_die 'Unable to create nextcloud system account'
  - 2019-04-03 18:44:04,507: WARNING - useradd: group nextcloud exists - if you want to add this user to that group, use -g.
  - 2019-04-03 18:44:04,550: DEBUG - + echo 'Unable to create nextcloud system account'

Du coup, je décide de recréer le user nextcloud à la main en suivant le conseil du message d’erreur (ajout au groupe nextcloud avec -g nextcloud).
La restauration s’est ensuite passée sans souci.

Voilà ma petite frayeur, je reste à disposition des devs pour partager des logs et investiguer ! Je crois que l’update attendra un peu…

J’ai donc les logs suivants :

  • 20190403-150435-app_upgrade-nextcloud.log
  • 20190403-155909-app_remove-nextcloud.log
  • 20190403-164314-backup_restore_app-nextcloud.log
  • 20190403-164405-remove_on_failed_restore-nextcloud.log

Hello,
Merci pour ton retour d’expérience !
Je pense que rien ne sera vraiment robuste facilement à un arrêt sauvage comme tu l’as provoqué…
Ce que je peux te conseiller, c’est de lancer les opérations longues en SSH dans une session screen. Ainsi, si tu es déconnecté, l’opération se poursuivra sans problème (tu peux par exemple éteindre ton PC client), et tu récupéreras ta session là où tu l’avais laissé via screen -d -r :wink:

Yep, c’est bien mon bilan de cette belle frayeur :sweat_smile:

Cependant, comment expliques-tu le backup de plusieurs Go généré par l’update, alors que je n’ai pas indiqué “backup_core_only=0” dans mes configs ? Mes dernières sauvegardes nextcloud pèsent quelques 100Mo…

Hm, très bonne question…
Le mécanisme qui régit le fait que les données du /home/yunohost.app ne soient pas sauvegardée quand c’est préalablement à un upgrade a été modifié suite à la mise aux nouvelles normes du package par @Maniack_Crudelis
Une idée là-dessus, @Maniack_Crudelis ?

Is it a stable YunoHost or a testing version ?

As far as I can see, the backup should have be done without the data.
Nextcloud upgrade uses ynh_backup_before_upgrade, which set BACKUP_CORE_ONLY when creating the backup.
As the backup script use is_big argument for the data, https://github.com/YunoHost-Apps/nextcloud_ynh/blob/master/scripts/backup#L83 (is_big is the third argument), the backup shouldn’t have backed up that part, https://github.com/YunoHost/yunohost/blob/stretch-stable/data/helpers.d/filesystem#L55.

By the way, a documentation should be written about all our environment variables, like BACKUP_CORE_ONLY and others.

It would be interesting to have a look to your backup log.

It’s a stable version, 3.4.2.4. Here is the log from the yunohost tools upgrade operation, and as I explained I killed the backup job before the “17:58:32,645” timestamp.

Unfortunately I can’t find any detailed log for the backup operation itself… Is there one somewhere ?
The (failed) restore-nextcloud contains passwords :confused: so I don’t share it as is, but there is the error about the already existing nextcloud group… In the removal operation, there was a warning : 2019-04-03 18:01:37,285: WARNING - userdel: group nextcloud not removed because it has other members.

PS : Mes calendriers et carnets d’adresse (apps nextcloud). sont inaccessibles hormis en web. Je regarderai ça demain…

More details : in yunohost.backup/tmp/, the info.json file contains :

{"size_details": {"apps": {"nextcloud": 48615849571}, "system": {}}, "description": "", "created_at": 1554303889, "apps": {"nextcloud": {"version": "15.0.4~ynh1", "name": "Nextcloud", "description": "Access & share your files, calendars, contacts, mail & more from any device, on your terms"}}, "system": {}, "size": 48677607671}

And the file created before interruption is 9.9G Apr 3 17:58 nextcloud-pre-upgrade1.tar.gz

I’m really wondering if we should still use the old backup script during the upgrade…
Here the problem:

As explained before, everything should work smooth. With the correct backup script…
But the upgrade ask for a backup, which is done with the previous backup script.
This old script doesn’t set is_big https://github.com/YunoHost-Apps/nextcloud_ynh/blob/6f26cb657fb258b1fe94d2bf69b33fd64ffb4ec6/scripts/backup#L85.
So the data are backed up…

A quick fix would be to set back backup_core_only in the upgrade script, then to remove it after the backup.

2 Likes

Same problem reported on the Official topic, and on github here

Yep, same problem here the backup seems to be done on ALL the datas.
I have 92G of data and plenty of room for the backup so I’m waiting but I think I will be ok.

People with small VPS or RPI will have a bad surprise…

Edit: After ~3hrs upgrade is ok and I have a huuuge backup file ine /home/yunohost.backups/archives

1 Like

Same here. not enough space to backup then…

As announced here by @Maniack_Crudelis, a stable version has been released yesterday to fix that issue.