Apps disabled when upgrading to 22.2.1

Nextcloud version (eg, 20.0.5): 21.0.5
Operating system and version (eg, Ubuntu 20.04): Slackware
Apache or nginx version (eg, Apache 2.4.25): nginx-1.20.1
PHP version (eg, 7.4): 8.0 or 7.4

The issue you are facing:
When “php occ -v upgrade” from 21.0.5 to 22.2.1 using php-8.0, upgrading fails with this error:

2021-11-12T06:25:43+00:00 Repair step: Migrate old user config
2021-11-12T06:25:43+00:00 Migrate old user config
2021-11-12T06:25:43+00:00
An unhandled exception has been thrown: ValueError: str_repeat(): Argument #2 ($times) must be greater than or equal to 0 in /srv/http/example.org/cloud/nextcloud/3rdparty/symfony/console/Helper/ProgressBar.php:497
Stack trace: #0 /srv/http/example.org/cloud/nextcloud/3rdparty/symfony/console/Helper/ProgressBar.php(497): str_repeat()
#1 /srv/http/example.org/cloud/nextcloud/3rdparty/symfony/console/Helper/ProgressBar.php(568): Symfony\Component\Console\Helper\ProgressBar::Symfony\Component\Console\Helper{closure}
()
#2 [internal function]: Symfony\Component\Console\Helper\ProgressBar->Symfony\Component\Console\Helper{closure}()
#3 /srv/http/example.org/cloud/nextcloud/3rdparty/symfony/console/Helper/ProgressBar.php(581): preg_replace_callback()
#4 /srv/http/example.org/cloud/nextcloud/3rdparty/symfony/console/Helper/ProgressBar.php(393): Symfony\Component\Console\Helper\ProgressBar->buildLine()
#5 /srv/http/example.org/cloud/nextcloud/3rdparty/symfony/console/Helper/ProgressBar.php(302): Symfony\Component\Console\Helper\ProgressBar->display()
#6 /srv/http/example.org/cloud/nextcloud/core/Command/Upgrade.php(135): Symfony\Component\Console\Helper\ProgressBar->start()
#7 /srv/http/example.org/cloud/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php(264): OC\Core\Command\Upgrade->OC\Core\Command{closure}()
#8 /srv/http/example.org/cloud/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php(239): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch()
#9 /srv/http/example.org/cloud/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php(73): Symfony\Component\EventDispatcher\EventDispatcher->callListeners()
#10 /srv/http/example.org/cloud/nextcloud/lib/private/EventDispatcher/SymfonyAdapter.php(123): Symfony\Component\EventDispatcher\EventDispatcher->dispatch()
#11 /srv/http/example.org/cloud/nextcloud/lib/private/Repair.php(251): OC\EventDispatcher\SymfonyAdapter->dispatch()
#12 /srv/http/example.org/cloud/nextcloud/lib/private/Repair.php(273): OC\Repair->emit()
#13 /srv/http/example.org/cloud/nextcloud/apps/accessibility/lib/Migration/RepairUserConfig.php(75): OC\Repair->startProgress()
#14 /srv/http/example.org/cloud/nextcloud/lib/private/Repair.php(123): OCA\Accessibility\Migration\RepairUserConfig->run()
#15 /srv/http/example.org/cloud/nextcloud/lib/private/legacy/OC_App.php(1070): OC\Repair->run()
#16 /srv/http/example.org/cloud/nextcloud/lib/private/legacy/OC_App.php(1007): OC_App::executeRepairSteps()
#17 /srv/http/example.org/cloud/nextcloud/lib/private/Updater.php(352): OC_App::updateApp()
#18 /srv/http/example.org/cloud/nextcloud/lib/private/Updater.php(264): OC\Updater->doAppUpgrade()
#19 /srv/http/example.org/cloud/nextcloud/lib/private/Updater.php(132): OC\Updater->doUpgrade()
#20 /srv/http/example.org/cloud/nextcloud/core/Command/Upgrade.php(241): OC\Updater->upgrade()
#21 /srv/http/example.org/cloud/nextcloud/3rdparty/symfony/console/Command/Command.php(255): OC\Core\Command\Upgrade->execute()
#22 /srv/http/example.org/cloud/nextcloud/3rdparty/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run()
#23 /srv/http/example.org/cloud/nextcloud/3rdparty/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand()
#24 /srv/http/example.org/cloud/nextcloud/3rdparty/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun()
#25 /srv/http/example.org/cloud/nextcloud/lib/private/Console/Application.php(209): Symfony\Component\Console\Application->run()
#26 /srv/http/example.org/cloud/nextcloud/console.php(99): OC\Console\Application->run()
#27 /srv/http/example.org/cloud/nextcloud/occ(11): require_once(’…’)
#28 {main}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

But I have no issue with php-7.4.

Even with a successfull upgrade using php-7.4, all apps are disabled.

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

Steps to replicate it:

  1. Extract nextcloud 22.2.1 tarball
  2. Copy *config.php in the new nextcloud/config folder (data are outside)
  3. Run “php occ upgrade”

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

<?php
$CONFIG = array (
  'instanceid' => 'xxxxxxxxxxx',
  'passwordsalt' => 'xxxxxxxxxxxxxxxxxxxxxxxx',
  'secret' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
  'trusted_domains' =>
  array (
    0 => 'cloud.example.org',
    1 => 'nuage.example.org',
  ),
  'datadirectory' => '/srv/http/example.org/cloud/data/data',
  'dbtype' => 'mysql',
  'version' => '22.2.1.2',
  'overwrite.cli.url' => 'https://cloud.example.org',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'xxxxxxxxxxxxxxxx',
  'installed' => true,
  'default_phone_region' => 'FR',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => 'localhost',
    'port' => 6379,
  ),
  'mail_from_address' => 'thomas',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => 'example.org',
  'mail_smtphost' => 'smtp.example.org',
  'mail_smtpport' => '25',
  'loglevel' => 0,
  'maintenance' => false,
  'user_backends' =>
  array (
    0 =>
    array (
      'class' => 'OC_User_IMAP',
      'arguments' =>
      array (
        0 => 'localhost',
        1 => 143,
        2 => NULL,
        3 => 'example.org',
        4 => false,
      ),
    ),
  ),
  'updater.release.channel' => 'stable',
  'appstoreenabled' => true,
  'appstore.experimental.enabled' => false,
  'theme' => '',
);

Do you know a way to have all my apps still enabled after the upgrade please?

En fait mon nextcloud de test étant installé en local, il disait qu’il n’était plus connecté à Internet alors que aucune modif n’a été faite.
En ajoutant “‘allow_local_remote_servers’ => true,” dans la config, la MAJ (sous php-7.4) a bien fonctionnée.