Nextcloud update catastrophe

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face: is for home/non-enterprise users. If you’re running a business, paid support can be accessed via where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:


Or for longer, use three backticks above and below the code snippet:


Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 20.0.5): 20.0.3 -> 20.0.5
Operating system and version (eg, Ubuntu 20.04): dietpi, custom config
Apache or nginx version (eg, Apache 2.4.25): nginx 1.18.0
PHP version (eg, 7.4): 7.4 -> 8.0/8.2

The issue you are facing:

I tried to update from 20.0.3 to 20.0.5 and guess what I needed a new php version
and I did that, I think, I manually updated nextcloud but now I get an internal error and the log says this:

{“reqId”:“IHihh885rcTU7XcLcvTj”,“level”:1,“time”:“2023-03-27T16:44:11+00:00”,“remoteAddr”:“”,“user”:“–”,“app”:“related_resources”,“method”:“”,“url”:“–”,“message”:“Could not resolve OCA\Circles\CirclesManager! Class "OCA\Circles\CirclesManager" does not exist”,“userAgent”:“–”,“version”:“”,“data”:{“app”:“related_resources”}}

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. Manually update
  2. Update php
  3. ??

The output of your Nextcloud log in Admin > Logging:

can't access it

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

$CONFIG = array (
  'instanceid' => 'nyancat',
  'passwordsalt' => 'wow/so//secret',
  'secret' => 'wowsosecret',
  'trusted_domains' =>
  array (
    0 => '',
    1 => 'redspi.local',
    2 => '',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '',
    'port' => 6379,
  'datadirectory' => '/mnt/1T/CLOUD',
  'dbtype' => 'mysql',
  'version' => '',
  'overwrite.cli.url' => '',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'oc_admin1',
  'dbpassword' => 'wowsosecret',
  'installed' => true,
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 0,
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'mail_smtphost' => '',
  'mail_smtpport' => '465',
  'mail_smtpsecure' => 'ssl',
  'mail_smtpname' => 'apikey',
  'mail_smtppassword' => 'wowsosecret',
  'app_install_overwrite' =>
  array (
    0 => 'video_converter',
    1 => 'files_archive',
    2 => 'duplicatefinder',
    3 => 'ocdownloader',
  'mail_domain' => '',
  'mail_from_address' => 'cloud',
  'updater.secret' => 'wowsosecret',

The output of your Apache/nginx/system log in /var/log/____:

I already gave the log segment above, the rest is connections

Check the php packages of the old php version, and make sure all corresponding packages are installed for the new version.

I’m confident that I can help you but I need more information:

How did you do the php-Update EXACTLY?

What is the output of

dpkg -l | awk '/^ii/ {print $2}' | grep -Ei "ph(p|ar)"

and from

ls /etc/php/

Stay cool, no “catastrophe” :wink:

You writes update from 20.0.3 to 20.0.5. For a minor release, no need to update PHP version. That will only be required for some major releases. Stick to 7.4 until updating to a version that needs 8.0 and onwards.
However your config.php shows that you updated to latest and greatest (26). That requires php 8.1 as minimum but do support 8.2.
I just went through the update today. This is what I did (I use Apache2 and fpm, but change the stuff to fit your setup):

php -v
#If it outputs php version 8.0 then do the below. I will assume 8.0 for the rest of this 
php8.0 -m

I copy the output of all installed extensions to a textfile.

I then do:

apt-get install php8.2 php8.2-{fpm,cli,mbstring,all-the-listed-extensions-delimited,by-comma}

It will show that some of the extensions will be part of the other exntension like json and such. Then just remove them one by one from the comma seperated list of extensions.

Then run

php8.2 -m

to get list of extensions. Compare to the one you copied to a text document. See if you needs a few extra individually. Between versions, some extensions are either deprecated or renamed and so on, so use google to find the correct names - if needed.

Now move your current nextcloud landing page - DO NOT FORGET THIS STEP!! And generate a new one in nextcloud folder. Change owner and make it executeable:

mv /var/www/nextcloud/index.php ~/backup/index.php_bak
echo "<?php phpinfo(); ?>" &> /var/www/nextcloud/index.php
chown www-data:www-data /var/www/nextcloud/index.php
chmod +x /var/www/nextcloud/index.php

Go ahead and open your browser and go to your nextcloud frontpage.

New keeping that one page open I starts running diff for each loaded ini file:

diff /etc/php/8.0/fpm/php.ini /etc/php/8.2/fpm/php.ini

There I notice differences in memory and max allowed file upload sizes and OPCache and so on and with nano, edit or vi, I do the required changes. When I am happy with the config, I then switch fpm version:

a2disconf php8.0-fpm; a2enconf php8.2-fpm; systemctl restart php8.2-fpm; systemctl reload apache2

Now refresh your webpage again and look for PHP version as well as loaded extensions, memory settings, opcache and so on to verify that they are as you like.

When all seems as you want, move the real Nextcloud index.php back in place and make sure ownership is in order and that it can be executed:

mv ~/backup/index.php_bak /var/www/nextcloud/index.php
chown www-data:www-data /var/www/nextcloud/index.php
chmod +x /var/www/nextcloud/index.php 

Now refresh your webpage and you should see your nextcloud running safe and sound and using php8.2.

Now make sure to reconfig default system PHP:

systemctl stop php8.0-fpm
update-alternatives --config php
update-alternatives --config phar
update-alternatives --config phar.phar

Couldn’t you make it more complicated? :joy:

This does the same thing, only faster and more reliable:

apt-get install $(echo `dpkg -l | awk '/^ii/ {print $2}' | grep -i php$old | sed 's/php'$old'/php'$new'/g'`)

goes much faster and more reliable with this script:

wget -O /usr/local/bin/php-ini-migrator
chmod +x /usr/local/bin/php-ini-migrator
php-ini-migrator $old $new

That is nice, but do you know if the OP uses fpm?

This does the same thing, only faster and more reliable:

for linkgroup in `ls /var/lib/dpkg/alternatives/ | grep -E "ph(ar|p)"`; do update-alternatives --config $linkgroup; done

We want to help the OP and not make it unnecessarily complicated, right?

Peace :heart:

1 Like

I tried to remove 7.4 but the folder is still there, I don’t think the package is installed anymore and I removed the service I moved the configs and reinstalled most if not all the libraries? I think

root@redspi:~# dpkg -l | awk ‘/^ii/ {print $2}’ | grep -Ei “ph(p|ar)”
root@redspi:~# ls /etc/php/
7.4 8.0 8.2

also sorry, umm the current version is

$OC_VersionString = ‘26.0.0’;

I totally got it wrong in my first comment.
So no I couldn’t keep 7.4 it requested 8.0 or above and after that the real problems began

Where did you move “the configs” to?

Because the way you did it is very destructive. One does not remove an old version, before the new version works.

I have a script to take-over all settings from your old installed version but it needs to be at the places where they belong and not “moved”

You are working with Linux. That means, you have the means to shoot into your own feets day by day. So may this be a lesson.
Stay cool and try to get the old config files back on their places.
and provide the output of

grep php7.4 "/var/log/apt/history.log"

When you get the config files on theire old place and I know, which packages you removed, we will get everything up and running again.

Neither of those return any result. I have the 7.4 folder in etc php

Maybe I try to teach people something and not just provide them with a “magical” wand, that they can reverse engineer if something goes wrong, only if they are working professionally with Linux every day. I also started saying that this was MY upgrade, but the steps - regardless of using fpm or not - can be used and adapted easily, also by none super admins.

The important difference between you and me on this forum, is that I do not just wants to fix peoples issues. I would like them to learn something so they are better suited to fix things themselves afterwards.

And stop being arrogant. It is an ugly trait. Honostly.

apt-get install $(echo `dpkg -l | awk '/^ii/ {print $2}' | grep -i php$old | sed 's/php'$old'/php'$new'/g'`)

Aha so when it grabs installed modules, it will iterate and install one-to-one. So when it fails because some of the modules is installed with other packages, hence the command will exit before it is finished, where does that leave the OP if they have no clue of what excactly happens?

Basically we are doing the excact same thing. Difference is that both for learning and for the sake of OP to keep on track with the steps and being forced to see the configs that the OP has to “move”, will undoubtfully leave some of them in their mind, so they knows where to go and tweak, next time they needs to tweak a setting.

1 Like

Did you mean this:

then try

zgrep php7.4 "/var/log/apt/history.log.1.gz"

and you did not touch it?
What says

ls -l /etc/php/7.4/*

I want to apologize if I came across as arrogant

Peace :heart:

1 Like

~# ls -l /etc/php/7.4/*
total 4
drwxr-xr-x 2 root root 4096 Mar 27 17:30 conf.d

total 4
drwxr-xr-x 2 root root 4096 Mar 27 17:30 conf.d

total 40
-rw-r–r-- 1 root root 18 Feb 14 2021 apcu.ini
-rw-r–r-- 1 root root 72 Nov 8 11:40 bcmath.ini
-rw-r–r-- 1 root root 241 Mar 11 22:27 dietpi-nextcloud.ini-rw-r–r-- 1 root root 229 Nov 18 18:13 dietpi.ini
-rw-r–r-- 1 root root 66 Nov 8 11:40 gmp.ini
-rw-r–r-- 1 root root 364 Feb 14 2021 igbinary.ini
-rw-r–r-- 1 root root 60 Mar 5 2021 imagick.ini
-rw-r–r-- 1 root root 77 Nov 8 11:40 pdo_sqlite.ini
-rw-r–r-- 1 root root 19 Feb 16 2021 redis.ini
-rw-r–r-- 1 root root 74 Nov 8 11:40 sqlite3.ini

Also I am knowledged pretty well in Linux, otherwise i don’t think I’d have a secure ssh for my server anywhere in the world

Good. :+1:

Did you (re)move both php.ini files manualy?
If yes, did you already merge the old settings in the new php.ini from the version you want to use or did you simply replace the php.ini files?

did you manualy disable php7.4-fpm and enable php8.2-fpm?

To find this out, what says:
ls /etc/apache2/conf-enabled | grep php

I don’t use Apache, i have nginx

OK, then, prosuming this is your config:

grep --context=4 fpm /etc/nginx/conf.d/default.conf

And this output is from importance too:

update-alternatives --get-selections | grep -E "ph(ar|p)"

And the other questions?

~# ls /etc/nginx/conf.d/
~# update-alternatives --get-selections | grep -E “ph(ar|p)”
phar auto /usr/bin/phar.default
phar.phar auto /usr/bin/phar.phar.default
php auto /usr/bin/php.defaultphp-fpm.sock auto /run/php/php8.2-fpm.sock
phpdbg auto /usr/bin/phpdbg8.2

That’s not the location where the nginx config is haha

Why not try to first disable the circles app? It seems the error is from that one.

sudo -u nginx php /var/www/nextcloud/occ app:disable circles
1 Like

then adapt accordingly :wink:

This is helpfull

I would have expected it to look this way:

phar auto /usr/bin/phar8.2
phar.phar auto /usr/bin/phar8.2
php auto /usr/bin/php8.2
php-fpm.sock auto /run/php/php8.2-fpm.sock
phpdbg auto /usr/bin/phpdbg8.2

What says:
readlink -f $(which php)

You could try to find out if alternatives with the ‘8.2’ extension exist and select them manually:

for linkgroup in $(ls /var/lib/dpkg/alternatives/ | grep -E "ph(ar|p)"); do update-alternatives --config $linkgroup; done

If that does not help and removing the “circles” app as suggested by @Kerasit does not solve the problem, then a complete reinstallation of php could be considered:

first: save your php.ini files with your settings, that you know where to look for reasonable settings that once worked :wink:
If your ini files are lost already, getting the desired settings back is not that much of an effort.


In the first step it removes all php related packages and removes all configuration files
In the second step it freshly installs all needed php packages you need for nextcloud. Nothing else should be needed.

sudo apt-get remove --purge php*
sudo apt-get install php8.2-apcu php8.2-bcmath php8.2-bz2 php8.2-cli php8.2-common php8.2-curl php8.2-fpm php8.2-gd php8.2-gmp php8.2-igbinary php8.2-imagick php8.2-intl php8.2-mbstring php8.2-mysql php8.2-opcache php8.2-readline php8.2-redis php8.2-xml php8.2-zip

When that is done, you should adapt the changes to the php.ini files for cli and fpm and tweak your fpm in /etc/php/8.2/fpm/pool.d/www.conf file