Error upgrading to 22.2.6 with OpenStack Object Storage

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com 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:

example

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

longer
example
here

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): 22.2.6
Operating system and version (eg, Ubuntu 20.04): Ubuntu 18.04
Apache or nginx version (eg, Apache 2.4.25): Nginx 1.20.2
PHP version (eg, 7.4): 8.0

The issue you are facing:

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

Steps to replicate it:

  1. start web based upgrade
  2. ./occ upgrade

The output of your Nextcloud log in Admin > Logging:

$ ./occ upgrade          
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Setting log level to debug
Updating database schema
Updated database
An unhandled exception has been thrown:
Error: Call to undefined function GuzzleHttp\Psr7\modify_request() in /var/www/labfoto.it/nextcloud/3rdparty/php-opencloud/openstack/src/Common/Auth/AuthHandler.php:56
Stack trace:
#0 /var/www/labfoto.it/nextcloud/3rdparty/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php(35): OpenStack\Common\Auth\AuthHandler->__invoke()
#1 /var/www/labfoto.it/nextcloud/3rdparty/php-opencloud/openstack/src/Common/Transport/Middleware.php(22): GuzzleHttp\PrepareBodyMiddleware->__invoke()
#2 /var/www/labfoto.it/nextcloud/3rdparty/guzzlehttp/guzzle/src/HandlerStack.php(75): OpenStack\Common\Transport\Middleware::OpenStack\Common\Transport\{closure}()
#3 /var/www/labfoto.it/nextcloud/3rdparty/guzzlehttp/guzzle/src/Client.php(331): GuzzleHttp\HandlerStack->__invoke()
#4 /var/www/labfoto.it/nextcloud/3rdparty/guzzlehttp/guzzle/src/Client.php(168): GuzzleHttp\Client->transfer()
#5 /var/www/labfoto.it/nextcloud/3rdparty/guzzlehttp/guzzle/src/Client.php(187): GuzzleHttp\Client->requestAsync()
#6 /var/www/labfoto.it/nextcloud/3rdparty/php-opencloud/openstack/src/Common/Api/OperatorTrait.php(115): GuzzleHttp\Client->request()
#7 /var/www/labfoto.it/nextcloud/3rdparty/php-opencloud/openstack/src/Common/Api/OperatorTrait.php(123): OpenStack\Common\Resource\OperatorResource->sendRequest()
#8 /var/www/labfoto.it/nextcloud/3rdparty/php-opencloud/openstack/src/Common/Resource/OperatorResource.php(55): OpenStack\Common\Resource\OperatorResource->execute()
#9 /var/www/labfoto.it/nextcloud/3rdparty/php-opencloud/openstack/src/ObjectStore/v1/Models/Container.php(142): OpenStack\Common\Resource\OperatorResource->executeWithState()
#10 /var/www/labfoto.it/nextcloud/lib/private/Files/ObjectStore/SwiftFactory.php(266): OpenStack\ObjectStore\v1\Models\Container->getMetadata()
#11 /var/www/labfoto.it/nextcloud/lib/private/Files/ObjectStore/SwiftFactory.php(247): OC\Files\ObjectStore\SwiftFactory->createContainer()
#12 /var/www/labfoto.it/nextcloud/lib/private/Files/ObjectStore/Swift.php(62): OC\Files\ObjectStore\SwiftFactory->getContainer()
#13 /var/www/labfoto.it/nextcloud/lib/private/Files/ObjectStore/Swift.php(105): OC\Files\ObjectStore\Swift->getContainer()
#14 /var/www/labfoto.it/nextcloud/lib/private/Files/ObjectStore/ObjectStoreStorage.php(312): OC\Files\ObjectStore\Swift->readObject()
#15 /var/www/labfoto.it/nextcloud/lib/private/Files/Storage/Common.php(196): OC\Files\ObjectStore\ObjectStoreStorage->fopen()
#16 /var/www/labfoto.it/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php(247): OC\Files\Storage\Common->file_get_contents()
#17 /var/www/labfoto.it/nextcloud/lib/private/Files/Storage/Wrapper/Availability.php(264): OC\Files\Storage\Wrapper\Wrapper->file_get_contents()
#18 /var/www/labfoto.it/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php(247): OC\Files\Storage\Wrapper\Availability->file_get_contents()
#19 /var/www/labfoto.it/nextcloud/lib/private/Files/View.php(1171): OC\Files\Storage\Wrapper\Wrapper->file_get_contents()
#20 /var/www/labfoto.it/nextcloud/lib/private/Files/View.php(601): OC\Files\View->basicOperation()
#21 /var/www/labfoto.it/nextcloud/lib/private/Files/Node/File.php(56): OC\Files\View->file_get_contents()
#22 /var/www/labfoto.it/nextcloud/lib/private/Files/SimpleFS/SimpleFile.php(90): OC\Files\Node\File->getContent()
#23 /var/www/labfoto.it/nextcloud/lib/private/App/AppStore/Fetcher/Fetcher.php(154): OC\Files\SimpleFS\SimpleFile->getContent()
#24 /var/www/labfoto.it/nextcloud/lib/private/Installer.php(432): OC\App\AppStore\Fetcher\Fetcher->get()
#25 /var/www/labfoto.it/nextcloud/lib/private/Updater.php(427): OC\Installer->isUpdateAvailable()
#26 /var/www/labfoto.it/nextcloud/lib/private/Updater.php(273): OC\Updater->upgradeAppStoreApps()
#27 /var/www/labfoto.it/nextcloud/lib/private/Updater.php(132): OC\Updater->doUpgrade()
#28 /var/www/labfoto.it/nextcloud/core/Command/Upgrade.php(235): OC\Updater->upgrade()
#29 /var/www/labfoto.it/nextcloud/3rdparty/symfony/console/Command/Command.php(255): OC\Core\Command\Upgrade->execute()
#30 /var/www/labfoto.it/nextcloud/3rdparty/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run()
#31 /var/www/labfoto.it/nextcloud/3rdparty/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand()
#32 /var/www/labfoto.it/nextcloud/3rdparty/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun()
#33 /var/www/labfoto.it/nextcloud/lib/private/Console/Application.php(209): Symfony\Component\Console\Application->run()
#34 /var/www/labfoto.it/nextcloud/console.php(99): OC\Console\Application->run()
#35 /var/www/labfoto.it/nextcloud/occ(11): require_once('...')
#36 {main}%                           

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

