YunoHost-Apps / pixelfed_ynh

The federated image shareing service Pixelfed for YunoHost
https://pixelfed.org/
GNU Affero General Public License v3.0
44 stars 15 forks source link

Pixelfed upgrade from 0.11.1~ynh2 to 0.11.2~ynh1 fails : php (dependencies ?) issue with composer ? #165

Closed aarontrom closed 2 years ago

aarontrom commented 2 years ago

Describe the bug

I tried to upgrade Pixelfed from version 0.11.1~ynh2 to 0.11.2~ynh1in the yunohost admin panel and it failed.

Context

Steps to reproduce

Pixelfed upgrade error

Logs

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

Any help is appreciated :)

aarontrom commented 2 years ago

I think the reason why it failed is because I'm still using php 7.3 and not 7.4 right? But that's related to yunohost running on Debian 10. This will probably be solved with the upgrade to Debian 11, am I right?

lapineige commented 2 years ago

Even on Debian 10, the upgrade should install php7.4 (if needed) and run Pixelfed with it (it was php7.3 before that version).

I will take a look at your logs.

lapineige commented 2 years ago

Here is the error:

The following additional packages will be installed: 2022-02-06 12:37:19,945: DEBUG - php7.4 php7.4-bcmath php7.4-cli php7.4-common php7.4-curl php7.4-fpm 2022-02-06 12:37:19,945: DEBUG - php7.4-gd php7.4-igbinary php7.4-imagick php7.4-intl php7.4-json 2022-02-06 12:37:19,945: DEBUG - php7.4-mbstring php7.4-opcache php7.4-pgsql php7.4-readline php7.4-redis 2022-02-06 12:37:19,946: DEBUG - php7.4-xml php7.4-zip 2022-02-06 12:37:20,011: DEBUG - The following packages will be REMOVED: 2022-02-06 12:37:20,015: DEBUG - friendica-ynh-deps nextcloud-ynh-deps php-igbinary php-imagick php-redis 2022-02-06 12:37:20,017: DEBUG - The following NEW packages will be installed: 2022-02-06 12:37:20,018: DEBUG - php7.4 php7.4-bcmath php7.4-cli php7.4-common php7.4-curl php7.4-fpm 2022-02-06 12:37:20,018: DEBUG - php7.4-gd php7.4-igbinary php7.4-imagick php7.4-intl php7.4-json 2022-02-06 12:37:20,018: DEBUG - php7.4-mbstring php7.4-opcache php7.4-pgsql php7.4-readline php7.4-redis 2022-02-06 12:37:20,019: DEBUG - php7.4-xml php7.4-zip 2022-02-06 12:37:20,044: DEBUG - 0 upgraded, 18 newly installed, 5 to remove and 0 not upgraded. 2022-02-06 12:37:20,044: WARNING - E: Packages need to be removed but remove is disabled. 2022-02-06 12:37:20,047: DEBUG - ++ cat /tmp/tmp.YSe3IRtLUQ/dpkg_log 2022-02-06 12:37:20,047: DEBUG - ++ grep -oP '(?<=-ynh-deps depends on ).*(?=; however)' 2022-02-06 12:37:20,048: DEBUG - ++ tr '\n' ' ' 2022-02-06 12:37:20,052: DEBUG - + local 'problematic_dependencies=php7.4-bcmath php7.4-cli php7.4-ctype php7.4-curl php7.4-exif php7.4-gd php7.4-iconv php7.4-intl php7.4-json php7.4-mbstring php7.4-redis php7.4-tokenizer php7.4-xml php7.4-zip php7.4-pdo php7.4-pgsql php7.4-fileinfo php7.4-imagick php7.4 php7.4-fpm php7.4-common ' 2022-02-06 12:37:20,052: DEBUG - + [[ -n php7.4-bcmath php7.4-cli php7.4-ctype php7.4-curl php7.4-exif php7.4-gd php7.4-iconv php7.4-intl php7.4-json php7.4-mbstring php7.4-redis php7.4-tokenizer php7.4-xml php7.4-zip php7.4-pdo php7.4-pgsql php7.4-fileinfo php7.4-imagick php7.4 php7.4-fpm php7.4-common ]] 2022-02-06 12:37:20,052: DEBUG - + ynh_package_install php7.4-bcmath php7.4-cli php7.4-ctype php7.4-curl php7.4-exif php7.4-gd php7.4-iconv php7.4-intl php7.4-json php7.4-mbstring php7.4-redis php7.4-tokenizer php7.4-xml php7.4-zip php7.4-pdo php7.4-pgsql php7.4-fileinfo php7.4-imagick php7.4 php7.4-fpm php7.4-common --dry-run 2022-02-06 12:37:20,052: DEBUG - + ynh_apt --no-remove --option Dpkg::Options::=--force-confdef --option Dpkg::Options::=--force-confold install php7.4-bcmath php7.4-cli php7.4-ctype php7.4-curl php7.4-exif php7.4-gd php7.4-iconv php7.4-intl php7.4-json php7.4-mbstring php7.4-redis php7.4-tokenizer php7.4-xml php7.4-zip php7.4-pdo php7.4-pgsql php7.4-fileinfo php7.4-imagick php7.4 php7.4-fpm php7.4-common --dry-run 2022-02-06 12:37:20,053: DEBUG - + ynh_wait_dpkg_free 2022-02-06 12:37:20,053: DEBUG - + grep -v 'fix-broken|Reading state info' 2022-02-06 12:37:20,053: DEBUG - + sed --quiet '/Reading state info/,$p' 2022-02-06 12:37:20,535: DEBUG - + return 0 2022-02-06 12:37:20,536: DEBUG - + LC_ALL=C 2022-02-06 12:37:20,536: DEBUG - + DEBIAN_FRONTEND=noninteractive 2022-02-06 12:37:20,536: DEBUG - + apt-get --assume-yes --quiet -o=Acquire::Retries=3 -o=Dpkg::Use-Pty=0 --no-remove --option Dpkg::Options::=--force-confdef --option Dpkg::Options::=--force-confold install php7.4-bcmath php7.4-cli php7.4-ctype php7.4-curl php7.4-exif php7.4-gd php7.4-iconv php7.4-intl php7.4-json php7.4-mbstring php7.4-redis php7.4-tokenizer php7.4-xml php7.4-zip php7.4-pdo php7.4-pgsql php7.4-fileinfo php7.4-imagick php7.4 php7.4-fpm php7.4-common --dry-run 2022-02-06 12:37:21,333: WARNING - The following packages have unmet dependencies: 2022-02-06 12:37:21,334: WARNING - php7.4-cli : Depends: php7.4-opcache but it is not going to be installed 2022-02-06 12:37:21,334: WARNING - Depends: php7.4-readline but it is not going to be installed 2022-02-06 12:37:21,335: WARNING - php7.4-fpm : Depends: php7.4-opcache but it is not going to be installed 2022-02-06 12:37:21,335: WARNING - php7.4-imagick : Breaks: php-imagick (< 3.6.0-4+0~20220117.35+debian10~1.gbp149f82~) 2022-02-06 12:37:21,335: WARNING - php7.4-redis : Depends: php7.4-igbinary but it is not going to be installed 2022-02-06 12:37:21,336: WARNING - Breaks: php-redis (< 5.3.5+4.3.0-5+0~20220131.41+debian10~1.gbpf8a972~) 2022-02-06 12:37:21,337: DEBUG - + ynh_die '--message=Unable to install dependencies'

