Error when updating via command line from 25.0.7 to 26.0.2

Nextcloud version (eg, 20.0.5): 25.0.7
Nextcloud Updater - version: v25.0.3-2-gd49ee0d
Operating system and version (eg, Ubuntu 20.04): Unraid 6.11.5
Apache or nginx version (eg, Apache 2.4.25): nginx/1.22.1
PHP version (eg, 7.4): PHP 8.1.19

The issue you are facing:

In updating from 25.0.7 to 26.0.2 via command line, I receive the error below during the “Delete old files” operation during the update. I have attempted to rollback the container version and re-run the update command, but it still fails. After the below error, it kicks me out of my terminal session, and if I try to update again it states “Step 9 is currently in process. Please call this command later.”. Deleting the update directory allows the update process to restart, but ultimately still ends in the error below.

[✔] Check for expected files
[✔] Check for write permissions
[✔] Create backup
[✔] Downloading
[✔] Verify integrity
[✔] Extracting
[✔] Enable maintenance mode
[✔] Replace entry points
[ ] Delete old files ...PHP Warning: Trying to access array offset on value of type null in phar:///config/www/nextcloud/updater/updater.phar/lib/Updater.php on line 817

PHP Fatal error: Uncaught TypeError: array_merge(): Argument #1 must be of type array, null given in phar:///config/www/nextcloud/updater/updater.phar/lib/Updater.php:818

Stack trace:

#0 phar:///config/www/nextcloud/updater/updater.phar/lib/Updater.php(818): array_merge()

#1 phar:///config/www/nextcloud/updater/updater.phar/lib/UpdateCommand.php(380): NC\Updater\Updater->deleteOldFiles()

#2 phar:///config/www/nextcloud/updater/updater.phar/lib/UpdateCommand.php(234): NC\Updater\UpdateCommand->executeStep()

#3 phar:///config/www/nextcloud/updater/updater.phar/vendor/symfony/console/Command/Command.php(255): NC\Updater\UpdateCommand->execute()

#4 phar:///config/www/nextcloud/updater/updater.phar/vendor/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run()

#5 phar:///config/www/nextcloud/updater/updater.phar/vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand()

#6 phar:///config/www/nextcloud/updater/updater.phar/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun()

#7 phar:///config/www/nextcloud/updater/updater.phar/updater.php(10): Symfony\Component\Console\Application->run()

#8 /config/www/nextcloud/updater/updater.phar(14): require('...')

#9 {main}

thrown in phar:///config/www/nextcloud/updater/updater.phar/lib/Updater.php on line 818
    

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

Steps to replicate it:

  1. attempt to install via command line:

    root@ca2f7f:/config/www/nextcloud/updater# sudo -u abc php updater.phar

The output of your Nextcloud log in Admin > Logging: unable to log in, website stats “Update in process.”

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

<?php
$CONFIG = array (
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'datadirectory' => '/data',
  'instanceid' => '*****',
  'passwordsalt' => '******',
  'secret' => '******,
  'trusted_domains' => 
  array (
    0 => 'nextcloud.******.duckdns.org',
  ),
  'overwrite.cli.url' => 'https://nextcloud.******.duckdns.org',
  'overwritehost' => 'nextcloud.******.duckdns.org',
  'overwriteprotocol' => 'https',
  'dbtype' => 'mysql',
  'version' => '25.0.7.1',
  'dbname' => 'nextcloud',
  'dbhost' => '192.168.1.xx:3306',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => '******',
  'dbpassword' => '******',
  'installed' => true,
  'maintenance' => true,
  'loglevel' => 2,
  'theme' => '',
  'updater.release.channel' => 'stable',
  'twofactor_enforced' => 'false',
  'twofactor_enforced_groups' => 
  array (
  ),
  'twofactor_enforced_excluded_groups' => 
  array (
  ),
  'app_install_overwrite' => 
  array (
    0 => 'tasks',
    1 => 'spreed',
  ),
  'updater.secret' => '******',
);

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