<?php
$CONFIG = array (
  'instanceid' => '*********',
  'passwordsalt' => '************',
  'secret' => '****************',
  'trusted_domains' => 
  array (
    0 => 'labfoto.associazioneroccabrivio.com',
    1 => 'localhost',
  ),
  'datadirectory' => '/var/www/labfoto.it/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '23.0.3.2',
  'overwrite.cli.url' => 'https://labfoto.associazioneroccabrivio.com',
  'dbname' => 'labfoto_nextcloud',
  'dbhost' => '127.0.0.1:3307',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => '********',
  'dbpassword' => '*******',
  'installed' => true,
  'logfile' => '/var/www/labfoto.it/nextcloud/data/nextcloud.log',
  'loglevel' => 0,
  'objectstore' => 
  array (
    'class' => 'OC\\Files\\ObjectStore\\Swift',
    'arguments' => 
    array (
      'autocreate' => true,
      'user' => 
      array (
        'name' => '************',
        'password' => '********************',
        'domain' => 
        array (
          'name' => 'Default',
        ),
      ),
      'scope' => 
      array (
        'project' => 
        array (
          'name' => '4877444813151481',
          'domain' => 
          array (
            'name' => 'Default',
          ),
        ),
      ),
      'serviceName' => 'swift',
      'region' => 'GRA',
      'url' => 'https://auth.cloud.ovh.net/v3',
      'bucket' => 'foto-condivise',
    ),
  ),
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'filelocking.enabled' => true,
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => 'localhost',
    'port' => 6379,
  ),
  'mail_smtpmode' => 'smtp',
  'mail_smtphost' => 'localhost',
  'mail_sendmailmode' => 'smtp',
  'mail_smtpport' => '25',
  'mail_from_address' => 'labfoto',
  'mail_domain' => 'example.com',
  'maintenance' => true,
  'theme' => '',
  'default_language' => 'it',
  'default_phone_region' => 'IT',
  'preview_max_x' => 2400,
  'preview_max_y' => 2400,
  'updater.secret' => '***************************',
);

1 Like

I have the same problem.

Removing external storage of type “OpenStack Object Storage” helped, but it seems like it is unusable now.

The ultimate solution is to upgrade php-openstack to a version that does not use functions deprecated in Guzzle v7.2

A workaround would be to manually patch two files that use deprecated functions to instead use GuzzleHttp\Psr7\Utils;, and to change calls of two problematic functions, modify_request() and stream_for(), to instead use Utils::modifyRequest() and Utils::streamFor() as noted in a few different projects and issues:

Specifically, patch file /var/www/nextcloud/3rdparty/php-opencloud/openstack/src/Common/Auth/AuthHandler.php changing the import on line 3 and the function call on line 56 as in Fix Call to undefined function GuzzleHttp\Psr7\modify_request() by alcalyn · Pull Request #331 · php-opencloud/openstack · GitHub

and patch file /var/www/html/lib/private/Files/ObjectStore/Swift.php as in Call to undefined function GuzzleHttp\\Psr7\\stream_for() · Issue #2824 · guzzle/guzzle · GitHub

I can obviously not vouch for how messed up your installation might be after these modifications, but they are very small (and likely the actual code changes that will happen), so your risk is probably very very minor.

After this monkey-patching I was able to finish the upgrade without issue and turn off maintenance mode. No issues in performance - something likely needed to stop using a deprecated function that was eventually removed.

Same problem here, I’m still 7.4. I will take time to clean php and try 8.0. will feedback here