Internal Server Error - NC v21.0.1

Nextcloud version : 21.0.1
Operating system and version : Debian 10
Apache : Apache/2.4.38 (Debian)
PHP version : 7.3.31-1~deb10u1

Hello,

I’m encountering “Internal Server Error” when trying to migrate to a different server from NC 20 to NC 21.0.1 :
“The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the server log.”

The output of occ:repair command is :
"
An unhandled exception has been thrown:
Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [1045] Access denied for user ‘adminer’@‘localhost’ (using password: YES) in /var/www/nextcloud/lib/private/DB/Connection.php:72
"

Config.php on the new server:
"

<?php $CONFIG = array ( 'instanceid' => 'xxx', 'passwordsalt' => 'xxx', 'secret' => 'xxx', 'trusted_domains' => array ( 0 => 'xxx', 1 => 'xxx', 2 => 'xxx', ), 'datadirectory' => '/var/www/nextcloud/data', 'overwrite.cli.url' => 'xxx', 'dbtype' => 'mysql', 'version' => '20.0.14.2', 'dbname' => 'nextcloud', 'dbhost' => 'localhost', 'dbport' => '', 'dbtableprefix' => 'oc_', 'mysql.utf8mb4' => true, 'dbuser' => 'adminer', 'dbpassword' => 'xxx', 'installed' => true, 'mail_from_address' => 'contact', 'mail_smtpmode' => 'sendmail', 'mail_smtphost' => '127.0.0.1', 'mail_smtpport' => '465', 'mail_smtptimeout' => 10, 'mail_smtpauthtype' => 'LOGIN', 'mail_domain' => 'xxx', 'mail_smtpsecure' => 'ssl', 'mail_smtpauth' => 1, 'mail_smtpname' => '', 'mail_smtppassword' => '', 'maintenance' => true, 'updater.secret' => 'xxx', 'loglevel' => 0, 'theme' => '', 'app_install_overwrite' => array ( 0 => 'files_antivirus', 1 => 'groupfolders', 2 => 'files_downloadactivity', 3 => 'admin_notifications', ), 'updater.release.channel' => 'stable', 'mail_sendmailmode' => 'smtp', 'encryption.legacy_format_support' => true, 'encryption.key_storage_migrated' => false, " Any help please. Thank you !

You cannot skip version numbers when updating.

What is the recommanded procedure then ?

You need to update version by version and not skip one version.

Sorry, I just checked the version and confirmed that I’m trying to migrate from NC 20.0.14 to NC 21.0.1 by using a TKL container.

Backup your nextcloud config under config/config.php and empty everything that you’ve added / is not needed by default. Update should work fine then

Well, then that is for sure an app which is not yet ready for updating.

Just disable them before.

I’ve just seen that you’ve edited your Question.

I guess you’re running into the same Error everytime you are executing a occ command.

The fix for this is simple: You need to specify the correct php version used in your nextcloud.
for example your command could look like this:
sudo -u www-data /usr/bin/php7.3 /var/nextcloud/occ occ:repair

Hope that this is of any use for you