Upgrade to bookworm broke php-fpm

Hi,
just performed a successful upgrade from bullseye to bookworm using the congenial upgrade script.
Thank you for this well crafted piece of code!
All the services are up and running again, only php-fpm didn’t grew up completely.

Browsing my Nextcloud gives me a ‘502- bad gateway’.

Inspecting Nginx error.log:

2024/03/07 07:27:21 [crit] 11860#11860: *955 connect() to unix:/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 2a0a:2782:3f9:7c00:2d83:4b23:700:cb96, server: ***.***.org, request: "GET /nextcloud/index.php/204 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.4-fpm.sock:", host: "***.***.org"

So let’s peek inside /etc/nginx/nginx.conf. Nginx is stuck with PHP 7.4, while the machine now is on PHP 8.2.7

        # Upstream to abstract back-end connection(s) for PHP
        upstream php {
               server unix:/run/php/php7.4-fpm.sock;
        }
php --version
PHP 8.2.7 (cli) (built: Jun  9 2023 19:37:27) (NTS)

The only ‘php’ in /run is php_sessions, so let’s locate it

locate fpm.sock
/etc/alternatives/php-fpm.sock
/mnt/dietpi-backup/data/etc/alternatives/php-fpm.sock
/mnt/dietpi-backup/data/var/lib/dpkg/alternatives/php-fpm.sock
/var/lib/dpkg/alternatives/php-fpm.sock

What is it in ‘alternatives’?

lrwxrwxrwx  1 root root   15 Mar  6 19:39 php -> /usr/bin/php8.2
lrwxrwxrwx  1 root root   24 Mar  6 09:42 php-fpm.sock -> /run/php/php7.4-fpm.sock

At least, is php-fpm running?

ps aux | grep php
root       11955  0.0  0.1   3560  1920 pts/0    S+   07:29   0:00 grep php
ps aux | grep php-fpm
root       11975  0.0  0.1   3560  1920 pts/0    S+   07:30   0:00 grep php-fpm

Is there anybody who already fixed this and linked the new php-fpm with Nginx?

Thanks for help
Frans

I have searched the existing open and closed issues

Required Information

G_DIETPI_VERSION_CORE=9
G_DIETPI_VERSION_SUB=1
G_DIETPI_VERSION_RC=1
G_GITBRANCH=‘master’
G_GITOWNER=‘MichaIng’
G_LIVE_PATCH_STATUS[0]=‘not applicable’
bookworm
Linux ..org 6.6.16-current-meson64 #1 SMP PREEMPT Fri Feb 23 08:25:28 UTC 2024 aarch64 GNU/Linux
arm64
Odroid C2 (aarch64)

So the php7.4 packages were removed and replaced by the php8 ones, but your config was not adjusted.
But when I look into the script, it should has asked you to reinstall some stuff to adjust the configs:

# Reinstall all PHP applications which require non-standard PHP modules, webservers which did access a versioned PHP-FPM socket, Python applications installed via pip, ...
G_PROMPT_BACKUP_DISABLED=1 /boot/dietpi/dietpi-software reinstall 38 40 47 48 83 84 85 89 93 114 118 125 130 134 136 139 143 153 155 157 180

id 85 is Nginx maybe you skipped that part? (id 114 is nextcloud)
You can just try reinstalling dietpi-software reinstall 85 and maybe same for nextcloud.

But as always I recommend creating a backup beforehand!

Thank you for the quick reply.
“My” upgrade-script ended with:

Next, some migrations are done for all software to run nicely on Bookworm. This can include dietpi-software reinstalls. Press ENTER to continue or CTRL+C to abort ...
[ INFO ] dietpi-bookworm-upgrade | Running post upgrade migrations

This purged old packages (i.e. PHP 7.4)

The prompt you mentioned didn’t appear.
Reinstalling nextcloud won’t delete the former content?

Regards
Frans

Now I reinstalled Nginx but still keep the 502-Bad gateway.

Nginx error.log:
The fpm.sock is now versioned correctly as written in the nginx.conf, but there is no /run/php…

2024/03/07 13:09:24 [crit] 2755#2755: 77 connect() to unix:/run/php/php8.2-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 185.89.., server: ..org, request: “GET /nextcloud/index.php/204 HTTP/1.1”, upstream: “fastcgi://unix:/run/php/php8.2-fpm.sock:”, host: ".*.org"

At least, there is no fpm subfolder inside my PHP installation:

New /etc/php/8.2
drwxr-xr-x 3 root root 4.0K Mar 6 19:39 cli
drwxr-xr-x 2 root root 4.0K Mar 6 19:39 mods-available
drwxr-xr-x 3 root root 4.0K Mar 6 19:39 phpdbg

Prior upgrade to bookworm:
/etc/php/7.4/
drwxr-xr-x 3 root root 4.0K Nov 24 15:21 cli
drwxr-xr-x 4 root root 4.0K Nov 24 15:20 fpm
drwxr-xr-x 2 root root 4.0K Nov 24 15:20 mods-available
inside fpm:
drwxr-xr-x 2 root root 4.0K Dec 27 2022 conf.d
-rw-r–r-- 1 root root 5.4K Nov 8 2022 php-fpm.conf
-rw-r–r-- 1 root root 72K Nov 24 15:20 php.ini
drwxr-xr-x 2 root root 4.0K Jun 17 2023 pool.d

To me it looks like some php-fpm is lost.
Will it be safe to reinstall php via apt install, or doesn’t this fix fpm?

Yes you can try to reinstall PHP

Thank you, I did.
Looks like it’s fine now, at least I get a website response:
“This version of Nextcloud is not compatible with PHP>=8.2.
You are currently running 8.2.7.”
I think, this has been addressed somewhere in the forum, so I will try to get around this.

Usually NC should have been reinstalled with our script. What is your NC version now?

OK, with your help I’ve been able to fix it all, I guess.
The script unfortunately didn’t reinstall NC for me.
Nextcloud 25.0.13 has been incompatible with PHP 8.2.7
I used the Nextcloud cli-updater, to get a compatible version (26.0.12)

If anybody else runs into broken php-fpm / Nextcloud after bullseye->bookworm upgrade, this fixed it for me:

Reinstall nginx
dietpi-software reinstall 85
Reinstall php
dietpi-software reinstall 89

cd /config/www/nextcloud/updater/
sudo -u www-data php updater.phar
sudo -u www-data php --define apc.enable_cli=1  /var/www/nextcloud/occ upgrade

If you get this error message:

Exception: App "Bookmarks" cannot be installed because the following dependencies are not fulfilled: The library intl is not available.
Update failed

Install the intl-module:
apt install php8.2-intl
Perform another upgrade:

sudo -u www-data php --define apc.enable_cli=1  /var/www/nextcloud/occ upgrade
sudo -u www-data php --define apc.enable_cli=1  /var/www/nextcloud/occ maintenance:mode --off

Thank you for your help and the really great bookworm upgrade script.

1 Like

This is already part of the Bookworm upgrade script. Even Nextcloud should have been updated automatically as part of the script (id 114).

If this was not the case, something else went wrong beforehand.

Just upgraded another machine without any flaws.
Wow, this is insane!

Overall: Will be a dietpi reinstall of nextcloud be data safe?

Thanks again
Frans

Usually we don’t touch user data on reinstall

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