2023/06/11 13:09:31 [error] 281#281: *278 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: **.***.**.***, server: _, request: "PUT /ocs/v2.php/apps/user_status/api/v1/heartbeat?format=json HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "nextcloud.*****.duckdns.org:443", referrer: "https://nextcloud.*****.duckdns.org/index.php/apps/dashboard/"
2023/06/11 13:09:31 [error] 280#280: *277 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: **.***.**.***, server: _, request: "PUT /ocs/v2.php/apps/user_status/api/v1/heartbeat?format=json HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "nextcloud.*****.duckdns.org:443", referrer: "https://nextcloud.*****.duckdns.org/index.php/apps/dashboard/"
2023/06/11 13:09:31 [error] 280#280: *277 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: **.***.**.***, server: _, request: "PUT /ocs/v2.php/apps/user_status/api/v1/heartbeat?format=json HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "nextcloud.*****.duckdns.org:443", referrer: "https://nextcloud.*****.duckdns.org/index.php/apps/dashboard/"
2023/06/11 13:09:31 [error] 281#281: *278 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: **.***.**.***, server: _, request: "PUT /ocs/v2.php/apps/user_status/api/v1/heartbeat?format=json HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "nextcloud.*****.duckdns.org:443", referrer: "https://nextcloud.*****.duckdns.org/index.php/apps/dashboard/"
2023/06/11 13:10:33 [error] 280#280: *285 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: **.***.**.***, server: _, request: "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "nextcloud.*****.duckdns.org:443", referrer: "https://nextcloud.*****.duckdns.org/index.php/apps/dashboard/"
2023/06/11 13:10:33 [error] 280#280: *285 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: **.***.**.***, server: _, request: "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "nextcloud.*****.duckdns.org:443", referrer: "https://nextcloud.*****.duckdns.org/index.php/apps/dashboard/"

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

[11-Jun-2023 02:00:01] NOTICE: fpm is running, pid 332

[11-Jun-2023 02:00:01] NOTICE: ready to handle connections

[11-Jun-2023 12:30:30] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it

[11-Jun-2023 12:43:31] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it

[11-Jun-2023 12:58:05] NOTICE: Terminating ...

[11-Jun-2023 12:58:05] NOTICE: exiting, bye-bye!

[11-Jun-2023 12:58:25] NOTICE: fpm is running, pid 252

[11-Jun-2023 12:58:25] NOTICE: ready to handle connections

[11-Jun-2023 12:59:35] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it

[11-Jun-2023 13:14:24] NOTICE: Terminating ...

[11-Jun-2023 13:14:24] NOTICE: exiting, bye-bye!

[11-Jun-2023 13:14:37] NOTICE: fpm is running, pid 241

[11-Jun-2023 13:14:37] NOTICE: ready to handle connections

[11-Jun-2023 13:59:51] NOTICE: Terminating ...

[11-Jun-2023 13:59:51] NOTICE: exiting, bye-bye!

[11-Jun-2023 14:00:05] NOTICE: fpm is running, pid 246

[11-Jun-2023 14:00:05] NOTICE: ready to handle connections

[11-Jun-2023 14:13:11] NOTICE: Terminating ...

[11-Jun-2023 14:13:11] NOTICE: exiting, bye-bye!

[11-Jun-2023 14:13:24] NOTICE: fpm is running, pid 246

[11-Jun-2023 14:13:24] NOTICE: ready to handle connections

[11-Jun-2023 14:37:52] NOTICE: Terminating ...

[11-Jun-2023 14:37:52] NOTICE: exiting, bye-bye!

[11-Jun-2023 14:37:58] NOTICE: fpm is running, pid 245

[11-Jun-2023 14:37:58] NOTICE: ready to handle connections

[11-Jun-2023 14:40:45] NOTICE: Terminating ...

[11-Jun-2023 14:40:45] NOTICE: exiting, bye-bye!

[11-Jun-2023 14:40:51] NOTICE: fpm is running, pid 243

[11-Jun-2023 14:40:51] NOTICE: ready to handle connections

Updater log:

Hmm, forum searched a few of your generic errors and found some results that could help.

https://help.nextcloud.com/search?q=PHP%20Warning%3A%20Trying%20to%20access%20array%20offset%20on%20value%20of%20type%20null%20in

https://help.nextcloud.com/search?q=WARNING%3A%20%5Bpool%20www%5D%20server%20reached%20pm.max_children%20setting%20(5)%2C%20consider%20raising%20it

https://help.nextcloud.com/search?q=FastCGI%20sent%20in%20stderr%3A%20%22Primary%20script%20unknown%22%20while%20reading%20response%20header

Thanks for the suggestions. I think the first PHP warning and the subsequent error:

PHP Fatal error: Uncaught TypeError: array_merge(): Argument #1 must be of type array, null given in phar:///config/www/nextcloud/updater/updater.phar/lib/Updater.php:818

is the culprit. Unfortunately I did not see anything that helped in the forums.

My guess is your version of PHP. Try rolling it back to an earlier release such as 8.0

I think you are right, I was able to solve the issue:

I rolled back the container to version 24.0.6, which contained PHP 7.4.26

Ran update but it still states it is stuck on Step 9, so I went into the update directory and edited the “.step” file to indicate the step is at the end of Step 8 instead of running Step 9. Re-ran the update command and it was able to finish Step 9 (delete old files). But, on the “occ upgrade” step it stated it needs PHP 8. So, I updated the container to v26.0.0, which contains PHP 8.1.18, re-ran the update commend where it skipped the installation since it was already completed, and successfully completed the. occ upgrade. Nextcloud is up and running!

So, in my case, it appears I needed PHP 7 to install the update, but PHP 8 to run the occ update command.

Thanks everyone for the help!

1 Like