[solved]Nextcloud: upgrade timed out on chmod/Incoherent package/No backup possible

Hi,
A few weeks ago, I upgraded my nextcloud instance from 27.1.4~ynh1 to 28.0.2~ynh1. I first disabled the app not supported anymore via commande line, then ran the upgrade via the YunoHost web admin interface before going away from my computer. As I have a few hundred Gb of lots of small files in my data folder, the upgrade usually runs for a few hours.
I remember having a time out message after the upgrade when I came back, but as I had the same error in the previous upgrades and everything was working fine I did not press it further.

However, I noticed today that YunoHost still think I’m on 27.1.4~ynh1 and wants me to upgrade to 28.0.2~ynh1. And indeed, in the manifest I’m still on 27.1.4~ynh1.
I analyzed the issue and noticed that the upgrade log suddenly stops at this command:

2024-02-07 22:54:53,353: INFO - [##############++....] > Reapplying file permissions...
2024-02-07 22:54:53,354: DEBUG - + chown -R nextcloud:www-data /var/www/nextcloud
2024-02-07 22:54:55,930: DEBUG - + chown -R nextcloud: /home/yunohost.app/nextcloud
2024-02-07 22:54:55,935: DEBUG - + find /var/www/nextcloud/ -type f -print0
2024-02-07 22:54:55,936: DEBUG - + xargs -r0 chmod 0644
2024-02-07 22:54:56,557: DEBUG - + find /var/www/nextcloud/ -type d -print0
2024-02-07 22:54:56,559: DEBUG - + xargs -r0 chmod 0755
2024-02-07 22:54:56,909: DEBUG - + find /home/yunohost.app/nextcloud/data/ -type f -print0
2024-02-07 22:54:56,910: DEBUG - + xargs -r0 chmod 0640

So now, if I try to upgrade the package to 28.0.2~ynh1, the upgrade fails during the backup with an error message that the source path is empty:

args:
  apps:
  - nextcloud
  name: nextcloud-pre-upgrade1
  system: null
ended_at: 2024-02-18 09:29:03.815267
error: "Il n'y a rien \xE0 sauvegarder"
interface: cli
operation: backup_create
parent: null
related_to:
- - app
  - nextcloud
started_at: 2024-02-18 09:28:59.267638
success: false
yunohost_version: 11.2.10

============

2024-02-18 10:28:59,446: INFO - Collecte des fichiers devant être sauvegardés pour nextcloud...
2024-02-18 10:28:59,619: DEBUG - Executing command '['sh', '-c', '/bin/bash -x "/var/cache/yunohost/app_tmp_work_dirs/app_9f9sh1dm/scripts/backup"  7>&1']'
2024-02-18 10:28:59,641: DEBUG - + source ../settings/scripts/_common.sh
2024-02-18 10:28:59,642: DEBUG - ++ YNH_PHP_VERSION=8.2
2024-02-18 10:28:59,643: DEBUG - ++ php_dependencies='php8.2-fpm php8.2-bz2 php8.2-imap php8.2-gmp php8.2-gd php8.2-intl php8.2-curl php8.2-apcu php8.2-redis php8.2-ldap php8.2-imagick php8.2-zip php8.2-mbstring php8.2-xml php8.2-mysql php8.2-igbinary php8.2-bcmath'
2024-02-18 10:28:59,644: DEBUG - ++ pkg_dependencies='imagemagick libmagickcore-6.q16-6-extra acl tar smbclient at php8.2-fpm php8.2-bz2 php8.2-imap php8.2-gmp php8.2-gd php8.2-intl php8.2-curl php8.2-apcu php8.2-redis php8.2-ldap php8.2-imagick php8.2-zip php8.2-mbstring php8.2-xml php8.2-mysql php8.2-igbinary php8.2-bcmath'
2024-02-18 10:28:59,645: DEBUG - + source /usr/share/yunohost/helpers
2024-02-18 10:28:59,680: DEBUG - +++ set +o
2024-02-18 10:28:59,681: DEBUG - +++ grep xtrace
2024-02-18 10:28:59,685: DEBUG - ++ readonly 'XTRACE_ENABLE=set -o xtrace'
2024-02-18 10:28:59,686: DEBUG - ++ XTRACE_ENABLE='set -o xtrace'
2024-02-18 10:28:59,757: DEBUG - + source ../settings/scripts/_ynh_mysql_dump_db.sh
2024-02-18 10:28:59,758: DEBUG - + ynh_abort_if_errors
2024-02-18 10:28:59,761: DEBUG - + trap ynh_exit_properly EXIT
2024-02-18 10:28:59,761: DEBUG - + ynh_print_info '--message=Loading installation settings...'
2024-02-18 10:28:59,790: INFO - Loading installation settings...
2024-02-18 10:28:59,790: DEBUG - + app=nextcloud
2024-02-18 10:28:59,791: DEBUG - ++ ynh_app_setting_get --app=nextcloud --key=final_path
2024-02-18 10:28:59,793: DEBUG - ++ local _globalapp=nextcloud
2024-02-18 10:28:59,893: DEBUG - ++ app=nextcloud
2024-02-18 10:28:59,897: DEBUG - ++ [[ final_path =~ (unprotected|protected|skipped)_ ]]
2024-02-18 10:28:59,898: DEBUG - ++ ynh_app_setting get nextcloud final_path
2024-02-18 10:29:00,109: DEBUG - + final_path=
2024-02-18 10:29:00,111: DEBUG - ++ ynh_app_setting_get --app=nextcloud --key=domain
2024-02-18 10:29:00,112: DEBUG - ++ local _globalapp=nextcloud
2024-02-18 10:29:00,222: DEBUG - ++ app=nextcloud
2024-02-18 10:29:00,223: DEBUG - ++ [[ domain =~ (unprotected|protected|skipped)_ ]]
2024-02-18 10:29:00,223: DEBUG - ++ ynh_app_setting get nextcloud domain
2024-02-18 10:29:00,427: DEBUG - + domain=maindomain.tld
2024-02-18 10:29:00,429: DEBUG - ++ ynh_app_setting_get --app=nextcloud --key=db_name
2024-02-18 10:29:00,430: DEBUG - ++ local _globalapp=nextcloud
2024-02-18 10:29:00,557: DEBUG - ++ app=nextcloud
2024-02-18 10:29:00,558: DEBUG - ++ [[ db_name =~ (unprotected|protected|skipped)_ ]]
2024-02-18 10:29:00,559: DEBUG - ++ ynh_app_setting get nextcloud db_name
2024-02-18 10:29:00,805: DEBUG - + db_name=nextcloud
2024-02-18 10:29:00,807: DEBUG - ++ ynh_app_setting_get --app=nextcloud --key=phpversion
2024-02-18 10:29:00,808: DEBUG - ++ local _globalapp=nextcloud
2024-02-18 10:29:00,958: DEBUG - ++ app=nextcloud
2024-02-18 10:29:00,959: DEBUG - ++ [[ phpversion =~ (unprotected|protected|skipped)_ ]]
2024-02-18 10:29:00,960: DEBUG - ++ ynh_app_setting get nextcloud phpversion
2024-02-18 10:29:01,228: DEBUG - + phpversion=8.2
2024-02-18 10:29:01,231: DEBUG - ++ ynh_app_setting_get --app=nextcloud --key=datadir
2024-02-18 10:29:01,232: DEBUG - ++ local _globalapp=nextcloud
2024-02-18 10:29:01,355: DEBUG - ++ app=nextcloud
2024-02-18 10:29:01,357: DEBUG - ++ [[ datadir =~ (unprotected|protected|skipped)_ ]]
2024-02-18 10:29:01,358: DEBUG - ++ ynh_app_setting get nextcloud datadir
2024-02-18 10:29:01,602: DEBUG - + datadir=
2024-02-18 10:29:01,604: DEBUG - + ynh_print_info '--message=Declaring files to be backed up...'
2024-02-18 10:29:01,644: INFO - Declaring files to be backed up...
2024-02-18 10:29:01,645: DEBUG - + ynh_backup --src_path=
2024-02-18 10:29:01,767: DEBUG - + dest_path=
2024-02-18 10:29:01,768: DEBUG - + is_big=0
2024-02-18 10:29:01,770: DEBUG - + not_mandatory=0
2024-02-18 10:29:01,771: DEBUG - + BACKUP_CORE_ONLY=1
2024-02-18 10:29:01,772: DEBUG - + test -n nextcloud
2024-02-18 10:29:01,773: DEBUG - ++ ynh_app_setting_get --app=nextcloud --key=do_not_backup_data
2024-02-18 10:29:01,774: DEBUG - ++ local _globalapp=nextcloud
2024-02-18 10:29:01,896: DEBUG - ++ app=nextcloud
2024-02-18 10:29:01,897: DEBUG - ++ [[ do_not_backup_data =~ (unprotected|protected|skipped)_ ]]
2024-02-18 10:29:01,898: DEBUG - ++ ynh_app_setting get nextcloud do_not_backup_data
2024-02-18 10:29:02,168: DEBUG - + do_not_backup_data=1
2024-02-18 10:29:02,170: DEBUG - + '[' '!' -e '' ']'
2024-02-18 10:29:02,171: DEBUG - + ynh_print_warn '--message=Source path '\'''\'' does not exist'
2024-02-18 10:29:02,246: DEBUG - + ynh_print_log 'Source path '\'''\'' does not exist'
2024-02-18 10:29:02,247: DEBUG - + echo -e 'Source path '\'''\'' does not exist'
2024-02-18 10:29:02,248: DEBUG - + '[' 0 == 0 ']'
2024-02-18 10:29:02,278: WARNING - Source path '' does not exist
2024-02-18 10:29:02,280: DEBUG - + grep --quiet /etc/fail2ban
2024-02-18 10:29:02,283: DEBUG - + return 1
2024-02-18 10:29:02,284: DEBUG - + ynh_exit_properly
2024-02-18 10:29:02,286: DEBUG - + [[ backup =~ ^install$|^upgrade$|^restore$ ]]
2024-02-18 10:29:03,791: DEBUG - Échec de l'exécution du script : /var/cache/yunohost/app_tmp_work_dirs/app_9f9sh1dm/scripts/backup
2024-02-18 10:29:03,801: ERROR - Impossible de sauvegarder nextcloud

If I manually try to backup the app, I have the same error.
I could try to upgrade with the no-backup option, but I’m unsure fo the results (and obviously, I can’t backup prior to try :slight_smile: )

On a sidenote as I don’t know if this is related, I noticed that if I look into /etc/yunohost/apps/nextcloud folder, I have a manifest.json file instead of a manifest.toml file, while nextcloud is in packaging v2 for ages… I’m unsure of what caused this.

So, I solved it, but it was indeed a strange issue:
In fact, even if the nextcloud instance was up to date and running flawlessly, the package itself was not updated: most of the scripts and config files were those from previous v1 packaging version (but not all of them… ).
I don’t understand why and how, but I assume this is linked to the time out during the upgrade, and after many upgrades and restore from failed upgrade over the years, it was the situation.

So, I manually updated the /etc/yunohost/apps/nextcloud/script/backup file so that the variable final_path (from v1) is updated with the setting install_dir (from v2). This solved the backup issue.

I then ran an upgrade from the comnand line (yunohost app upgrade nextcloud -- debug) that lasted for about 5 hours, and now everything is ok: instance is running and files are up to date.

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