Nextcloud update failed because a safety backup could not be created

What app is this about, and its version: Nextcloud (nextcloud) de 32.0.6~ynh2
What YunoHost version are you running: 12.1.39 (stable)
What type of hardware are you using: Other ARM board

Describe your issue

I try to upgrade NC from 32.0.6-ynh2 to 33.0.1~ynh1.
And I get :

YunoHost a rencontré une erreur interne
Vraiment désolé de cela.
Vous devez chercher de l’aide sur le forum ou le chat pour corriger la situation,
ou signaler le bug sur le bugtracker.
Les informations suivantes peuvent être utiles à la personne qui vous aide:

Erreur: “500”
Action: “PUT”/yunohost/api/apps/nextcloud/upgrade

Message d’erreur:

Aborting the upgrade, because a safety backup could not be created (Échec
de la collecte des fichiers à sauvegarder)

Pendant le traitement de l’action, le serveur a dit:

Collecte des fichiers devant être sauvegardés pour nextcloud…
Declaring files to be backed up…
/home/yunohost.app/nextcloud will not be saved, because ‘BACKUP_CORE_ONLY’ is set.
File or folder ‘/etc/php/8.3/fpm/pool.d/nextcloud.conf’ to be backed up does not exist
Échec de la collecte des fichiers à sauvegarder pour nextcloud.

Share relevant logs or error messages

https://paste.yunohost.org/raw/dimiqoxihi

2 Likes

I don’t have any access to my NC anymore.

I have this message instead

“502 Bad Gateway

If you see this page, your connection with the server is working but the internal service providing this path is not responding.

Administrator, make sure that the service is running, and check its logs if it is not. The Services page is in your webadmin, under Tools > Services.

Thank you for using YunoHost.”

I’ve restarted Yunohost.

My external hard drive is up and running and the Nexcloud folder is still there with my data…

1 Like

I have the same issue.

I looked back further & the original upgrade failed… the retry gives the can’t create backup error.

The original error is around installing php8.4 libraries, see log. Looks like it can’t find the packages in the apt repo. I can see php84.-* packages, but there’s no hyphen (-) in the package names in the upgrade script. Maybe that’s the issue. :person_shrugging:

I did find the original pre-upgrade) backup in the /yunohost/#/backup folder, and (after uninstalling the app) I was able to restore the previous version. Don’t know if that’s helpful @eeaiou ?

J’ai le même souci.

Je ne peux pas copier de lien pour mes logs car utilisateur trop récent…

Faut-il que je copie ici ?

merci

Same problem here “yunohost backup create --apps nextcloud --debug“:

3710 WARNING File or folder ‘/etc/php/8.3/fpm/pool.d/nextcloud.conf’ to be backed up does not exist
3712 DEBUG + ynh_exit_properly
3713 DEBUG + local exit_code=1
3714 DEBUG + [[ backup =~ ^install$|^upgrade$|^restore$ ]]
3715 DEBUG + ‘[’ 1 -eq 0 ‘]’
3716 DEBUG + trap ‘’ EXIT
3717 DEBUG + set +o errexit
3718 DEBUG + set +o nounset
3719 DEBUG + sleep 0.5
4192 DEBUG + exit 1
4296 DEBUG Could not run script: /var/cache/yunohost/app_tmp_work_dirs/app_2n29uvtb/scripts/backup
4307 ERROR Failed to collect files to backed up for nextcloud.
4321 INFO The operation ‘Create a backup archive’ could not be completed. Please share the full log of this operation using the command ‘yunohost log share 20260330-162458-backup_create’ to get help
4346 DEBUG action executed in 3.702s
4347 DEBUG lock has been released
4348 ERROR Failed to collect files to be backed up

How can I help to fix this?

[EN] I have the same error

Temporary Workaround:

  1. Delete the app, (and verify that the option “deleted also data” remains uncheck)
  2. Restore the pre-upgrade backup.

Permanent solution: (see this: Yarn and Sury APT keys issues )

  1. Access your server with ssh
    1. sudo rm /etc/apt/trusted.gpg.d/{yarn,extra_php_version}.gpg
      
    2. sudo yunohost tools regen-conf apt
      
    3. sudo apt update
      
  2. Access your server with webadmin GUI:
    1. update php services
    2. update nextcloud

it’s working :slight_smile:


[FR]

J’ai exactement le même problème

Résolution temporaire:

  1. Supprimer l’app Nextcloud (en vérifiant que l’option “effacer aussi les données” reste décochée)
  2. Restaurer le backup de pre-upgrade

Résolution permanente: (source: Yarn and Sury APT keys issues )

  1. Accédez à votre serveur en ssh
    1. sudo rm /etc/apt/trusted.gpg.d/{yarn,extra_php_version}.gpg
      
    2. sudo yunohost tools regen-conf apt
      
    3. sudo apt update
      
  2. Accédez à l’interface d’administration en ligne de votre serveur
    1. Lancez les mise à jour de php
    2. Lancez la mise à jour de nextcloud

C’est terminé :grinning_face:

3 Likes

Try to just do a backup

yunohost backup create --apps nextcloud

Then do the update without backup with the -b option.

yunohost app upgrade -b nextcloud
1 Like

@RaggedStaff @dontcallmehorst @grigri007 @eeaiou
Did you check if the sury repo signing key is up to date ?
Do yunohost tools update and sudo apt update return errors related to a signature verification?
If so, see

