Need Help NextCloud

Hello, please help. After updating to version 24.0.3, an error occurred:
I updated through the browser, I am using NextCloud for the first time.

  1. Update from Nextcloud 24.0.0 to 24.0.3.
  2. sudo -u www-data php /var/www/nextcloud/occ upgrade

An unhandled exception has been thrown:
TypeError: Symfony\Component\EventDispatcher\GenericEvent::getArgument(): Argument #1 ($key) must be of type string, int given, called in /var/www/nextcloud/lib/private/EventDispatcher/GenericEventWrapper.php on line 81 and defined in /var/www/nextcloud/apps/files_scripts/vendor/symfony/event-dispatcher/GenericEvent.php:60
Stack trace:
#0 /var/www/nextcloud/lib/private/EventDispatcher/GenericEventWrapper.php(81): Symfony\Component\EventDispatcher\GenericEvent->getArgument()
#1 /var/www/nextcloud/lib/private/Updater.php(499): OC\EventDispatcher\GenericEventWrapper->getArgument()
#2 /var/www/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php(251): OC\Updater->OC{closure}()
#3 /var/www/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php(73): Symfony\Component\EventDispatcher\EventDispatcher->callListeners()
#4 /var/www/nextcloud/lib/private/EventDispatcher/SymfonyAdapter.php(122): Symfony\Component\EventDispatcher\EventDispatcher->dispatch()
#5 /var/www/nextcloud/lib/private/Repair.php(259): OC\EventDispatcher\SymfonyAdapter->dispatch()
#6 /var/www/nextcloud/lib/private/Repair.php(122): OC\Repair->emit()
#7 /var/www/nextcloud/lib/private/Updater.php(252): OC\Repair->run()
#8 /var/www/nextcloud/lib/private/Updater.php(133): OC\Updater->doUpgrade()
#9 /var/www/nextcloud/core/Command/Upgrade.php(235): OC\Updater->upgrade()
#10 /var/www/nextcloud/apps/files_scripts/vendor/symfony/console/Command/Command.php(298): OC\Core\Command\Upgrade->execute()
#11 /var/www/nextcloud/apps/files_scripts/vendor/symfony/console/Application.php(1024): Symfony\Component\Console\Command\Command->run()
#12 /var/www/nextcloud/apps/files_scripts/vendor/symfony/console/Application.php(299): Symfony\Component\Console\Application->doRunCommand()
#13 /var/www/nextcloud/apps/files_scripts/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun()
#14 /var/www/nextcloud/lib/private/Console/Application.php(211): Symfony\Component\Console\Application->run()
#15 /var/www/nextcloud/console.php(100): OC\Console\Application->run()
#16 /var/www/nextcloud/occ(11): require_once(‘…’)

Server configuration
Operating system: Ubuntu 22.04 server
Web server: nginx
Database: PostgreSQL
PHP version: 8.1.2

I change the directory to Nextcloud and then run the commands but i don’t think it matters.

you can try adding 8.1; php8.1 not just php.

Maybe you did not run Nextcloud update first.

you might be running a different default php than what your Nextcloud is running:

i learned this yesterday from Master Xiao Guoan:

check your default php version by running:
php -version

set default php by running
sudo update-alternatives --config php

For Nextcloud Upgrade this is what i do:

1st: Back up the database (Will download to /home) sudo -u postgres -i pg_dump -F t your-db-name > your-db-name_pgsql.tar

2nd: Then use tar to back up the config folder (Will download to /home) sudo tar -cpzvf ~/nextcloud-config.tar.gz config/

3rd: Update Apps: sudo -u www-data php8.1 occ app:update --all

4th: Update Nextcloud: sudo -u www-data php8.1 updater/updater.phar --no-interaction

5th: Upgrade Nextcloud: sudo -u www-data php8.1 occ upgrade

6th: sudo systemctl restart php8.1-fpm

Problems you can try: sudo -u www-data php8.1 occ maintenance:repair

I hope you get your system back up and running. Nextcloud is great!!!

LinuxBabe Upgrade NextCloud

Don’t forget to donate to LinuxBabe so he can keep writing great tutorials for us!!!

Donate