I don't know what's the issue that prevent those dependencies from being installed. Sounds like there is some conflict, such as with php-redis. ping @YunoHost-Apps/apps-group ?


By the way, this is strange:

DEBUG - The following packages will be REMOVED: DEBUG - friendica-ynh-deps nextcloud-ynh-deps php-igbinary php-imagick php-redis

You might check if both friendica and nextcloud are working well…

aarontrom commented 2 years ago

Thanks for looking into that! Both friendica and nextcloud work well.

sthaydn commented 2 years ago

I have the same issue with this. I am running Pixelfed on a VPS as well.

aarontrom commented 2 years ago

Update: I installed php 7.4 via this tutorial and tried to update Pixelfed again, but the following happened: https://paste.yunohost.org/raw/numayagiwu

lapineige commented 2 years ago

So the same error I guess ?

If you install the previous version (I suppose you will have to use yunohost app install https://github.com/YunoHost-Apps/pixelfed_ynh/tree/4c1cc4281c6069842ff5ce12de6dce4000211a3e, and then update it, does it work ?

aarontrom commented 2 years ago

I logged in my server, went to /var/www/pixelfed and got this after I used your command:

/var/www/pixelfed# yunohost app install -u https://github.com/YunoHost-Apps/pixelfed_ynh/tree/4c1cc4281c6069842ff5ce12de6dce4000211a3e
usage: yunohost {app} ...
                [-h] [--output-as {json,plain,none}] [--debug] [--quiet]
                [--timeout ==SUPPRESS==] [-v]
yunohost: error: unrecognized arguments: -u
lapineige commented 2 years ago

Oh sorry, you don't need that -u parameter (that's used for manual upgrade). I changed the command.

By the way, you don't need to be in /var/www/pixelfed, current directory doesn't matter.

aarontrom commented 2 years ago

Ahh okay thx, but how do I do that, because I cannot install it on the same domain: Error: Sorry, this app must be installed on a domain of its own, but other apps are already installed on the domain 'mysubdomain.mydomain.tld'. You could use a subdomain dedicated to this app instead.

So does that mean I need to delete my Pixelfed installation and then install the previous version with that command yunohost app install https://github.com/YunoHost-Apps/pixelfed_ynh/tree/4c1cc4281c6069842ff5ce12de6dce4000211a3e and then try to update it?

But can I then restore the current data somehow?

Or should I just install Pixelfed on another domain and then upgrade it just to see if that works?

aarontrom commented 2 years ago

Hm, I just tried the latter one (install pixelfed on another subdomain) and it failed. Here is the log: https://paste.yunohost.org/raw/isinavubeb

lapineige commented 2 years ago

Wait, you mean that installation went well on your first try (with the current main version), even with the error you reported ?

Ok my bad, I didn't notice you were talking about an upgrade, and not a fresh install… sorry 😅

But now with you last experiment, we know that there is the same error upon install and upgrade…

I wonder what's wrong with php7.4 dependencies on some servers and not on others… Something about Debian specific minor versions ? 🤔 @YunoHost-Apps/apps-group do you have an idea ?

sthaydn commented 2 years ago

Any news about that, @aarontrom? Did you manage to get it working?

aarontrom commented 2 years ago

Hi @sthaydn yes, actually just yesterday I worked on that and I did the following 3 things:

apt install php7.4-igbinary
apt install php7.4-redis
apt install php7.4-imagick

after installing these packages I was able to upgrade Pixelfed from 0.11.1 to 0.11.2 :)

sthaydn commented 2 years ago

Worked also for me. Thanks a lot!

aarontrom commented 2 years ago

awesome 👍🏾 no problem :)

lapineige commented 2 years ago

Thanks for sharing the workaround. Nice to see this worked :)

aarontrom commented 2 years ago

So I have to share here that my nextcloud Instance has some issues and I strongly suspect this is due to the change that I did there:

Hi @sthaydn yes, actually just yesterday I worked on that and I did the following 3 things:

apt install php7.4-igbinary
apt install php7.4-redis
apt install php7.4-imagick

after installing these packages I was able to upgrade Pixelfed from 0.11.1 to 0.11.2 :)

I am now investigating.

aarontrom commented 2 years ago

I restored a Nextcloud-Backup (from 4 days ago) after I removed the 3 packages that I installed there and now it works again. And interestingly Pixelfed works too, despite me removing

apt install php7.4-igbinary
apt install php7.4-redis
apt install php7.4-imagick
sthaydn commented 2 years ago

Oh dear, that's indeed very strange. But glad it works for you now. I don't have Nextcloud installed, all other apps are working fine.

aarontrom commented 2 years ago

Hm, now the supervisor service from Pixelfed doesn't work anymore. So there seems to be an issue with the php versions. Some depend on php7.3 and pixelfed 0.11.2 only works with php7.4

aarontrom commented 2 years ago

Yes I might reopen this issue for the yunohost pixelfed packagers.

lapineige commented 2 years ago

Some depend on php7.3

What depends on php7.3 ? We migrated recently (with last version upgrade) to php7.4, maybe there is some dead spot :sweat_smile:

Yes I might reopen this issue for the yunohost pixelfed packagers.

Good point, I forgot to reopen it :sweat_smile:

aarontrom commented 2 years ago

In /etc/php/7.3/fpm/pool.d there seem a lot of apps using and depending on php7.3:

image

I can also share this in /run/php:

image

also in sudo update-alternatives --config php php7.3 is apparently the deault:

There are 2 choices for the alternative php (providing /usr/bin/php).

  Selection    Path             Priority   Status
------------------------------------------------------------
  0            /usr/bin/php7.4   74        auto mode
* 1            /usr/bin/php7.3   73        manual mode
  2            /usr/bin/php7.4   74        manual mode

Press <enter> to keep the current choice[*], or type selection number: 
aarontrom commented 2 years ago

Should I choose the option 0 there? to put php7.4 in auto mode? By the way, what is the difference there between auto mode and manual mode?

lapineige commented 2 years ago

In /etc/php/7.3/fpm/pool.d there seem a lot of apps using and depending on php7.3:

That's fine and quite normal as far as I know. (but migrations to php7.4 are coming for some of them)

Should I choose the option 0 there? to put php7.4 in auto mode? By the way, what is the difference there between auto mode and manual mode?

I have noooo idea :sweat_smile:. Maybe @YunoHost-Apps/apps-group will have more information, but I would say change nothing and let Yunohost apps handle this php version stuff, just in case :sweat_smile:

aarontrom commented 2 years ago

Ahh okay, thanks for that 👍🏾 😄

Tony-John-Cil commented 2 years ago

Are there any news on that bug ? I've got the same problem. I can't update Pixelfed to a version higher than 0.11.1 , I've got Nextcloud on my server too and I'm midly confident in installing php7.4 manually if it may break something. I've installed PHP 7.4 through a blank custom webapp, tried to set the version through sudo update-alternatives --config php (I've got 7.3 and 8.0 too), but the upgrade never works.

aarontrom commented 2 years ago

there was an upgrade today actually of pixelfed on yunohost via the admin panel. I did the upgrade to version: 0.11.3 and everything works fine now. I also do have a NextCloud there, plus I also do have php 7.4 and pixelfed is using that actually.

Tony-John-Cil commented 2 years ago

Yes, but if I've correctly followed your case :

So shall I have to take all those steps too to upgrade my Pixelfed installation, temporarily breaking my Nextcloud service and my Pixelfed service, or is it possible to implement something on the Yunohost package which may be more secure, or is there at least a more easy way to do the upgrade manually ?

aarontrom commented 2 years ago

Ohh @Tony-John-Cil I'm sorry that I didn't get back to your message earlier... hm, I'm not sure entirely how you should do it best. Did you figure something out in the meantime?

Tony-John-Cil commented 2 years ago

Nope, I still haven't updated it successfully, but I'm now waiting for the update of the Nextcloud app, which is still in version 22, but a pull request for version 24 is pending, then I will try to update Pixelfed again with the hope that it won't break.

yalh76 commented 2 years ago

All thoses issues comes from the upgrade of PHP from 7.3 to 7.4. Pixelfed require php-redis but php7.3-redis is not compatible with php7.4-redis ...

lapineige commented 2 years ago

What version does Nextcloud use ? If it's 7.4, maybe upgrade Pixelfed to 7.4 (view Yunohost normal upgrade) first ?

Tony-John-Cil commented 2 years ago

nextcloud_ynh still uses Nextcloud 22 with PHP 7.3, but pull requests are pending for Nextcloud 23 and 24 which uses higher PHP versions.

lapineige commented 2 years ago

With php 8.0… maybe it with resolve the conflict ?

yalh76 commented 2 years ago

With php 8.0… maybe it with resolve the conflict ?

Same issue with php8.0-redis

From https://packages.sury.org/php/dists/buster/main/binary-amd64/Packages

Package: php8.0-redis
Source: php-redis
Version: 5.3.7+4.3.0-1+0~20220330.42+debian10~1.gbp6fe8b7
Architecture: amd64
Maintainer: Debian PHP PECL Maintainers <team+php-pecl@tracker.debian.org>
Installed-Size: 673
Pre-Depends: php-common (>= 2:69~)
Depends: php8.0-common, php8.0-igbinary, phpapi-20200930, libc6 (>= 2.14), liblz4-1 (>= 0.0~r130), libzstd1 (>= 1.3.2)
Suggests: redis-server
Breaks: php-redis (<< 5.3.7+4.3.0-1+0~20220330.42+debian10~1.gbp6fe8b7~)

Maybe a solution would be to just have php-redis instead of php${YNH_PHP_VERSION}-redis

lapineige commented 2 years ago

I'll try that… but for the other dependencies, I hope it's not the same…

lapineige commented 2 years ago

Oh wait we are using php-redishttps://github.com/YunoHost-Apps/pixelfed_ynh/blob/testing/scripts/_common.sh#L11 edit: no it's php7.4-redis, my bad ^^

@Tony-John-Cil could you try again now with the latest version ? (0.11.3)

Tony-John-Cil commented 2 years ago

Thanks ! But it seems that there's a problem with php-imagick too. Here's my log after a sudo yunohost app upgrade pixelfed -u https://github.com/YunoHost-Apps/pixelfed_ynh/tree/testing --debug : https://paste.yunohost.org/raw/umugonicip

lapineige commented 2 years ago

Can you try again with this one ?

Tony-John-Cil commented 2 years ago

Thanks ! But it seems that there's still a problem with php-imagick or its dependencies. https://paste.yunohost.org/raw/befuqeneve

lapineige commented 2 years ago

@Tony-John-Cil could you try the latest testing please ?

Tony-John-Cil commented 2 years ago

Thanks ! But now there's a problem with composer or one of its dependencies : /usr/share/yunohost/helpers.d/php: line 481: 9006 Killed COMPOSER_HOME="$workdir/.composer" COMPOSER_MEMORY_LIMIT=-1 php${phpversion} "$workdir/composer.phar" $commands -d "$workdir" --no-interaction --no-ansi 2>&1 https://paste.yunohost.org/raw/ajerofinol

lapineige commented 2 years ago

The error is not really clear… I wonder if it's not a memory limit issue :thinking:

Or something about a migration to Composer 2, I recall reading something about it regarding Pixelfed.

Tony-John-Cil commented 2 years ago

Isn't it possible to log more errors on Yunohost scripts side or on Composer side ? Are there "verbose" options that may show more errors on that step ?

lapineige commented 2 years ago

I don't know.

Maybe you can open a topic on the forum to ask for help ?

Tony-John-Cil commented 2 years ago

Problem solved ! In the end, I've just manually replaced the file /var/www/pixelfed/composer.phar with its most up-to-date version then re-run the update command on the testing branch, and 0.11.3 was installed successfully. Thanks again for managing the php7.4 update !

lapineige commented 2 years ago

I've just manually replaced the file /var/www/pixelfed/composer.phar

Could you explain how you did that ? (to help other people stuck in this issue ;)

Tony-John-Cil commented 2 years ago

In this case, there aren't many steps I can add. Here is the very specific procedure I've done but other configurations may act differently :

cd /var/www/pixelfed
sudo rm composer.phar
# Composer installation steps as they are prompted on https://getcomposer.org/download/ 
sudo php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
sudo php -r "if (hash_file('sha384', 'composer-setup.php') === '55ce33d7678c5a611085589f1f3ddf8b3c52d662cd01d4ba75c0ee0459970c2200a51f492d557530c71c15d8dba01eae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
sudo php composer-setup.php
sudo php -r "unlink('composer-setup.php');"
## Upgrade from Yunohost testing branch
sudo yunohost app upgrade pixelfed -u https://github.com/YunoHost-Apps/pixelfed_ynh/tree/testing --debug

But isn't there a way to check for the version of composer.phar through the YunoHost upgrade script, and replace it with its more up-to-date version during the update ? It would prevent similar problems in the future and avoid this kind of manipulation that could lead to errors, even if its simple to do for advanced users. (back in the days, I've already had a kernel panic after installing a screensaver on my personal Ubuntu computer through command lines ; so simpler is the solution, better it is for all users).