1 Like

[EN]

Hi,
On my side I was able to solve the problem in the following way:
1 - Remove Nextcloud and restore the backup pre-upgrade as indicated in other posts above
2 - Install php packages that appear failed in the logs:
sudo apt update; sudo apt install php8.4-common php8.4-opcache php8.4-readline php8.4-cli php8.4-phpdbg php8.4-fpm php8.4 php8.4-bcmath php8.4-bz2 php8.4-curl php8.4-gd php8.4-gmp php8.4-intl php8.4-ldap php8.4-mbstring php8.4-mysql php8.4-sqlite3 php8.4-xml php8.4-zip
3 - redo nextcloud update

And that’s it. I think it’s related to the fact that the update script is trying to install the 8.4.17 packages, while the repository contains the 8.4.18 packages. I leave it to people more competent than me to validate or not this method.

[FR]

Salut,
De mon coté j’ai pu résoudre le problème de la manière suivante :

1 - Suppression de Nextcloud et restauration du backup pre-upgrade comme indiqué dans d’autres posts ci-dessus
2 - instalation des paquets php qui apparaissent en échec dans les logs :
sudo apt update ; sudo apt install php8.4-common php8.4-opcache php8.4-readline php8.4-cli php8.4-phpdbg php8.4-fpm php8.4 php8.4-bcmath php8.4-bz2 php8.4-curl php8.4-gd php8.4-gmp php8.4-intl php8.4-ldap php8.4-mbstring php8.4-mysql php8.4-sqlite3 php8.4-xml php8.4-zip
3 - refaire la mise à jour de nextcloud

Et c’est tout. Je pense que c’est lié au fait que le script de mise à jour cherche à installer les paquets en versions 8.4.17, alors que le dépot contient les paquets en version 8.4.18.

Je laisse le soin à des gens plus compétents que moi de valider ou non cette méthode.

2 Likes

@otm33 That was an issue. :folded_hands:

I don’t see logs

Manually installing dependencies, will leave them installed even if they are not needed anymore (removing the app, upgrading to the next version of php). It doesn’t harm but you will have extra packages on your server at some point

Thank you for your reply. In my case, I realised that unused php versions often stay installed when they are not needed anymore, even if I do not install them manually. This is specific to php (I don’t know why), so I make some clean from time to time :

1 - I get all php versions that are used by installed apps.
lsof | grep /var/run/php | awk ‘{print $9}’ | sort -u | cut -d’/’ -f5 | awk -F’-’ ‘{print $1,$3}’ | cut -d’.’ -f1,2
2 - Then I get all php versions installed.
apt list php* --installed
3 - If I see some unused versions, I remove them, for exemple :
sudo apt remove php8.3*

Bonjour,

J’ai l’erreur 502 bad gateway à l’ouverture de nextcloud après la mise à jour en échec.

Pouvez-vous m’éclairer sur comment restaurer le “backup pre-upgrade” ?

Merci

Dans l’interface d’administration :
1 - Sauvegarde → Archives locales, tu vérifes qu’il y a bien une sauvegarde récente nommée nextcloud-pre-upgrade
2 - Application → Nextcloud → Desinstaller
3 - Sauvegarde → Archives locales → nexcloud-pre-upgrade → restaurer

Merci cette manip m’a permis d’avoir à nouveau accès à mon nextcloud

Bonne soirée

Restoring the pre-upgrade didn’t work for me.

Here’s the log from the pre-upgrade

E: Failed to fetch https://packages.sury.org/php/pool/main/p/php-igbinary/php8.3-igbinary_3.2.16-6%2B0~20251124.56%2Bdebian12~1.gbp1eff65_amd64.deb 404 Not Found [IP: 2a04:4e42:8e::820 443]

E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

The following packages have unmet dependencies:

php8.3-imap : Depends: libc-client2007e but it is not going to be installed

smbclient : Depends: samba-common (= 2:4.17.12+dfsg-0+deb12u3) but it is not going to be installed

Unable to install apt dependencies, it might be due to a conflict with another app - or you should check and share the previous log about what are the problematic dependencies

provision_or_update failed for apt : An error occured inside the script snippet : Unable to install apt dependencies, it might be due to a conflict with another app - or you should check and share the previous log about what are the problematic dependencies

After having uninstalled Nextcloud, it still showed as installed though when opening the link it would redirect me back to the Portal. I couldn’t do the pre-upgrade saying I already had Nextcloud installed and couldn’t install a new instance either. I fixed the errors below first.

When running update I was getting two GPG key errors.

Sury.org I fixed it running sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys B188E2B695BD4743

Then the Yarn key, I ran curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -

and went to /etc/apt/sources.list.d/yarn.list and update the line there with this one /etc/apt/sources.list.d/yarn.list

Now went back to Yunohost admin and check the update, I got 90 new packages to be installed. I ran those. Now I went to uninstall Nextcloud again, which according to the logs failed but it had actually been uninstalled this second time. Then the pre-upgrade was successful.

The following worked for me in YunoHost 13.0.4, even though I was a bit worried to remove the app because I thought it would imply deleting the data, too. Good to know!

Thanks a lot, it helped. I fixed the signature problem, then I was able to install the PHP packages. Then I had to remove Nextcloud and reinstall it.

It’s working again. :slight_smile: