YunoHost-Apps / matomo_ynh

Matomo package for YunoHost
https://matomo.org/
GNU General Public License v3.0
18 stars 5 forks source link

Upgrading to matomo 5.0 from 4.16.0 failed #111

Closed HujinoKun closed 3 months ago

HujinoKun commented 6 months ago

Describe the bug

Upgrading to matomo 5.0 from 4.16.0 failed.

Context

Steps to reproduce

Expected behavior

Upgrading successfully.

Logs

Command : sudo yunohost app upgrade matomo

Info: Now upgrading matomo...
Info: Creating a safety backup prior to the upgrade
Info: Collecting files to be backed up for matomo...
Info: Declaring files to be backed up...
Info: Backing up the MySQL database...
Info: Backup script completed for matomo. (YunoHost will then actually copy those files to the archive).
Info: Creating a backup archive from the collected files...
Info: The archive will contain about 168.1MB of data.
Success! Backup created: matomo-pre-upgrade1
Info: Updating sources...
Info: Updating system_user...
Info: Updating install_dir...
Info: Updating permissions...
Info: Updating apt...
Info: Updating database...
Info: [++++++++++..........] > Upgrading source files...
Warning: PHP Fatal error:  Cannot override final method Piwik\Plugin\ConsoleCommand::execute() in /var/www/matomo/plugins/CoreConsole/Commands/GenerateAngularComponent.php on line 27
Error: Could not upgrade matomo: An error occurred inside the app upgrade script
Info: The operation 'Upgrade the 'matomo' app' could not be completed. Please share the full log of this operation using the command 'yunohost log share 20231219-221500-app_upgrade-matomo' to get help
Warning: Here's an extract of the logs before the crash. It might help debugging the error:
Info: DEBUG - + ynh_secure_remove --file=/var/cache/yunohost/download/matomo/main
Info: DEBUG - + '[' -d /var/cache/yunohost/app_tmp_work_dirs/app___ur43wn/sources/patches/ ']'
Info: DEBUG - + test -e /var/cache/yunohost/app_tmp_work_dirs/app___ur43wn/sources/extra_files/main
Info: DEBUG - + '[' -n config/config.ini.php ']'
Info: DEBUG - + local keep_dir=/var/cache/yunohost/files_to_keep_during_setup_source/matomo
Info: DEBUG - + for stuff_to_keep in $keep
Info: DEBUG - + '[' -e /var/cache/yunohost/files_to_keep_during_setup_source/matomo/config/config.ini.php ']'
Info: DEBUG - ++ dirname /var/www/matomo/config/config.ini.php
Info: DEBUG - + mkdir --parents /var/www/matomo/config
Info: DEBUG - + cp --archive /var/cache/yunohost/files_to_keep_during_setup_source/matomo/config/config.ini.php /var/www/matomo/config/config.ini.php
Info: DEBUG - + rm -rf /var/cache/yunohost/files_to_keep_during_setup_source/
Info: DEBUG - + chown -R matomo:www-data /var/www/matomo
Info: DEBUG - + ynh_exec_as matomo php8.2 /var/www/matomo/console core:update -n
Info: DEBUG - + local user=matomo
Info: DEBUG - + shift 1
Info: DEBUG - ++ whoami
Info: DEBUG - + [[ matomo = root ]]
Info: DEBUG - + sudo -u matomo php8.2 /var/www/matomo/console core:update -n
Info: WARNING - PHP Fatal error:  Cannot override final method Piwik\Plugin\ConsoleCommand::execute() in /var/www/matomo/plugins/CoreConsole/Commands/GenerateAngularComponent.php on line 27
Info: DEBUG - + ynh_exit_properly
Warning: Upgrade failed ... attempting to restore the safety backup (Yunohost first need to remove the app for this) ...
Info: Removing matomo...
Info: [++++++++++..........] > Removing NGINX web server configuration...
Info: [####################] > Removal of matomo completed
Info: Deprovisioning database...
Info: Deprovisioning apt...
Warning: /etc/kernel/postrm.d/initramfs-tools:
Warning: update-initramfs: Deleting /boot/initrd.img-5.10.0-24-arm64
Warning: /etc/kernel/postrm.d/zz-update-grub:
Warning: Generating grub configuration file ...
Warning: Found linux image: /boot/vmlinuz-5.10.0-26-arm64
Warning: Found initrd image: /boot/initrd.img-5.10.0-26-arm64
Warning: Found linux image: /boot/vmlinuz-5.10.0-25-arm64
Warning: Found initrd image: /boot/initrd.img-5.10.0-25-arm64
Warning: Adding boot menu entry for UEFI Firmware Settings ...
Warning: done
Info: Deprovisioning permissions...
Info: Deprovisioning install_dir...
Info: Deprovisioning system_user...
Info: Deprovisioning sources...
Success! matomo uninstalled
Warning: YunoHost is already installed
Info: Preparing archive for restoration...
Info: Restoring matomo...
Info: Provisioning sources...
Info: Provisioning system_user...
Info: Provisioning install_dir...
Info: Provisioning permissions...
Info: Provisioning apt...
Info: Provisioning database...
Info: [+++++++.............] > Restoring the app main directory...
Info: [#######+++..........] > Restoring the MySQL database...
Info: [##########+++++.....] > Restoring the PHP-FPM configuration...
Info: [###############++...] > Reloading NGINX web server and PHP-FPM...
Info: [####################] > Restoration completed for matomo
Success! Restoration completed
Error: The operation 'Upgrade the 'matomo' app' could not be completed. Please share the full log of this operation using the command 'yunohost log share 20231219-221500-app_upgrade-matomo' to get help

Debug URL : https://paste.yunohost.org/raw/eqetokeyok

shakasan commented 6 months ago

Describe the bug

I'm facing exactly the same issue when trying to upgrade from 4.15.1 to 5.0.0. The issue was already present when upgrading from 4.15.1 to 4.16.0, but unfortunately, I had to time to check more at that time.

Context

Logs

Info: Now upgrading matomo...
Info: Creating a safety backup prior to the upgrade
Info: Collecting files to be backed up for matomo...
Info: Declaring files to be backed up...
Info: Backing up the MySQL database...
Info: Backup script completed for matomo. (YunoHost will then actually copy those files to the archive).
Info: Creating a backup archive from the collected files...
Info: The archive will contain about 163.6MB of data.
Success! Backup created: matomo-pre-upgrade2
Success! Backup deleted: matomo-pre-upgrade1
Info: Updating sources...
Info: Updating system_user...
Info: Updating install_dir...
Info: Updating permissions...
Info: Updating apt...
Info: Updating database...
Info: [++++++++++..........] > Upgrading source files...
Warning: PHP Fatal error:  Cannot override final method Piwik\Plugin\ConsoleCommand::execute() in /var/www/matomo/plugins/CoreConsole/Commands/GenerateAngularComponent.php on line 27
Error: Could not upgrade matomo: An error occurred inside the app upgrade script
Info: The operation 'Upgrade the 'matomo' app' could not be completed. Please share the full log of this operation using the command 'yunohost log share 20231219-224006-app_upgrade-matomo' to get help
Warning: Here's an extract of the logs before the crash. It might help debugging the error:
Info: DEBUG - + ynh_secure_remove --file=/var/cache/yunohost/download/matomo/main
Info: DEBUG - + '[' -d /var/cache/yunohost/app_tmp_work_dirs/app_xik073y7/sources/patches/ ']'
Info: DEBUG - + test -e /var/cache/yunohost/app_tmp_work_dirs/app_xik073y7/sources/extra_files/main
Info: DEBUG - + '[' -n config/config.ini.php ']'
Info: DEBUG - + local keep_dir=/var/cache/yunohost/files_to_keep_during_setup_source/matomo
Info: DEBUG - + for stuff_to_keep in $keep
Info: DEBUG - + '[' -e /var/cache/yunohost/files_to_keep_during_setup_source/matomo/config/config.ini.php ']'
Info: DEBUG - ++ dirname /var/www/matomo/config/config.ini.php
Info: DEBUG - + mkdir --parents /var/www/matomo/config
Info: DEBUG - + cp --archive /var/cache/yunohost/files_to_keep_during_setup_source/matomo/config/config.ini.php /var/www/matomo/config/config.ini.php
Info: DEBUG - + rm -rf /var/cache/yunohost/files_to_keep_during_setup_source/
Info: DEBUG - + chown -R matomo:www-data /var/www/matomo
Info: DEBUG - + ynh_exec_as matomo php8.2 /var/www/matomo/console core:update -n
Info: DEBUG - + local user=matomo
Info: DEBUG - + shift 1
Info: DEBUG - ++ whoami
Info: DEBUG - + [[ matomo = root ]]
Info: DEBUG - + sudo -u matomo php8.2 /var/www/matomo/console core:update -n
Info: WARNING - PHP Fatal error:  Cannot override final method Piwik\Plugin\ConsoleCommand::execute() in /var/www/matomo/plugins/CoreConsole/Commands/GenerateAngularComponent.php on line 27
Info: DEBUG - + ynh_exit_properly
Warning: Upgrade failed ... attempting to restore the safety backup (Yunohost first need to remove the app for this) ...
Info: Removing matomo...
Info: [++++++++++..........] > Removing NGINX web server configuration...
Info: [####################] > Removal of matomo completed
Info: Deprovisioning database...
Info: Deprovisioning apt...
Info: Deprovisioning permissions...
Info: Deprovisioning install_dir...
Info: Deprovisioning system_user...
Info: Deprovisioning sources...
Success! matomo uninstalled
Warning: YunoHost is already installed
Info: Preparing archive for restoration...
Info: Restoring matomo...
Info: Provisioning sources...
Info: Provisioning system_user...
Info: Provisioning install_dir...
Info: Provisioning permissions...
Info: Provisioning apt...
Info: Provisioning database...
Info: [+++++++.............] > Restoring the app main directory...
Info: [#######+++..........] > Restoring the MySQL database...
Info: [##########+++++.....] > Restoring the PHP-FPM configuration...
Info: [###############++...] > Reloading NGINX web server and PHP-FPM...
Info: [####################] > Restoration completed for matomo
Success! Restoration completed
Error: The operation 'Upgrade the 'matomo' app' could not be completed. Please share the full log of this operation using the command 'yunohost log share 20231219-224006-app_upgrade-matomo' to get help

Thanks for the help

ballinger commented 6 months ago

same here

yodahome commented 6 months ago

Getting the same error message when trying to upgrade from 4.16.0 to 5.0.0 on yunohost 11.2.8.2

CodeShakingSheep commented 6 months ago

Same here. Logs: https://paste.yunohost.org/raw/uhoradiwis

gilou commented 6 months ago

Hi, I experienced that same issue when trying to update from 4.15.1~ynh1 to 5.0.0~ynh1, log is @ https://paste.yunohost.org/raw/hapobuqoza on Yunohost 11.2.8.2

gilou commented 6 months ago

It's probably not a YNH specific issue though, plugins/CoreConsole/Commands/GenerateAngularComponent.php doesn't even exist anymore, so we probably should put it out (or make sure it's not in some kind of cache…)

Pentaonia commented 6 months ago

Same problem here, the same error as for @HujinoKun. Thx @gilou for hopefully fixing it. May @ericgaspar quickly include your commit!

gilou commented 6 months ago

I think I'm wrong about how --full-replace works, I have 0 knowledge regarding ynh apps… I'll try later…

ericgaspar commented 6 months ago

it is --full_replace=, with underscore

please test to update from the testing branch: sudo yunohost app upgrade matomo -u https://github.com/YunoHost-Apps/matomo_ynh/tree/testing --force

Pentaonia commented 6 months ago

@ericgaspar it runs as smoothly as possible. Nice! 😁

jookk commented 6 months ago

I tried to upgrade to 5ynh2, but upgrade went unsuccessfull. See log: https://paste.yunohost.org/raw/jejoxiduhu

related info: https://forum.matomo.org/t/problems-updating-from-4-16-0-to-5-0-0/54602/2 https://github.com/matomo-org/matomo/issues/19886

Pentaonia commented 6 months ago

@jookk crazy, the error looks the same as before...

jookk commented 6 months ago

Mine first upgrade related to this: https://paste.yunohost.org/raw/jejoxiduhu

2023-12-20 06:46:51,308: WARNING - PHP Fatal error: Cannot override final method Piwik\Plugin\ConsoleCommand::execute() in /var/www/matomo/plugins/CoreConsole/Commands/GenerateAngularComponent.php on line 27

Pentaonia commented 6 months ago

it is --full_replace=, with underscore

please test to update from the testing branch: sudo yunohost app upgrade matomo -u https://github.com/YunoHost-Apps/matomo_ynh/tree/testing --force

@jookk, although you used this to update? For me it fixed exactly that error.

jookk commented 6 months ago

Firstly I updated via yunohost admin (ynh1 upgrade) Secondly I used web admiin to upgrade to ynh2 As last I tried to use update from testing branch, as you have mentioned. Weird alltrough

gilou commented 6 months ago

Hmm… it seems that -n fore core:update, though still documented as -n, --no-interaction Do not ask any interactive question in fact triggers a dry run… *** Note: this is a Dry Run *** [...]

   *** End of Dry Run ***

Database upgrade not executed.
gilou commented 6 months ago

And so now, there is a -q parameter to make it quiet…

gilou commented 6 months ago

But that … doesn't work either… So I'd say there is something fishy in core:update … -q --ignore-warn doesn't do anything (not that it's a good idea anyway…), -n seems to not do anything (dry run ?), and if I use no params, I need to say yes to the prompt, and I'd rather not force that answer… blah…

jookk commented 6 months ago

I upgraded to 5.0 from matomo web ui. All went fine without issue. Only I had to activate login plugin at config. So, now I have working v5, but I didnt upgraded via ynh admin. Edit: I upgraded via yunohost admin to v5 and upgrade went fine.

gilou commented 6 months ago

I bypassed the issue and ran the core:update manually, so don't have a real use-case anymore to fix it, but I may try later this week with a dev env, see if I can reproduce, maybe fix it…

HujinoKun commented 5 months ago

Hello,

Any update ?